--- a/jdk/make/sun/Makefile Fri Jun 15 21:01:55 2012 +0400
+++ b/jdk/make/sun/Makefile Tue Jun 19 20:34:06 2012 +0400
@@ -87,7 +87,7 @@
endif
SUBDIRS_desktop = audio $(RENDER_SUBDIR) image \
$(LWAWT_PRE_SUBDIR) $(DISPLAY_LIBS) $(DGA_SUBDIR) $(LWAWT_SUBDIR) \
- jawt font jpeg cmm $(DISPLAY_TOOLS) beans
+ jawt font jpeg cmm $(DISPLAY_TOOLS)
SUBDIRS_management = management
SUBDIRS_misc = $(ORG_SUBDIR) rmi $(JDBC_SUBDIR) tracing
SUBDIRS_tools = native2ascii serialver tools jconsole
--- a/jdk/make/sun/beans/Makefile Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-#
-# Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# Makefile for building sun.beans.*
-#
-
-BUILDDIR = ../..
-PACKAGE = sun.beans
-PRODUCT = sun
-include $(BUILDDIR)/common/Defs.gmk
-
-#
-# Files
-#
-AUTO_FILES_JAVA_DIRS = sun/beans
-
-#
-# Rules
-#
-include $(BUILDDIR)/common/Classes.gmk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/BooleanEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "boolean" type.
+ */
+
+import java.beans.*;
+
+public class BooleanEditor extends PropertyEditorSupport {
+
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? value.toString()
+ : "null";
+ }
+
+ public String getAsText() {
+ Object value = getValue();
+ return (value instanceof Boolean)
+ ? getValidName((Boolean) value)
+ : null;
+ }
+
+ public void setAsText(String text) throws java.lang.IllegalArgumentException {
+ if (text == null) {
+ setValue(null);
+ } else if (isValidName(true, text)) {
+ setValue(Boolean.TRUE);
+ } else if (isValidName(false, text)) {
+ setValue(Boolean.FALSE);
+ } else {
+ throw new java.lang.IllegalArgumentException(text);
+ }
+ }
+
+ public String[] getTags() {
+ return new String[] {getValidName(true), getValidName(false)};
+ }
+
+ // the following method should be localized (4890258)
+
+ private String getValidName(boolean value) {
+ return value ? "True" : "False";
+ }
+
+ private boolean isValidName(boolean value, String name) {
+ return getValidName(value).equalsIgnoreCase(name);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/ByteEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "byte" type.
+ *
+ */
+
+import java.beans.*;
+
+public class ByteEditor extends NumberEditor {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? "((byte)" + value + ")"
+ : "null";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Byte.decode(text));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/ColorEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+import java.awt.*;
+import java.beans.*;
+
+public class ColorEditor extends Panel implements PropertyEditor {
+ private static final long serialVersionUID = 1781257185164716054L;
+
+ public ColorEditor() {
+ setLayout(null);
+
+ ourWidth = hPad;
+
+ // Create a sample color block bordered in black
+ Panel p = new Panel();
+ p.setLayout(null);
+ p.setBackground(Color.black);
+ sample = new Canvas();
+ p.add(sample);
+ sample.reshape(2, 2, sampleWidth, sampleHeight);
+ add(p);
+ p.reshape(ourWidth, 2, sampleWidth+4, sampleHeight+4);
+ ourWidth += sampleWidth + 4 + hPad;
+
+ text = new TextField("", 14);
+ add(text);
+ text.reshape(ourWidth,0,100,30);
+ ourWidth += 100 + hPad;
+
+ choser = new Choice();
+ int active = 0;
+ for (int i = 0; i < colorNames.length; i++) {
+ choser.addItem(colorNames[i]);
+ }
+ add(choser);
+ choser.reshape(ourWidth,0,100,30);
+ ourWidth += 100 + hPad;
+
+ resize(ourWidth,40);
+ }
+
+ public void setValue(Object o) {
+ Color c = (Color)o;
+ changeColor(c);
+ }
+
+ public Dimension preferredSize() {
+ return new Dimension(ourWidth, 40);
+ }
+
+ public boolean keyUp(Event e, int key) {
+ if (e.target == text) {
+ try {
+ setAsText(text.getText());
+ } catch (IllegalArgumentException ex) {
+ // Quietly ignore.
+ }
+ }
+ return (false);
+ }
+
+ public void setAsText(String s) throws java.lang.IllegalArgumentException {
+ if (s == null) {
+ changeColor(null);
+ return;
+ }
+ int c1 = s.indexOf(',');
+ int c2 = s.indexOf(',', c1+1);
+ if (c1 < 0 || c2 < 0) {
+ // Invalid string.
+ throw new IllegalArgumentException(s);
+ }
+ try {
+ int r = Integer.parseInt(s.substring(0,c1));
+ int g = Integer.parseInt(s.substring(c1+1, c2));
+ int b = Integer.parseInt(s.substring(c2+1));
+ Color c = new Color(r,g,b);
+ changeColor(c);
+ } catch (Exception ex) {
+ throw new IllegalArgumentException(s);
+ }
+
+ }
+
+ public boolean action(Event e, Object arg) {
+ if (e.target == choser) {
+ changeColor(colors[choser.getSelectedIndex()]);
+ }
+ return false;
+ }
+
+ public String getJavaInitializationString() {
+ return (this.color != null)
+ ? "new java.awt.Color(" + this.color.getRGB() + ",true)"
+ : "null";
+ }
+
+
+ private void changeColor(Color c) {
+
+ if (c == null) {
+ this.color = null;
+ this.text.setText("");
+ return;
+ }
+
+ color = c;
+
+ text.setText("" + c.getRed() + "," + c.getGreen() + "," + c.getBlue());
+
+ int active = 0;
+ for (int i = 0; i < colorNames.length; i++) {
+ if (color.equals(colors[i])) {
+ active = i;
+ }
+ }
+ choser.select(active);
+
+ sample.setBackground(color);
+ sample.repaint();
+
+ support.firePropertyChange("", null, null);
+ }
+
+ public Object getValue() {
+ return color;
+ }
+
+ public boolean isPaintable() {
+ return true;
+ }
+
+ public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
+ Color oldColor = gfx.getColor();
+ gfx.setColor(Color.black);
+ gfx.drawRect(box.x, box.y, box.width-3, box.height-3);
+ gfx.setColor(color);
+ gfx.fillRect(box.x+1, box.y+1, box.width-4, box.height-4);
+ gfx.setColor(oldColor);
+ }
+
+ public String getAsText() {
+ return (this.color != null)
+ ? this.color.getRed() + "," + this.color.getGreen() + "," + this.color.getBlue()
+ : null;
+ }
+
+ public String[] getTags() {
+ return null;
+ }
+
+ public java.awt.Component getCustomEditor() {
+ return this;
+ }
+
+ public boolean supportsCustomEditor() {
+ return true;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {
+ support.addPropertyChangeListener(l);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener l) {
+ support.removePropertyChangeListener(l);
+ }
+
+
+ private String colorNames[] = { " ", "white", "lightGray", "gray", "darkGray",
+ "black", "red", "pink", "orange",
+ "yellow", "green", "magenta", "cyan",
+ "blue"};
+ private Color colors[] = { null, Color.white, Color.lightGray, Color.gray, Color.darkGray,
+ Color.black, Color.red, Color.pink, Color.orange,
+ Color.yellow, Color.green, Color.magenta, Color.cyan,
+ Color.blue};
+
+ private Canvas sample;
+ private int sampleHeight = 20;
+ private int sampleWidth = 40;
+ private int hPad = 5;
+ private int ourWidth;
+
+ private Color color;
+ private TextField text;
+ private Choice choser;
+
+ private PropertyChangeSupport support = new PropertyChangeSupport(this);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/DoubleEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "double" type.
+ *
+ */
+
+import java.beans.*;
+
+public class DoubleEditor extends NumberEditor {
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Double.valueOf(text));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.beans.editors;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyEditor;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Property editor for java.lang.Enum subclasses.
+ *
+ * @see PropertyEditor
+ *
+ * @since 1.7
+ *
+ * @author Sergey A. Malenkov
+ */
+public final class EnumEditor implements PropertyEditor {
+ private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
+
+ private final Class type;
+ private final String[] tags;
+
+ private Object value;
+
+ public EnumEditor( Class type ) {
+ Object[] values = type.getEnumConstants();
+ if ( values == null ) {
+ throw new IllegalArgumentException( "Unsupported " + type );
+ }
+ this.type = type;
+ this.tags = new String[values.length];
+ for ( int i = 0; i < values.length; i++ ) {
+ this.tags[i] = ( ( Enum )values[i] ).name();
+ }
+ }
+
+ public Object getValue() {
+ return this.value;
+ }
+
+ public void setValue( Object value ) {
+ if ( ( value != null ) && !this.type.isInstance( value ) ) {
+ throw new IllegalArgumentException( "Unsupported value: " + value );
+ }
+ Object oldValue;
+ PropertyChangeListener[] listeners;
+ synchronized ( this.listeners ) {
+ oldValue = this.value;
+ this.value = value;
+
+ if ( ( value == null ) ? oldValue == null : value.equals( oldValue ) ) {
+ return; // do not fire event if value is not changed
+ }
+ int size = this.listeners.size();
+ if ( size == 0 ) {
+ return; // do not fire event if there are no any listener
+ }
+ listeners = this.listeners.toArray( new PropertyChangeListener[size] );
+ }
+ PropertyChangeEvent event = new PropertyChangeEvent( this, null, oldValue, value );
+ for ( PropertyChangeListener listener : listeners ) {
+ listener.propertyChange( event );
+ }
+ }
+
+ public String getAsText() {
+ return ( this.value != null )
+ ? ( ( Enum )this.value ).name()
+ : null;
+ }
+
+ public void setAsText( String text ) {
+ setValue( ( text != null )
+ ? Enum.valueOf( this.type, text )
+ : null );
+ }
+
+ public String[] getTags() {
+ return this.tags.clone();
+ }
+
+ public String getJavaInitializationString() {
+ String name = getAsText();
+ return ( name != null )
+ ? this.type.getName() + '.' + name
+ : "null";
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue( Graphics gfx, Rectangle box ) {
+ }
+
+ public boolean supportsCustomEditor() {
+ return false;
+ }
+
+ public Component getCustomEditor() {
+ return null;
+ }
+
+ public void addPropertyChangeListener( PropertyChangeListener listener ) {
+ synchronized ( this.listeners ) {
+ this.listeners.add( listener );
+ }
+ }
+
+ public void removePropertyChangeListener( PropertyChangeListener listener ) {
+ synchronized ( this.listeners ) {
+ this.listeners.remove( listener );
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/FloatEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "float" type.
+ *
+ */
+
+import java.beans.*;
+
+public class FloatEditor extends NumberEditor {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? value + "F"
+ : "null";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Float.valueOf(text));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/FontEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+import java.awt.*;
+import java.beans.*;
+
+public class FontEditor extends Panel implements java.beans.PropertyEditor {
+ private static final long serialVersionUID = 6732704486002715933L;
+
+ public FontEditor() {
+ setLayout(null);
+
+ toolkit = Toolkit.getDefaultToolkit();
+ fonts = toolkit.getFontList();
+
+ familyChoser = new Choice();
+ for (int i = 0; i < fonts.length; i++) {
+ familyChoser.addItem(fonts[i]);
+ }
+ add(familyChoser);
+ familyChoser.reshape(20, 5, 100, 30);
+
+ styleChoser = new Choice();
+ for (int i = 0; i < styleNames.length; i++) {
+ styleChoser.addItem(styleNames[i]);
+ }
+ add(styleChoser);
+ styleChoser.reshape(145, 5, 70, 30);
+
+ sizeChoser = new Choice();
+ for (int i = 0; i < pointSizes.length; i++) {
+ sizeChoser.addItem("" + pointSizes[i]);
+ }
+ add(sizeChoser);
+ sizeChoser.reshape(220, 5, 70, 30);
+
+ resize(300,40);
+ }
+
+
+ public Dimension preferredSize() {
+ return new Dimension(300, 40);
+ }
+
+ public void setValue(Object o) {
+ font = (Font) o;
+ if (this.font == null)
+ return;
+
+ changeFont(font);
+ // Update the current GUI choices.
+ for (int i = 0; i < fonts.length; i++) {
+ if (fonts[i].equals(font.getFamily())) {
+ familyChoser.select(i);
+ break;
+ }
+ }
+ for (int i = 0; i < styleNames.length; i++) {
+ if (font.getStyle() == styles[i]) {
+ styleChoser.select(i);
+ break;
+ }
+ }
+ for (int i = 0; i < pointSizes.length; i++) {
+ if (font.getSize() <= pointSizes[i]) {
+ sizeChoser.select(i);
+ break;
+ }
+ }
+ }
+
+ private void changeFont(Font f) {
+ font = f;
+ if (sample != null) {
+ remove(sample);
+ }
+ sample = new Label(sampleText);
+ sample.setFont(font);
+ add(sample);
+ Component p = getParent();
+ if (p != null) {
+ p.invalidate();
+ p.layout();
+ }
+ invalidate();
+ layout();
+ repaint();
+ support.firePropertyChange("", null, null);
+ }
+
+ public Object getValue() {
+ return (font);
+ }
+
+ public String getJavaInitializationString() {
+ if (this.font == null)
+ return "null";
+
+ return "new java.awt.Font(\"" + font.getName() + "\", " +
+ font.getStyle() + ", " + font.getSize() + ")";
+ }
+
+ public boolean action(Event e, Object arg) {
+ String family = familyChoser.getSelectedItem();
+ int style = styles[styleChoser.getSelectedIndex()];
+ int size = pointSizes[sizeChoser.getSelectedIndex()];
+ try {
+ Font f = new Font(family, style, size);
+ changeFont(f);
+ } catch (Exception ex) {
+ System.err.println("Couldn't create font " + family + "-" +
+ styleNames[style] + "-" + size);
+ }
+ return (false);
+ }
+
+
+ public boolean isPaintable() {
+ return true;
+ }
+
+ public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
+ // Silent noop.
+ Font oldFont = gfx.getFont();
+ gfx.setFont(font);
+ FontMetrics fm = gfx.getFontMetrics();
+ int vpad = (box.height - fm.getAscent())/2;
+ gfx.drawString(sampleText, 0, box.height-vpad);
+ gfx.setFont(oldFont);
+ }
+
+ public String getAsText() {
+ if (this.font == null) {
+ return null;
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append(this.font.getName());
+ sb.append(' ');
+
+ boolean b = this.font.isBold();
+ if (b) {
+ sb.append("BOLD");
+ }
+ boolean i = this.font.isItalic();
+ if (i) {
+ sb.append("ITALIC");
+ }
+ if (b || i) {
+ sb.append(' ');
+ }
+ sb.append(this.font.getSize());
+ return sb.toString();
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Font.decode(text));
+ }
+
+ public String[] getTags() {
+ return null;
+ }
+
+ public java.awt.Component getCustomEditor() {
+ return this;
+ }
+
+ public boolean supportsCustomEditor() {
+ return true;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {
+ support.addPropertyChangeListener(l);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener l) {
+ support.removePropertyChangeListener(l);
+ }
+
+ private Font font;
+ private Toolkit toolkit;
+ private String sampleText = "Abcde...";
+
+ private Label sample;
+ private Choice familyChoser;
+ private Choice styleChoser;
+ private Choice sizeChoser;
+
+ private String fonts[];
+ private String[] styleNames = { "plain", "bold", "italic" };
+ private int[] styles = { Font.PLAIN, Font.BOLD, Font.ITALIC };
+ private int[] pointSizes = { 3, 5, 8, 10, 12, 14, 18, 24, 36, 48 };
+
+ private PropertyChangeSupport support = new PropertyChangeSupport(this);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/IntegerEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "int" type.
+ *
+ */
+
+import java.beans.*;
+
+public class IntegerEditor extends NumberEditor {
+
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Integer.decode(text));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/LongEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "long" type.
+ *
+ */
+
+import java.beans.*;
+
+public class LongEditor extends NumberEditor {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? value + "L"
+ : "null";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Long.decode(text));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/NumberEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.editors;
+
+/**
+ * Abstract Property editor for a java builtin number types.
+ *
+ */
+
+import java.beans.*;
+
+abstract public class NumberEditor extends PropertyEditorSupport {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? value.toString()
+ : "null";
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/ShortEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.beans.editors;
+
+/**
+ * Property editor for a java builtin "short" type.
+ *
+ */
+
+import java.beans.*;
+
+public class ShortEditor extends NumberEditor {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ return (value != null)
+ ? "((short)" + value + ")"
+ : "null";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ setValue((text == null) ? null : Short.decode(text));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/editors/StringEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.beans.editors;
+
+import java.beans.*;
+
+public class StringEditor extends PropertyEditorSupport {
+
+ public String getJavaInitializationString() {
+ Object value = getValue();
+ if (value == null)
+ return "null";
+
+ String str = value.toString();
+ int length = str.length();
+ StringBuilder sb = new StringBuilder(length + 2);
+ sb.append('"');
+ for (int i = 0; i < length; i++) {
+ char ch = str.charAt(i);
+ switch (ch) {
+ case '\b': sb.append("\\b"); break;
+ case '\t': sb.append("\\t"); break;
+ case '\n': sb.append("\\n"); break;
+ case '\f': sb.append("\\f"); break;
+ case '\r': sb.append("\\r"); break;
+ case '\"': sb.append("\\\""); break;
+ case '\\': sb.append("\\\\"); break;
+ default:
+ if ((ch < ' ') || (ch > '~')) {
+ sb.append("\\u");
+ String hex = Integer.toHexString((int) ch);
+ for (int len = hex.length(); len < 4; len++) {
+ sb.append('0');
+ }
+ sb.append(hex);
+ } else {
+ sb.append(ch);
+ }
+ break;
+ }
+ }
+ sb.append('"');
+ return sb.toString();
+ }
+
+ public void setAsText(String text) {
+ setValue(text);
+ }
+
+}
--- a/jdk/src/share/classes/com/sun/beans/finder/BeanInfoFinder.java Fri Jun 15 21:01:55 2012 +0400
+++ b/jdk/src/share/classes/com/sun/beans/finder/BeanInfoFinder.java Tue Jun 19 20:34:06 2012 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,7 @@
extends InstanceFinder<BeanInfo> {
private static final String DEFAULT = "sun.beans.infos";
+ private static final String DEFAULT_NEW = "com.sun.beans.infos";
public BeanInfoFinder() {
super(BeanInfo.class, true, "BeanInfo", DEFAULT);
@@ -53,10 +54,13 @@
@Override
protected BeanInfo instantiate(Class<?> type, String prefix, String name) {
+ if (DEFAULT.equals(prefix)) {
+ prefix = DEFAULT_NEW;
+ }
// this optimization will only use the BeanInfo search path
// if is has changed from the original
// or trying to get the ComponentBeanInfo
- BeanInfo info = !DEFAULT.equals(prefix) || "ComponentBeanInfo".equals(name)
+ BeanInfo info = !DEFAULT_NEW.equals(prefix) || "ComponentBeanInfo".equals(name)
? super.instantiate(type, prefix, name)
: null;
--- a/jdk/src/share/classes/com/sun/beans/finder/ClassFinder.java Fri Jun 15 21:01:55 2012 +0400
+++ b/jdk/src/share/classes/com/sun/beans/finder/ClassFinder.java Tue Jun 19 20:34:06 2012 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
*/
package com.sun.beans.finder;
+import static sun.reflect.misc.ReflectUtil.checkPackageAccess;
+
/**
* This is utility class that provides {@code static} methods
* to find a class with the specified name using the specified class loader.
@@ -54,6 +56,7 @@
* @see Thread#getContextClassLoader()
*/
public static Class<?> findClass(String name) throws ClassNotFoundException {
+ checkPackageAccess(name);
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null) {
@@ -94,6 +97,7 @@
* @see Class#forName(String,boolean,ClassLoader)
*/
public static Class<?> findClass(String name, ClassLoader loader) throws ClassNotFoundException {
+ checkPackageAccess(name);
if (loader != null) {
try {
return Class.forName(name, false, loader);
--- a/jdk/src/share/classes/com/sun/beans/finder/PropertyEditorFinder.java Fri Jun 15 21:01:55 2012 +0400
+++ b/jdk/src/share/classes/com/sun/beans/finder/PropertyEditorFinder.java Tue Jun 19 20:34:06 2012 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,14 +28,14 @@
import java.beans.PropertyEditor;
-import sun.beans.editors.BooleanEditor;
-import sun.beans.editors.ByteEditor;
-import sun.beans.editors.DoubleEditor;
-import sun.beans.editors.EnumEditor;
-import sun.beans.editors.FloatEditor;
-import sun.beans.editors.IntegerEditor;
-import sun.beans.editors.LongEditor;
-import sun.beans.editors.ShortEditor;
+import com.sun.beans.editors.BooleanEditor;
+import com.sun.beans.editors.ByteEditor;
+import com.sun.beans.editors.DoubleEditor;
+import com.sun.beans.editors.EnumEditor;
+import com.sun.beans.editors.FloatEditor;
+import com.sun.beans.editors.IntegerEditor;
+import com.sun.beans.editors.LongEditor;
+import com.sun.beans.editors.ShortEditor;
/**
* This is utility class that provides functionality
@@ -48,10 +48,13 @@
public final class PropertyEditorFinder
extends InstanceFinder<PropertyEditor> {
+ private static final String DEFAULT = "sun.beans.editors";
+ private static final String DEFAULT_NEW = "com.sun.beans.editors";
+
private final WeakCache<Class<?>, Class<?>> registry;
public PropertyEditorFinder() {
- super(PropertyEditor.class, false, "Editor", "sun.beans.editors");
+ super(PropertyEditor.class, false, "Editor", DEFAULT);
this.registry = new WeakCache<Class<?>, Class<?>>();
this.registry.put(Byte.TYPE, ByteEditor.class);
@@ -84,4 +87,9 @@
}
return editor;
}
+
+ @Override
+ protected PropertyEditor instantiate(Class<?> type, String prefix, String name) {
+ return super.instantiate(type, DEFAULT.equals(prefix) ? DEFAULT_NEW : prefix, name);
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/beans/infos/ComponentBeanInfo.java Tue Jun 19 20:34:06 2012 +0400
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.beans.infos;
+
+import java.beans.*;
+
+/**
+ * BeanInfo descriptor for a standard AWT component.
+ */
+
+public class ComponentBeanInfo extends SimpleBeanInfo {
+ private static final Class<java.awt.Component> beanClass = java.awt.Component.class;
+
+ public PropertyDescriptor[] getPropertyDescriptors() {
+ try {
+ PropertyDescriptor
+ name = new PropertyDescriptor("name", beanClass),
+ background = new PropertyDescriptor("background", beanClass),
+ foreground = new PropertyDescriptor("foreground", beanClass),
+ font = new PropertyDescriptor("font", beanClass),
+ enabled = new PropertyDescriptor("enabled", beanClass),
+ visible = new PropertyDescriptor("visible", beanClass),
+ focusable = new PropertyDescriptor("focusable", beanClass);
+
+ enabled.setExpert(true);
+ visible.setHidden(true);
+
+ background.setBound(true);
+ foreground.setBound(true);
+ font.setBound(true);
+ focusable.setBound(true);
+
+ PropertyDescriptor[] rv = {name, background, foreground, font, enabled, visible, focusable };
+ return rv;
+ } catch (IntrospectionException e) {
+ throw new Error(e.toString());
+ }
+ }
+}
--- a/jdk/src/share/classes/sun/beans/editors/BooleanEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.beans.editors;
-
-/**
- * Property editor for a java builtin "boolean" type.
- */
-
-import java.beans.*;
-
-public class BooleanEditor extends PropertyEditorSupport {
-
-
- public String getJavaInitializationString() {
- Object value = getValue();
- return (value != null)
- ? value.toString()
- : "null";
- }
-
- public String getAsText() {
- Object value = getValue();
- return (value instanceof Boolean)
- ? getValidName((Boolean) value)
- : null;
- }
-
- public void setAsText(String text) throws java.lang.IllegalArgumentException {
- if (text == null) {
- setValue(null);
- } else if (isValidName(true, text)) {
- setValue(Boolean.TRUE);
- } else if (isValidName(false, text)) {
- setValue(Boolean.FALSE);
- } else {
- throw new java.lang.IllegalArgumentException(text);
- }
- }
-
- public String[] getTags() {
- return new String[] {getValidName(true), getValidName(false)};
- }
-
- // the following method should be localized (4890258)
-
- private String getValidName(boolean value) {
- return value ? "True" : "False";
- }
-
- private boolean isValidName(boolean value, String name) {
- return getValidName(value).equalsIgnoreCase(name);
- }
-}
--- a/jdk/src/share/classes/sun/beans/editors/ByteEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.beans.editors;
-
-/**
- * Property editor for a java builtin "byte" type.
- *
- */
-
-import java.beans.*;
-
-public class ByteEditor extends NumberEditor {
-
- public String getJavaInitializationString() {
- Object value = getValue();
- return (value != null)
- ? "((byte)" + value + ")"
- : "null";
- }
-
- public void setAsText(String text) throws IllegalArgumentException {
- setValue((text == null) ? null : Byte.decode(text));
- }
-
-}
--- a/jdk/src/share/classes/sun/beans/editors/ColorEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.beans.editors;
-
-import java.awt.*;
-import java.beans.*;
-
-public class ColorEditor extends Panel implements PropertyEditor {
- private static final long serialVersionUID = 1781257185164716054L;
-
- public ColorEditor() {
- setLayout(null);
-
- ourWidth = hPad;
-
- // Create a sample color block bordered in black
- Panel p = new Panel();
- p.setLayout(null);
- p.setBackground(Color.black);
- sample = new Canvas();
- p.add(sample);
- sample.reshape(2, 2, sampleWidth, sampleHeight);
- add(p);
- p.reshape(ourWidth, 2, sampleWidth+4, sampleHeight+4);
- ourWidth += sampleWidth + 4 + hPad;
-
- text = new TextField("", 14);
- add(text);
- text.reshape(ourWidth,0,100,30);
- ourWidth += 100 + hPad;
-
- choser = new Choice();
- int active = 0;
- for (int i = 0; i < colorNames.length; i++) {
- choser.addItem(colorNames[i]);
- }
- add(choser);
- choser.reshape(ourWidth,0,100,30);
- ourWidth += 100 + hPad;
-
- resize(ourWidth,40);
- }
-
- public void setValue(Object o) {
- Color c = (Color)o;
- changeColor(c);
- }
-
- public Dimension preferredSize() {
- return new Dimension(ourWidth, 40);
- }
-
- public boolean keyUp(Event e, int key) {
- if (e.target == text) {
- try {
- setAsText(text.getText());
- } catch (IllegalArgumentException ex) {
- // Quietly ignore.
- }
- }
- return (false);
- }
-
- public void setAsText(String s) throws java.lang.IllegalArgumentException {
- if (s == null) {
- changeColor(null);
- return;
- }
- int c1 = s.indexOf(',');
- int c2 = s.indexOf(',', c1+1);
- if (c1 < 0 || c2 < 0) {
- // Invalid string.
- throw new IllegalArgumentException(s);
- }
- try {
- int r = Integer.parseInt(s.substring(0,c1));
- int g = Integer.parseInt(s.substring(c1+1, c2));
- int b = Integer.parseInt(s.substring(c2+1));
- Color c = new Color(r,g,b);
- changeColor(c);
- } catch (Exception ex) {
- throw new IllegalArgumentException(s);
- }
-
- }
-
- public boolean action(Event e, Object arg) {
- if (e.target == choser) {
- changeColor(colors[choser.getSelectedIndex()]);
- }
- return false;
- }
-
- public String getJavaInitializationString() {
- return (this.color != null)
- ? "new java.awt.Color(" + this.color.getRGB() + ",true)"
- : "null";
- }
-
-
- private void changeColor(Color c) {
-
- if (c == null) {
- this.color = null;
- this.text.setText("");
- return;
- }
-
- color = c;
-
- text.setText("" + c.getRed() + "," + c.getGreen() + "," + c.getBlue());
-
- int active = 0;
- for (int i = 0; i < colorNames.length; i++) {
- if (color.equals(colors[i])) {
- active = i;
- }
- }
- choser.select(active);
-
- sample.setBackground(color);
- sample.repaint();
-
- support.firePropertyChange("", null, null);
- }
-
- public Object getValue() {
- return color;
- }
-
- public boolean isPaintable() {
- return true;
- }
-
- public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
- Color oldColor = gfx.getColor();
- gfx.setColor(Color.black);
- gfx.drawRect(box.x, box.y, box.width-3, box.height-3);
- gfx.setColor(color);
- gfx.fillRect(box.x+1, box.y+1, box.width-4, box.height-4);
- gfx.setColor(oldColor);
- }
-
- public String getAsText() {
- return (this.color != null)
- ? this.color.getRed() + "," + this.color.getGreen() + "," + this.color.getBlue()
- : null;
- }
-
- public String[] getTags() {
- return null;
- }
-
- public java.awt.Component getCustomEditor() {
- return this;
- }
-
- public boolean supportsCustomEditor() {
- return true;
- }
-
- public void addPropertyChangeListener(PropertyChangeListener l) {
- support.addPropertyChangeListener(l);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener l) {
- support.removePropertyChangeListener(l);
- }
-
-
- private String colorNames[] = { " ", "white", "lightGray", "gray", "darkGray",
- "black", "red", "pink", "orange",
- "yellow", "green", "magenta", "cyan",
- "blue"};
- private Color colors[] = { null, Color.white, Color.lightGray, Color.gray, Color.darkGray,
- Color.black, Color.red, Color.pink, Color.orange,
- Color.yellow, Color.green, Color.magenta, Color.cyan,
- Color.blue};
-
- private Canvas sample;
- private int sampleHeight = 20;
- private int sampleWidth = 40;
- private int hPad = 5;
- private int ourWidth;
-
- private Color color;
- private TextField text;
- private Choice choser;
-
- private PropertyChangeSupport support = new PropertyChangeSupport(this);
-}
--- a/jdk/src/share/classes/sun/beans/editors/DoubleEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.beans.editors;
-
-/**
- * Property editor for a java builtin "double" type.
- *
- */
-
-import java.beans.*;
-
-public class DoubleEditor extends NumberEditor {
-
- public void setAsText(String text) throws IllegalArgumentException {
- setValue((text == null) ? null : Double.valueOf(text));
- }
-
-}
--- a/jdk/src/share/classes/sun/beans/editors/EnumEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.beans.editors;
-
-import java.awt.Component;
-import java.awt.Graphics;
-import java.awt.Rectangle;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyEditor;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Property editor for java.lang.Enum subclasses.
- *
- * @see PropertyEditor
- *
- * @since 1.7
- *
- * @author Sergey A. Malenkov
- */
-public final class EnumEditor implements PropertyEditor {
- private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
-
- private final Class type;
- private final String[] tags;
-
- private Object value;
-
- public EnumEditor( Class type ) {
- Object[] values = type.getEnumConstants();
- if ( values == null ) {
- throw new IllegalArgumentException( "Unsupported " + type );
- }
- this.type = type;
- this.tags = new String[values.length];
- for ( int i = 0; i < values.length; i++ ) {
- this.tags[i] = ( ( Enum )values[i] ).name();
- }
- }
-
- public Object getValue() {
- return this.value;
- }
-
- public void setValue( Object value ) {
- if ( ( value != null ) && !this.type.isInstance( value ) ) {
- throw new IllegalArgumentException( "Unsupported value: " + value );
- }
- Object oldValue;
- PropertyChangeListener[] listeners;
- synchronized ( this.listeners ) {
- oldValue = this.value;
- this.value = value;
-
- if ( ( value == null ) ? oldValue == null : value.equals( oldValue ) ) {
- return; // do not fire event if value is not changed
- }
- int size = this.listeners.size();
- if ( size == 0 ) {
- return; // do not fire event if there are no any listener
- }
- listeners = this.listeners.toArray( new PropertyChangeListener[size] );
- }
- PropertyChangeEvent event = new PropertyChangeEvent( this, null, oldValue, value );
- for ( PropertyChangeListener listener : listeners ) {
- listener.propertyChange( event );
- }
- }
-
- public String getAsText() {
- return ( this.value != null )
- ? ( ( Enum )this.value ).name()
- : null;
- }
-
- public void setAsText( String text ) {
- setValue( ( text != null )
- ? Enum.valueOf( this.type, text )
- : null );
- }
-
- public String[] getTags() {
- return this.tags.clone();
- }
-
- public String getJavaInitializationString() {
- String name = getAsText();
- return ( name != null )
- ? this.type.getName() + '.' + name
- : "null";
- }
-
- public boolean isPaintable() {
- return false;
- }
-
- public void paintValue( Graphics gfx, Rectangle box ) {
- }
-
- public boolean supportsCustomEditor() {
- return false;
- }
-
- public Component getCustomEditor() {
- return null;
- }
-
- public void addPropertyChangeListener( PropertyChangeListener listener ) {
- synchronized ( this.listeners ) {
- this.listeners.add( listener );
- }
- }
-
- public void removePropertyChangeListener( PropertyChangeListener listener ) {
- synchronized ( this.listeners ) {
- this.listeners.remove( listener );
- }
- }
-}
--- a/jdk/src/share/classes/sun/beans/editors/FloatEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.beans.editors;
-
-/**
- * Property editor for a java builtin "float" type.
- *
- */
-
-import java.beans.*;
-
-public class FloatEditor extends NumberEditor {
-
- public String getJavaInitializationString() {
- Object value = getValue();
- return (value != null)
- ? value + "F"
- : "null";
- }
-
- public void setAsText(String text) throws IllegalArgumentException {
- setValue((text == null) ? null : Float.valueOf(text));
- }
-
-}
--- a/jdk/src/share/classes/sun/beans/editors/FontEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.beans.editors;
-
-import java.awt.*;
-import java.beans.*;
-
-public class FontEditor extends Panel implements java.beans.PropertyEditor {
- private static final long serialVersionUID = 6732704486002715933L;
-
- public FontEditor() {
- setLayout(null);
-
- toolkit = Toolkit.getDefaultToolkit();
- fonts = toolkit.getFontList();
-
- familyChoser = new Choice();
- for (int i = 0; i < fonts.length; i++) {
- familyChoser.addItem(fonts[i]);
- }
- add(familyChoser);
- familyChoser.reshape(20, 5, 100, 30);
-
- styleChoser = new Choice();
- for (int i = 0; i < styleNames.length; i++) {
- styleChoser.addItem(styleNames[i]);
- }
- add(styleChoser);
- styleChoser.reshape(145, 5, 70, 30);
-
- sizeChoser = new Choice();
- for (int i = 0; i < pointSizes.length; i++) {
- sizeChoser.addItem("" + pointSizes[i]);
- }
- add(sizeChoser);
- sizeChoser.reshape(220, 5, 70, 30);
-
- resize(300,40);
- }
-
-
- public Dimension preferredSize() {
- return new Dimension(300, 40);
- }
-
- public void setValue(Object o) {
- font = (Font) o;
- if (this.font == null)
- return;
-
- changeFont(font);
- // Update the current GUI choices.
- for (int i = 0; i < fonts.length; i++) {
- if (fonts[i].equals(font.getFamily())) {
- familyChoser.select(i);
- break;
- }
- }
- for (int i = 0; i < styleNames.length; i++) {
- if (font.getStyle() == styles[i]) {
- styleChoser.select(i);
- break;
- }
- }
- for (int i = 0; i < pointSizes.length; i++) {
- if (font.getSize() <= pointSizes[i]) {
- sizeChoser.select(i);
- break;
- }
- }
- }
-
- private void changeFont(Font f) {
- font = f;
- if (sample != null) {
- remove(sample);
- }
- sample = new Label(sampleText);
- sample.setFont(font);
- add(sample);
- Component p = getParent();
- if (p != null) {
- p.invalidate();
- p.layout();
- }
- invalidate();
- layout();
- repaint();
- support.firePropertyChange("", null, null);
- }
-
- public Object getValue() {
- return (font);
- }
-
- public String getJavaInitializationString() {
- if (this.font == null)
- return "null";
-
- return "new java.awt.Font(\"" + font.getName() + "\", " +
- font.getStyle() + ", " + font.getSize() + ")";
- }
-
- public boolean action(Event e, Object arg) {
- String family = familyChoser.getSelectedItem();
- int style = styles[styleChoser.getSelectedIndex()];
- int size = pointSizes[sizeChoser.getSelectedIndex()];
- try {
- Font f = new Font(family, style, size);
- changeFont(f);
- } catch (Exception ex) {
- System.err.println("Couldn't create font " + family + "-" +
- styleNames[style] + "-" + size);
- }
- return (false);
- }
-
-
- public boolean isPaintable() {
- return true;
- }
-
- public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
- // Silent noop.
- Font oldFont = gfx.getFont();
- gfx.setFont(font);
- FontMetrics fm = gfx.getFontMetrics();
- int vpad = (box.height - fm.getAscent())/2;
- gfx.drawString(sampleText, 0, box.height-vpad);
- gfx.setFont(oldFont);
- }
-
- public String getAsText() {
- if (this.font == null) {
- return null;
- }
- StringBuilder sb = new StringBuilder();
- sb.append(this.font.getName());
- sb.append(' ');
-
- boolean b = this.font.isBold();
- if (b) {
- sb.append("BOLD");
- }
- boolean i = this.font.isItalic();
- if (i) {
- sb.append("ITALIC");
- }
- if (b || i) {
- sb.append(' ');
- }
- sb.append(this.font.getSize());
- return sb.toString();
- }
-
- public void setAsText(String text) throws IllegalArgumentException {
- setValue((text == null) ? null : Font.decode(text));
- }
-
- public String[] getTags() {
- return null;
- }
-
- public java.awt.Component getCustomEditor() {
- return this;
- }
-
- public boolean supportsCustomEditor() {
- return true;
- }
-
- public void addPropertyChangeListener(PropertyChangeListener l) {
- support.addPropertyChangeListener(l);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener l) {
- support.removePropertyChangeListener(l);
- }
-
- private Font font;
- private Toolkit toolkit;
- private String sampleText = "Abcde...";
-
- private Label sample;
- private Choice familyChoser;
- private Choice styleChoser;
- private Choice sizeChoser;
-
- private String fonts[];
- private String[] styleNames = { "plain", "bold", "italic" };
- private int[] styles = { Font.PLAIN, Font.BOLD, Font.ITALIC };
- private int[] pointSizes = { 3, 5, 8, 10, 12, 14, 18, 24, 36, 48 };
-
- private PropertyChangeSupport support = new PropertyChangeSupport(this);
-
-}
--- a/jdk/src/share/classes/sun/beans/editors/IntegerEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.beans.editors;
-
-/**
- * Property editor for a java builtin "int" type.
- *
- */
-
-import java.beans.*;
-
-public class IntegerEditor extends NumberEditor {
-
-
- public void setAsText(String text) throws IllegalArgumentException {
- setValue((text == null) ? null : Integer.decode(text));
- }
-
-}
--- a/jdk/src/share/classes/sun/beans/editors/LongEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.beans.editors;
-
-/**
- * Property editor for a java builtin "long" type.
- *
- */
-
-import java.beans.*;
-
-public class LongEditor extends NumberEditor {
-
- public String getJavaInitializationString() {
- Object value = getValue();
- return (value != null)
- ? value + "L"
- : "null";
- }
-
- public void setAsText(String text) throws IllegalArgumentException {
- setValue((text == null) ? null : Long.decode(text));
- }
-
-}
--- a/jdk/src/share/classes/sun/beans/editors/NumberEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.beans.editors;
-
-/**
- * Abstract Property editor for a java builtin number types.
- *
- */
-
-import java.beans.*;
-
-abstract public class NumberEditor extends PropertyEditorSupport {
-
- public String getJavaInitializationString() {
- Object value = getValue();
- return (value != null)
- ? value.toString()
- : "null";
- }
-
-}
--- a/jdk/src/share/classes/sun/beans/editors/ShortEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.beans.editors;
-
-/**
- * Property editor for a java builtin "short" type.
- *
- */
-
-import java.beans.*;
-
-public class ShortEditor extends NumberEditor {
-
- public String getJavaInitializationString() {
- Object value = getValue();
- return (value != null)
- ? "((short)" + value + ")"
- : "null";
- }
-
- public void setAsText(String text) throws IllegalArgumentException {
- setValue((text == null) ? null : Short.decode(text));
- }
-
-}
--- a/jdk/src/share/classes/sun/beans/editors/StringEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package sun.beans.editors;
-
-import java.beans.*;
-
-public class StringEditor extends PropertyEditorSupport {
-
- public String getJavaInitializationString() {
- Object value = getValue();
- if (value == null)
- return "null";
-
- String str = value.toString();
- int length = str.length();
- StringBuilder sb = new StringBuilder(length + 2);
- sb.append('"');
- for (int i = 0; i < length; i++) {
- char ch = str.charAt(i);
- switch (ch) {
- case '\b': sb.append("\\b"); break;
- case '\t': sb.append("\\t"); break;
- case '\n': sb.append("\\n"); break;
- case '\f': sb.append("\\f"); break;
- case '\r': sb.append("\\r"); break;
- case '\"': sb.append("\\\""); break;
- case '\\': sb.append("\\\\"); break;
- default:
- if ((ch < ' ') || (ch > '~')) {
- sb.append("\\u");
- String hex = Integer.toHexString((int) ch);
- for (int len = hex.length(); len < 4; len++) {
- sb.append('0');
- }
- sb.append(hex);
- } else {
- sb.append(ch);
- }
- break;
- }
- }
- sb.append('"');
- return sb.toString();
- }
-
- public void setAsText(String text) {
- setValue(text);
- }
-
-}
--- a/jdk/src/share/classes/sun/beans/infos/ComponentBeanInfo.java Fri Jun 15 21:01:55 2012 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.beans.infos;
-
-import java.beans.*;
-
-/**
- * BeanInfo descriptor for a standard AWT component.
- */
-
-public class ComponentBeanInfo extends SimpleBeanInfo {
- private static final Class<java.awt.Component> beanClass = java.awt.Component.class;
-
- public PropertyDescriptor[] getPropertyDescriptors() {
- try {
- PropertyDescriptor
- name = new PropertyDescriptor("name", beanClass),
- background = new PropertyDescriptor("background", beanClass),
- foreground = new PropertyDescriptor("foreground", beanClass),
- font = new PropertyDescriptor("font", beanClass),
- enabled = new PropertyDescriptor("enabled", beanClass),
- visible = new PropertyDescriptor("visible", beanClass),
- focusable = new PropertyDescriptor("focusable", beanClass);
-
- enabled.setExpert(true);
- visible.setHidden(true);
-
- background.setBound(true);
- foreground.setBound(true);
- font.setBound(true);
- focusable.setBound(true);
-
- PropertyDescriptor[] rv = {name, background, foreground, font, enabled, visible, focusable };
- return rv;
- } catch (IntrospectionException e) {
- throw new Error(e.toString());
- }
- }
-}
--- a/jdk/test/java/beans/Introspector/4520754/Test4520754.java Fri Jun 15 21:01:55 2012 +0400
+++ b/jdk/test/java/beans/Introspector/4520754/Test4520754.java Tue Jun 19 20:34:06 2012 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@
public static void main(String[] args) {
// ensure that 4168475 does not regress
test4168475(Component.class);
- // AWT classes (sun.beans.infos.ComponentBeanInfo)
+ // AWT classes (com.sun.beans.infos.ComponentBeanInfo)
test(null, Button.class, Component.class, List.class, Menu.class, Panel.class);
// Swing classes (dt.jar)
test(null, JApplet.class, JButton.class, JCheckBox.class);
--- a/jdk/test/java/beans/PropertyEditor/6380849/TestPropertyEditor.java Fri Jun 15 21:01:55 2012 +0400
+++ b/jdk/test/java/beans/PropertyEditor/6380849/TestPropertyEditor.java Tue Jun 19 20:34:06 2012 +0400
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,17 +36,17 @@
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
-import sun.beans.editors.BooleanEditor;
-import sun.beans.editors.ByteEditor;
-import sun.beans.editors.ColorEditor;
-import sun.beans.editors.DoubleEditor;
-import sun.beans.editors.EnumEditor;
-import sun.beans.editors.FloatEditor;
-import sun.beans.editors.FontEditor;
-import sun.beans.editors.IntegerEditor;
-import sun.beans.editors.LongEditor;
-import sun.beans.editors.ShortEditor;
-import sun.beans.editors.StringEditor;
+import com.sun.beans.editors.BooleanEditor;
+import com.sun.beans.editors.ByteEditor;
+import com.sun.beans.editors.ColorEditor;
+import com.sun.beans.editors.DoubleEditor;
+import com.sun.beans.editors.EnumEditor;
+import com.sun.beans.editors.FloatEditor;
+import com.sun.beans.editors.FontEditor;
+import com.sun.beans.editors.IntegerEditor;
+import com.sun.beans.editors.LongEditor;
+import com.sun.beans.editors.ShortEditor;
+import com.sun.beans.editors.StringEditor;
public class TestPropertyEditor implements Runnable {
--- a/jdk/test/java/beans/PropertyEditor/Test6963811.java Fri Jun 15 21:01:55 2012 +0400
+++ b/jdk/test/java/beans/PropertyEditor/Test6963811.java Tue Jun 19 20:34:06 2012 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
*/
import java.beans.PropertyEditorManager;
-import sun.beans.editors.StringEditor;
+import com.sun.beans.editors.StringEditor;
public class Test6963811 implements Runnable {
private final long time;