aboutsummaryrefslogtreecommitdiff
path: root/src/share
diff options
context:
space:
mode:
authormalenkov <none@none>2008-05-07 23:20:32 +0400
committermalenkov <none@none>2008-05-07 23:20:32 +0400
commitca4abd6b513caef68d13a0a17abb5c15d402353c (patch)
treebcff2738e8d3dce8c44f5528bbdf0ed6ee51fcb7 /src/share
parente18c7a4718a117dffb4b709154e90f11224eb994 (diff)
4935607: RFE: LTP: Should be possible to set the TRANSIENT attribute of propertiies to FALSE
Summary: Add the Transient annotation and support it (JSR-273) Reviewed-by: peterz, loneid
Diffstat (limited to 'src/share')
-rw-r--r--src/share/classes/java/awt/Component.java7
-rw-r--r--src/share/classes/java/awt/Dimension.java4
-rw-r--r--src/share/classes/java/awt/Point.java4
-rw-r--r--src/share/classes/java/awt/Rectangle.java4
-rw-r--r--src/share/classes/java/awt/ScrollPane.java4
-rw-r--r--src/share/classes/java/awt/geom/RectangularShape.java4
-rw-r--r--src/share/classes/java/awt/im/InputContext.java4
-rw-r--r--src/share/classes/java/beans/DefaultPersistenceDelegate.java89
-rw-r--r--src/share/classes/java/beans/EventSetDescriptor.java5
-rw-r--r--src/share/classes/java/beans/FeatureDescriptor.java115
-rw-r--r--src/share/classes/java/beans/IndexedPropertyDescriptor.java4
-rw-r--r--src/share/classes/java/beans/MetaData.java155
-rw-r--r--src/share/classes/java/beans/PropertyDescriptor.java5
-rw-r--r--src/share/classes/java/beans/Transient.java68
-rw-r--r--src/share/classes/javax/swing/AbstractButton.java7
-rw-r--r--src/share/classes/javax/swing/DefaultListSelectionModel.java5
-rw-r--r--src/share/classes/javax/swing/ImageIcon.java5
-rw-r--r--src/share/classes/javax/swing/JComboBox.java7
-rw-r--r--src/share/classes/javax/swing/JComponent.java10
-rw-r--r--src/share/classes/javax/swing/JLabel.java4
-rw-r--r--src/share/classes/javax/swing/JList.java8
-rw-r--r--src/share/classes/javax/swing/JMenuBar.java4
-rw-r--r--src/share/classes/javax/swing/JScrollPane.java11
-rw-r--r--src/share/classes/javax/swing/JTabbedPane.java6
-rw-r--r--src/share/classes/javax/swing/JViewport.java4
-rw-r--r--src/share/classes/javax/swing/table/JTableHeader.java4
-rw-r--r--src/share/classes/javax/swing/text/JTextComponent.java7
27 files changed, 263 insertions, 291 deletions
diff --git a/src/share/classes/java/awt/Component.java b/src/share/classes/java/awt/Component.java
index b48b8c552..6ab84df57 100644
--- a/src/share/classes/java/awt/Component.java
+++ b/src/share/classes/java/awt/Component.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1995-2008 Sun Microsystems, Inc. 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
@@ -49,6 +49,7 @@ import java.io.ObjectInputStream;
import java.io.IOException;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import java.beans.Transient;
import java.awt.event.InputMethodListener;
import java.awt.event.InputMethodEvent;
import java.awt.im.InputContext;
@@ -1100,6 +1101,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #setVisible
* @since JDK1.0
*/
+ @Transient
public boolean isVisible() {
return isVisible_NoClientCode();
}
@@ -1531,6 +1533,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @beaninfo
* bound: true
*/
+ @Transient
public Color getForeground() {
Color foreground = this.foreground;
if (foreground != null) {
@@ -1585,6 +1588,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #setBackground
* @since JDK1.0
*/
+ @Transient
public Color getBackground() {
Color background = this.background;
if (background != null) {
@@ -1644,6 +1648,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #setFont
* @since JDK1.0
*/
+ @Transient
public Font getFont() {
return getFont_NoClientCode();
}
diff --git a/src/share/classes/java/awt/Dimension.java b/src/share/classes/java/awt/Dimension.java
index b2bad3613..c0e2c7552 100644
--- a/src/share/classes/java/awt/Dimension.java
+++ b/src/share/classes/java/awt/Dimension.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1995-2008 Sun Microsystems, Inc. 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
@@ -26,6 +26,7 @@
package java.awt;
import java.awt.geom.Dimension2D;
+import java.beans.Transient;
/**
* The <code>Dimension</code> class encapsulates the width and
@@ -165,6 +166,7 @@ public class Dimension extends Dimension2D implements java.io.Serializable {
* @see java.awt.Component#getSize
* @since 1.1
*/
+ @Transient
public Dimension getSize() {
return new Dimension(width, height);
}
diff --git a/src/share/classes/java/awt/Point.java b/src/share/classes/java/awt/Point.java
index 73c4aa3e7..9bbe03469 100644
--- a/src/share/classes/java/awt/Point.java
+++ b/src/share/classes/java/awt/Point.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1995-2008 Sun Microsystems, Inc. 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
@@ -26,6 +26,7 @@
package java.awt;
import java.awt.geom.Point2D;
+import java.beans.Transient;
/**
* A point representing a location in {@code (x,y)} coordinate space,
@@ -119,6 +120,7 @@ public class Point extends Point2D implements java.io.Serializable {
* @see java.awt.Point#setLocation(int, int)
* @since 1.1
*/
+ @Transient
public Point getLocation() {
return new Point(x, y);
}
diff --git a/src/share/classes/java/awt/Rectangle.java b/src/share/classes/java/awt/Rectangle.java
index 1457b4d07..bf51092ef 100644
--- a/src/share/classes/java/awt/Rectangle.java
+++ b/src/share/classes/java/awt/Rectangle.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1995-2008 Sun Microsystems, Inc. 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
@@ -26,6 +26,7 @@
package java.awt;
import java.awt.geom.Rectangle2D;
+import java.beans.Transient;
/**
* A <code>Rectangle</code> specifies an area in a coordinate space that is
@@ -308,6 +309,7 @@ public class Rectangle extends Rectangle2D
* @see #setBounds(int, int, int, int)
* @since 1.1
*/
+ @Transient
public Rectangle getBounds() {
return new Rectangle(x, y, width, height);
}
diff --git a/src/share/classes/java/awt/ScrollPane.java b/src/share/classes/java/awt/ScrollPane.java
index f4303c0ae..b34c97847 100644
--- a/src/share/classes/java/awt/ScrollPane.java
+++ b/src/share/classes/java/awt/ScrollPane.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. 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
@@ -32,6 +32,7 @@ import sun.awt.ScrollPaneWheelScroller;
import sun.awt.SunToolkit;
import java.beans.ConstructorProperties;
+import java.beans.Transient;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.IOException;
@@ -390,6 +391,7 @@ public class ScrollPane extends Container implements Accessible {
* @throws NullPointerException if the scrollpane does not contain
* a child
*/
+ @Transient
public Point getScrollPosition() {
if (ncomponents <= 0) {
throw new NullPointerException("child is null");
diff --git a/src/share/classes/java/awt/geom/RectangularShape.java b/src/share/classes/java/awt/geom/RectangularShape.java
index 9e733e90c..32cbbe678 100644
--- a/src/share/classes/java/awt/geom/RectangularShape.java
+++ b/src/share/classes/java/awt/geom/RectangularShape.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
@@ -27,6 +27,7 @@ package java.awt.geom;
import java.awt.Shape;
import java.awt.Rectangle;
+import java.beans.Transient;
/**
* <code>RectangularShape</code> is the base class for a number of
@@ -171,6 +172,7 @@ public abstract class RectangularShape implements Shape, Cloneable {
* @see #setFrame(Rectangle2D)
* @since 1.2
*/
+ @Transient
public Rectangle2D getFrame() {
return new Rectangle2D.Double(getX(), getY(), getWidth(), getHeight());
}
diff --git a/src/share/classes/java/awt/im/InputContext.java b/src/share/classes/java/awt/im/InputContext.java
index 9e5d7fa36..0da7fcb42 100644
--- a/src/share/classes/java/awt/im/InputContext.java
+++ b/src/share/classes/java/awt/im/InputContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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,6 +28,7 @@ package java.awt.im;
import java.awt.Component;
import java.util.Locale;
import java.awt.AWTEvent;
+import java.beans.Transient;
import java.lang.Character.Subset;
import sun.awt.im.InputMethodContext;
@@ -231,6 +232,7 @@ public class InputContext {
* @see #setCompositionEnabled
* @since 1.3
*/
+ @Transient
public boolean isCompositionEnabled() {
// real implementation is in sun.awt.im.InputContext
return false;
diff --git a/src/share/classes/java/beans/DefaultPersistenceDelegate.java b/src/share/classes/java/beans/DefaultPersistenceDelegate.java
index 9970d53db..6553a5172 100644
--- a/src/share/classes/java/beans/DefaultPersistenceDelegate.java
+++ b/src/share/classes/java/beans/DefaultPersistenceDelegate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc. 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
@@ -164,53 +164,19 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
return new Expression(oldInstance, oldInstance.getClass(), "new", constructorArgs);
}
- private Method findMethod(Class type, String property) throws IntrospectionException {
+ private Method findMethod(Class type, String property) {
if (property == null) {
throw new IllegalArgumentException("Property name is null");
}
- BeanInfo info = Introspector.getBeanInfo(type);
- for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
- if (property.equals(pd.getName())) {
- Method method = pd.getReadMethod();
- if (method != null) {
- return method;
- }
- throw new IllegalStateException("Could not find getter for the property " + property);
- }
- }
- throw new IllegalStateException("Could not find property by the name " + property);
- }
-
- // This is a workaround for a bug in the introspector.
- // PropertyDescriptors are not shared amongst subclasses.
- private boolean isTransient(Class type, PropertyDescriptor pd) {
- if (type == null) {
- return false;
+ PropertyDescriptor pd = getPropertyDescriptor(type, property);
+ if (pd == null) {
+ throw new IllegalStateException("Could not find property by the name " + property);
}
- // This code was mistakenly deleted - it may be fine and
- // is more efficient than the code below. This should
- // all disappear anyway when property descriptors are shared
- // by the introspector.
- /*
- Method getter = pd.getReadMethod();
- Class declaringClass = getter.getDeclaringClass();
- if (declaringClass == type) {
- return Boolean.TRUE.equals(pd.getValue("transient"));
- }
- */
- String pName = pd.getName();
- BeanInfo info = MetaData.getBeanInfo(type);
- PropertyDescriptor[] propertyDescriptors = info.getPropertyDescriptors();
- for (int i = 0; i < propertyDescriptors.length; ++i ) {
- PropertyDescriptor pd2 = propertyDescriptors[i];
- if (pName.equals(pd2.getName())) {
- Object value = pd2.getValue("transient");
- if (value != null) {
- return Boolean.TRUE.equals(value);
- }
- }
+ Method method = pd.getReadMethod();
+ if (method == null) {
+ throw new IllegalStateException("Could not find getter for the property " + property);
}
- return isTransient(type.getSuperclass(), pd);
+ return method;
}
private static boolean equals(Object o1, Object o2) {
@@ -221,7 +187,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
Method getter = pd.getReadMethod();
Method setter = pd.getWriteMethod();
- if (getter != null && setter != null && !isTransient(type, pd)) {
+ if (getter != null && setter != null) {
Expression oldGetExp = new Expression(oldInstance, getter.getName(), new Object[]{});
Expression newGetExp = new Expression(newInstance, getter.getName(), new Object[]{});
Object oldValue = oldGetExp.getValue();
@@ -254,14 +220,19 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
// Write out the properties of this instance.
private void initBean(Class type, Object oldInstance, Object newInstance, Encoder out) {
- // System.out.println("initBean: " + oldInstance);
- BeanInfo info = MetaData.getBeanInfo(type);
-
+ BeanInfo info;
+ try {
+ info = Introspector.getBeanInfo(type);
+ } catch (IntrospectionException exception) {
+ return;
+ }
// Properties
- PropertyDescriptor[] propertyDescriptors = info.getPropertyDescriptors();
- for (int i = 0; i < propertyDescriptors.length; ++i ) {
+ for (PropertyDescriptor d : info.getPropertyDescriptors()) {
+ if (d.isTransient()) {
+ continue;
+ }
try {
- doProperty(type, propertyDescriptors[i], oldInstance, newInstance, out);
+ doProperty(type, d, oldInstance, newInstance, out);
}
catch (Exception e) {
out.getExceptionListener().exceptionThrown(e);
@@ -295,9 +266,10 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
if (!java.awt.Component.class.isAssignableFrom(type)) {
return; // Just handle the listeners of Components for now.
}
- EventSetDescriptor[] eventSetDescriptors = info.getEventSetDescriptors();
- for (int e = 0; e < eventSetDescriptors.length; e++) {
- EventSetDescriptor d = eventSetDescriptors[e];
+ for (EventSetDescriptor d : info.getEventSetDescriptors()) {
+ if (d.isTransient()) {
+ continue;
+ }
Class listenerType = d.getListenerType();
@@ -408,4 +380,15 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
initBean(type, oldInstance, newInstance, out);
}
}
+
+ private static PropertyDescriptor getPropertyDescriptor(Class type, String property) {
+ try {
+ for (PropertyDescriptor pd : Introspector.getBeanInfo(type).getPropertyDescriptors()) {
+ if (property.equals(pd.getName()))
+ return pd;
+ }
+ } catch (IntrospectionException exception) {
+ }
+ return null;
+ }
}
diff --git a/src/share/classes/java/beans/EventSetDescriptor.java b/src/share/classes/java/beans/EventSetDescriptor.java
index 8c30657e0..05b62d8ca 100644
--- a/src/share/classes/java/beans/EventSetDescriptor.java
+++ b/src/share/classes/java/beans/EventSetDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. 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
@@ -369,6 +369,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
setClass0(method.getDeclaringClass());
}
addMethodDescriptor = new MethodDescriptor(method);
+ setTransient(method.getAnnotation(Transient.class));
}
/**
@@ -389,6 +390,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
setClass0(method.getDeclaringClass());
}
removeMethodDescriptor = new MethodDescriptor(method);
+ setTransient(method.getAnnotation(Transient.class));
}
/**
@@ -411,6 +413,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
setClass0(method.getDeclaringClass());
}
getMethodDescriptor = new MethodDescriptor(method);
+ setTransient(method.getAnnotation(Transient.class));
}
/**
diff --git a/src/share/classes/java/beans/FeatureDescriptor.java b/src/share/classes/java/beans/FeatureDescriptor.java
index eea5a29d8..36adbc044 100644
--- a/src/share/classes/java/beans/FeatureDescriptor.java
+++ b/src/share/classes/java/beans/FeatureDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. 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
@@ -32,7 +32,9 @@ import java.lang.ref.WeakReference;
import java.lang.ref.SoftReference;
import java.lang.reflect.Method;
-import java.lang.reflect.Type;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
/**
* The FeatureDescriptor class is the common baseclass for PropertyDescriptor,
@@ -46,6 +48,7 @@ import java.lang.reflect.Type;
*/
public class FeatureDescriptor {
+ private static final String TRANSIENT = "transient";
private Reference<Class> classRef;
@@ -187,10 +190,7 @@ public class FeatureDescriptor {
* @param value The value.
*/
public void setValue(String attributeName, Object value) {
- if (table == null) {
- table = new java.util.Hashtable();
- }
- table.put(attributeName, value);
+ getTable().put(attributeName, value);
}
/**
@@ -201,10 +201,9 @@ public class FeatureDescriptor {
* the attribute is unknown.
*/
public Object getValue(String attributeName) {
- if (table == null) {
- return null;
- }
- return table.get(attributeName);
+ return (this.table != null)
+ ? this.table.get(attributeName)
+ : null;
}
/**
@@ -214,11 +213,8 @@ public class FeatureDescriptor {
* @return An enumeration of the locale-independent names of any
* attributes that have been registered with setValue.
*/
- public java.util.Enumeration<String> attributeNames() {
- if (table == null) {
- table = new java.util.Hashtable();
- }
- return table.keys();
+ public Enumeration<String> attributeNames() {
+ return getTable().keys();
}
/**
@@ -268,61 +264,66 @@ public class FeatureDescriptor {
addTable(old.table);
}
- private void addTable(java.util.Hashtable t) {
- if (t == null) {
- return;
- }
- java.util.Enumeration keys = t.keys();
- while (keys.hasMoreElements()) {
- String key = (String)keys.nextElement();
- Object value = t.get(key);
- setValue(key, value);
+ /**
+ * Copies all values from the specified attribute table.
+ * If some attribute is exist its value should be overridden.
+ *
+ * @param table the attribute table with new values
+ */
+ private void addTable(Hashtable<String, Object> table) {
+ if ((table != null) && !table.isEmpty()) {
+ getTable().putAll(table);
}
}
- // Package private methods for recreating the weak/soft referent
-
- void setClass0(Class cls) {
- this.classRef = getWeakReference(cls);
- }
-
- Class getClass0() {
- return (this.classRef != null)
- ? this.classRef.get()
- : null;
- }
-
/**
- * Create a Reference wrapper for the object.
+ * Returns the initialized attribute table.
*
- * @param obj object that will be wrapped
- * @param soft true if a SoftReference should be created; otherwise Soft
- * @return a Reference or null if obj is null.
+ * @return the initialized attribute table
*/
- static Reference createReference(Object obj, boolean soft) {
- Reference ref = null;
- if (obj != null) {
- if (soft) {
- ref = new SoftReference(obj);
- } else {
- ref = new WeakReference(obj);
- }
+ private Hashtable<String, Object> getTable() {
+ if (this.table == null) {
+ this.table = new Hashtable<String, Object>();
}
- return ref;
+ return this.table;
}
- // Convenience method which creates a WeakReference.
- static Reference createReference(Object obj) {
- return createReference(obj, false);
+ /**
+ * Sets the "transient" attribute according to the annotation.
+ * If the "transient" attribute is already set
+ * it should not be changed.
+ *
+ * @param annotation the annotation of the element of the feature
+ */
+ void setTransient(Transient annotation) {
+ if ((annotation != null) && (null == getValue(TRANSIENT))) {
+ setValue(TRANSIENT, annotation.value());
+ }
}
/**
- * Returns an object from a Reference wrapper.
+ * Indicates whether the feature is transient.
*
- * @return the Object in a wrapper or null.
+ * @return {@code true} if the feature is transient,
+ * {@code false} otherwise
*/
- static Object getObject(Reference ref) {
- return (ref == null) ? null : (Object)ref.get();
+ boolean isTransient() {
+ Object value = getValue(TRANSIENT);
+ return (value instanceof Boolean)
+ ? (Boolean) value
+ : false;
+ }
+
+ // Package private methods for recreating the weak/soft referent
+
+ void setClass0(Class cls) {
+ this.classRef = getWeakReference(cls);
+ }
+
+ Class getClass0() {
+ return (this.classRef != null)
+ ? this.classRef.get()
+ : null;
}
/**
@@ -391,5 +392,5 @@ public class FeatureDescriptor {
private String shortDescription;
private String name;
private String displayName;
- private java.util.Hashtable table;
+ private Hashtable<String, Object> table;
}
diff --git a/src/share/classes/java/beans/IndexedPropertyDescriptor.java b/src/share/classes/java/beans/IndexedPropertyDescriptor.java
index 3b1a39e38..fa5b404c2 100644
--- a/src/share/classes/java/beans/IndexedPropertyDescriptor.java
+++ b/src/share/classes/java/beans/IndexedPropertyDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. 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
@@ -231,6 +231,7 @@ perty.
indexedReadMethodName = readMethod.getName();
this.indexedReadMethodRef = getSoftReference(readMethod);
+ setTransient(readMethod.getAnnotation(Transient.class));
}
@@ -303,6 +304,7 @@ perty.
indexedWriteMethodName = writeMethod.getName();
this.indexedWriteMethodRef = getSoftReference(writeMethod);
+ setTransient(writeMethod.getAnnotation(Transient.class));
}
/**
diff --git a/src/share/classes/java/beans/MetaData.java b/src/share/classes/java/beans/MetaData.java
index 7b9f6ced3..9bcd505c2 100644
--- a/src/share/classes/java/beans/MetaData.java
+++ b/src/share/classes/java/beans/MetaData.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc. 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
@@ -1352,7 +1352,6 @@ final class sun_swing_PrintColorUIResource_PersistenceDelegate extends Persisten
class MetaData {
private static Hashtable internalPersistenceDelegates = new Hashtable();
- private static Hashtable transientProperties = new Hashtable();
private static PersistenceDelegate nullPersistenceDelegate = new NullPersistenceDelegate();
private static PersistenceDelegate enumPersistenceDelegate = new EnumPersistenceDelegate();
@@ -1383,94 +1382,6 @@ class MetaData {
internalPersistenceDelegates.put("java.util.JumboEnumSet", new java_util_EnumSet_PersistenceDelegate());
internalPersistenceDelegates.put("java.util.RegularEnumSet", new java_util_EnumSet_PersistenceDelegate());
-
-// Transient properties
-
- // awt
-
- // Infinite graphs.
- removeProperty("java.awt.geom.RectangularShape", "frame");
- // removeProperty("java.awt.Rectangle2D", "frame");
- // removeProperty("java.awt.Rectangle", "frame");
-
- removeProperty("java.awt.Rectangle", "bounds");
- removeProperty("java.awt.Dimension", "size");
- removeProperty("java.awt.Point", "location");
-
- // The color and font properties in Component need special treatment, see above.
- removeProperty("java.awt.Component", "foreground");
- removeProperty("java.awt.Component", "background");
- removeProperty("java.awt.Component", "font");
-
- // The visible property of Component needs special treatment because of Windows.
- removeProperty("java.awt.Component", "visible");
-
- // This property throws an exception if accessed when there is no child.
- removeProperty("java.awt.ScrollPane", "scrollPosition");
-
- // 4917458 this should be removed for XAWT since it may throw
- // an unsupported exception if there isn't any input methods.
- // This shouldn't be a problem since these are added behind
- // the scenes automatically.
- removeProperty("java.awt.im.InputContext", "compositionEnabled");
-
- // swing
-
- // The size properties in JComponent need special treatment, see above.
- removeProperty("javax.swing.JComponent", "minimumSize");
- removeProperty("javax.swing.JComponent", "preferredSize");
- removeProperty("javax.swing.JComponent", "maximumSize");
-
- // These properties have platform specific implementations
- // and should not appear in archives.
- removeProperty("javax.swing.ImageIcon", "image");
- removeProperty("javax.swing.ImageIcon", "imageObserver");
-
- // This property unconditionally throws a "not implemented" exception.
- removeProperty("javax.swing.JMenuBar", "helpMenu");
-
- // The scrollBars in a JScrollPane are dynamic and should not
- // be archived. The row and columns headers are changed by
- // components like JTable on "addNotify".
- removeProperty("javax.swing.JScrollPane", "verticalScrollBar");
- removeProperty("javax.swing.JScrollPane", "horizontalScrollBar");
- removeProperty("javax.swing.JScrollPane", "rowHeader");
- removeProperty("javax.swing.JScrollPane", "columnHeader");
-
- removeProperty("javax.swing.JViewport", "extentSize");
-
- // Renderers need special treatment, since their properties
- // change during rendering.
- removeProperty("javax.swing.table.JTableHeader", "defaultRenderer");
- removeProperty("javax.swing.JList", "cellRenderer");
-
- removeProperty("javax.swing.JList", "selectedIndices");
-
- // The lead and anchor selection indexes are best ignored.
- // Selection is rarely something that should persist from
- // development to deployment.
- removeProperty("javax.swing.DefaultListSelectionModel", "leadSelectionIndex");
- removeProperty("javax.swing.DefaultListSelectionModel", "anchorSelectionIndex");
-
- // The selection must come after the text itself.
- removeProperty("javax.swing.JComboBox", "selectedIndex");
-
- // All selection information should come after the JTabbedPane is built
- removeProperty("javax.swing.JTabbedPane", "selectedIndex");
- removeProperty("javax.swing.JTabbedPane", "selectedComponent");
-
- // PENDING: The "disabledIcon" property is often computed from the icon property.
- removeProperty("javax.swing.AbstractButton", "disabledIcon");
- removeProperty("javax.swing.JLabel", "disabledIcon");
-
- // The caret property throws errors when it it set beyond
- // the extent of the text. We could just set it after the
- // text, but this is probably not something we want to archive anyway.
- removeProperty("javax.swing.text.JTextComponent", "caret");
- removeProperty("javax.swing.text.JTextComponent", "caretPosition");
- // The selectionStart must come after the text itself.
- removeProperty("javax.swing.text.JTextComponent", "selectionStart");
- removeProperty("javax.swing.text.JTextComponent", "selectionEnd");
}
/*pp*/ static boolean equals(Object o1, Object o2) {
@@ -1509,18 +1420,6 @@ class MetaData {
// }
String typeName = type.getName();
-
- // Check to see if there are properties that have been lazily registered for removal.
- if (getBeanAttribute(type, "transient_init") == null) {
- Vector tp = (Vector)transientProperties.get(typeName);
- if (tp != null) {
- for(int i = 0; i < tp.size(); i++) {
- setPropertyAttribute(type, (String)tp.get(i), "transient", Boolean.TRUE);
- }
- }
- setBeanAttribute(type, "transient_init", Boolean.TRUE);
- }
-
PersistenceDelegate pd = (PersistenceDelegate)getBeanAttribute(type, "persistenceDelegate");
if (pd == null) {
pd = (PersistenceDelegate)internalPersistenceDelegates.get(typeName);
@@ -1583,55 +1482,11 @@ class MetaData {
return true;
}
- // Wrapper for Introspector.getBeanInfo to handle exception handling.
- // Note: this relys on new 1.4 Introspector semantics which cache the BeanInfos
- public static BeanInfo getBeanInfo(Class type) {
- BeanInfo info = null;
- try {
- info = Introspector.getBeanInfo(type);
- } catch (Throwable e) {
- e.printStackTrace();
- }
-
- return info;
- }
-
- private static PropertyDescriptor getPropertyDescriptor(Class type, String propertyName) {
- BeanInfo info = getBeanInfo(type);
- PropertyDescriptor[] propertyDescriptors = info.getPropertyDescriptors();
- // System.out.println("Searching for: " + propertyName + " in " + type);
- for(int i = 0; i < propertyDescriptors.length; i++) {
- PropertyDescriptor pd = propertyDescriptors[i];
- if (propertyName.equals(pd.getName())) {
- return pd;
- }
- }
- return null;
- }
-
- private static void setPropertyAttribute(Class type, String property, String attribute, Object value) {
- PropertyDescriptor pd = getPropertyDescriptor(type, property);
- if (pd == null) {
- System.err.println("Warning: property " + property + " is not defined on " + type);
- return;
- }
- pd.setValue(attribute, value);
- }
-
- private static void setBeanAttribute(Class type, String attribute, Object value) {
- getBeanInfo(type).getBeanDescriptor().setValue(attribute, value);
- }
-
private static Object getBeanAttribute(Class type, String attribute) {
- return getBeanInfo(type).getBeanDescriptor().getValue(attribute);
- }
-
- private static void removeProperty(String typeName, String property) {
- Vector tp = (Vector)transientProperties.get(typeName);
- if (tp == null) {
- tp = new Vector();
- transientProperties.put(typeName, tp);
+ try {
+ return Introspector.getBeanInfo(type).getBeanDescriptor().getValue(attribute);
+ } catch (IntrospectionException exception) {
+ return null;
}
- tp.add(property);
}
}
diff --git a/src/share/classes/java/beans/PropertyDescriptor.java b/src/share/classes/java/beans/PropertyDescriptor.java
index 775b213c3..08ae9a45f 100644
--- a/src/share/classes/java/beans/PropertyDescriptor.java
+++ b/src/share/classes/java/beans/PropertyDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. 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
@@ -256,6 +256,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
readMethodName = readMethod.getName();
this.readMethodRef = getSoftReference(readMethod);
+ setTransient(readMethod.getAnnotation(Transient.class));
}
/**
@@ -320,7 +321,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
writeMethodName = writeMethod.getName();
this.writeMethodRef = getSoftReference(writeMethod);
-
+ setTransient(writeMethod.getAnnotation(Transient.class));
}
private Method getReadMethod0() {
diff --git a/src/share/classes/java/beans/Transient.java b/src/share/classes/java/beans/Transient.java
new file mode 100644
index 000000000..302152e7c
--- /dev/null
+++ b/src/share/classes/java/beans/Transient.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.beans;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Indicates that an attribute called "transient"
+ * should be declared with the given {@code value}
+ * when the {@link Introspector} constructs
+ * a {@link PropertyDescriptor} or {@link EventSetDescriptor}
+ * classes associated with the annotated code element.
+ * A {@code true} value for the "transient" attribute
+ * indicates to encoders derived from {@link Encoder}
+ * that this feature should be ignored.
+ * <p/>
+ * The {@code Transient} annotation may be be used
+ * in any of the methods that are involved
+ * in a {@link FeatureDescriptor} subclass
+ * to identify the transient feature in the annotated class and its subclasses.
+ * Normally, the method that starts with "get" is the best place
+ * to put the annotation and it is this declaration
+ * that takes precedence in the case of multiple annotations
+ * being defined for the same feature.
+ * <p/>
+ * To declare a feature non-transient in a class
+ * whose superclass declares it transient,
+ * use {@code @Transient(false)}.
+ * In all cases, the {@link Introspector} decides
+ * if a feature is transient by referring to the annotation
+ * on the most specific superclass.
+ * If no {@code Transient} annotation is present
+ * in any superclass the feature is not transient.
+ *
+ * @since 1.7
+ */
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface Transient {
+ boolean value() default true;
+}
diff --git a/src/share/classes/javax/swing/AbstractButton.java b/src/share/classes/javax/swing/AbstractButton.java
index b4d4ae1e2..53cb6139c 100644
--- a/src/share/classes/javax/swing/AbstractButton.java
+++ b/src/share/classes/javax/swing/AbstractButton.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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,9 @@ import java.awt.event.*;
import java.awt.image.*;
import java.text.*;
import java.awt.geom.*;
-import java.beans.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.Transient;
import java.util.Enumeration;
import java.util.Vector;
import java.io.Serializable;
@@ -645,6 +647,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
* @see #setDisabledIcon
* @see javax.swing.LookAndFeel#getDisabledIcon
*/
+ @Transient
public Icon getDisabledIcon() {
if (disabledIcon == null) {
disabledIcon = UIManager.getLookAndFeel().getDisabledIcon(this, getIcon());
diff --git a/src/share/classes/javax/swing/DefaultListSelectionModel.java b/src/share/classes/javax/swing/DefaultListSelectionModel.java
index 78caa1941..329fa38b4 100644
--- a/src/share/classes/javax/swing/DefaultListSelectionModel.java
+++ b/src/share/classes/javax/swing/DefaultListSelectionModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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,6 +28,7 @@ package javax.swing;
import java.util.EventListener;
import java.util.BitSet;
import java.io.Serializable;
+import java.beans.Transient;
import javax.swing.event.*;
@@ -714,11 +715,13 @@ public class DefaultListSelectionModel implements ListSelectionModel, Cloneable,
}
/** {@inheritDoc} */
+ @Transient
public int getAnchorSelectionIndex() {
return anchorIndex;
}
/** {@inheritDoc} */
+ @Transient
public int getLeadSelectionIndex() {
return leadIndex;
}
diff --git a/src/share/classes/javax/swing/ImageIcon.java b/src/share/classes/javax/swing/ImageIcon.java
index 38a9f22f2..74788f1a8 100644
--- a/src/share/classes/javax/swing/ImageIcon.java
+++ b/src/share/classes/javax/swing/ImageIcon.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
@@ -27,6 +27,7 @@ package javax.swing;
import java.awt.*;
import java.awt.image.*;
import java.beans.ConstructorProperties;
+import java.beans.Transient;
import java.net.URL;
import java.io.Serializable;
@@ -336,6 +337,7 @@ public class ImageIcon implements Icon, Serializable, Accessible {
* Returns this icon's <code>Image</code>.
* @return the <code>Image</code> object for this <code>ImageIcon</code>
*/
+ @Transient
public Image getImage() {
return image;
}
@@ -436,6 +438,7 @@ public class ImageIcon implements Icon, Serializable, Accessible {
*
* @return the image observer, which may be null
*/
+ @Transient
public ImageObserver getImageObserver() {
return imageObserver;
}
diff --git a/src/share/classes/javax/swing/JComboBox.java b/src/share/classes/javax/swing/JComboBox.java
index a4d92427e..2230147f4 100644
--- a/src/share/classes/javax/swing/JComboBox.java
+++ b/src/share/classes/javax/swing/JComboBox.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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,7 +24,9 @@
*/
package javax.swing;
-import java.beans.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.Transient;
import java.util.*;
import java.awt.*;
@@ -636,6 +638,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* or -1 if no item is selected or if
* the currently selected item is not in the list
*/
+ @Transient
public int getSelectedIndex() {
Object sObject = dataModel.getSelectedItem();
int i,c;
diff --git a/src/share/classes/javax/swing/JComponent.java b/src/share/classes/javax/swing/JComponent.java
index d26ec12eb..7d3881a1c 100644
--- a/src/share/classes/javax/swing/JComponent.java
+++ b/src/share/classes/javax/swing/JComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
@@ -43,7 +43,10 @@ import java.awt.Graphics2D;
import java.awt.peer.LightweightPeer;
import java.awt.dnd.DropTarget;
import java.awt.font.FontRenderContext;
-import java.beans.*;
+import java.beans.PropertyChangeListener;
+import java.beans.VetoableChangeListener;
+import java.beans.VetoableChangeSupport;
+import java.beans.Transient;
import java.applet.Applet;
@@ -1634,6 +1637,7 @@ public abstract class JComponent extends Container implements Serializable,
* @see #setPreferredSize
* @see ComponentUI
*/
+ @Transient
public Dimension getPreferredSize() {
if (isPreferredSizeSet()) {
return super.getPreferredSize();
@@ -1675,6 +1679,7 @@ public abstract class JComponent extends Container implements Serializable,
* @see #setMaximumSize
* @see ComponentUI
*/
+ @Transient
public Dimension getMaximumSize() {
if (isMaximumSizeSet()) {
return super.getMaximumSize();
@@ -1714,6 +1719,7 @@ public abstract class JComponent extends Container implements Serializable,
* @see #setMinimumSize
* @see ComponentUI
*/
+ @Transient
public Dimension getMinimumSize() {
if (isMinimumSizeSet()) {
return super.getMinimumSize();
diff --git a/src/share/classes/javax/swing/JLabel.java b/src/share/classes/javax/swing/JLabel.java
index 1d51add5c..417892a83 100644
--- a/src/share/classes/javax/swing/JLabel.java
+++ b/src/share/classes/javax/swing/JLabel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
@@ -31,6 +31,7 @@ import java.awt.Image;
import java.awt.*;
import java.text.*;
import java.awt.geom.*;
+import java.beans.Transient;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
@@ -422,6 +423,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible
* @see javax.swing.LookAndFeel#getDisabledIcon
* @see ImageIcon
*/
+ @Transient
public Icon getDisabledIcon() {
if (!disabledIconSet && disabledIcon == null && defaultIcon != null) {
disabledIcon = UIManager.getLookAndFeel().getDisabledIcon(this, defaultIcon);
diff --git a/src/share/classes/javax/swing/JList.java b/src/share/classes/javax/swing/JList.java
index 8446d05a8..a83a4c94e 100644
--- a/src/share/classes/javax/swing/JList.java
+++ b/src/share/classes/javax/swing/JList.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
@@ -31,7 +31,9 @@ import java.awt.*;
import java.util.Vector;
import java.util.Locale;
-import java.beans.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.Transient;
import javax.swing.event.*;
import javax.accessibility.*;
@@ -724,6 +726,7 @@ public class JList extends JComponent implements Scrollable, Accessible
* @return the value of the {@code cellRenderer} property
* @see #setCellRenderer
*/
+ @Transient
public ListCellRenderer getCellRenderer() {
return cellRenderer;
}
@@ -2153,6 +2156,7 @@ public class JList extends JComponent implements Scrollable, Accessible
* @see #removeSelectionInterval
* @see #addListSelectionListener
*/
+ @Transient
public int[] getSelectedIndices() {
ListSelectionModel sm = getSelectionModel();
int iMin = sm.getMinSelectionIndex();
diff --git a/src/share/classes/javax/swing/JMenuBar.java b/src/share/classes/javax/swing/JMenuBar.java
index f10a84bf3..d6f04fbb4 100644
--- a/src/share/classes/javax/swing/JMenuBar.java
+++ b/src/share/classes/javax/swing/JMenuBar.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
@@ -32,6 +32,7 @@ import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.*;
+import java.beans.Transient;
import java.util.Vector;
import java.util.Enumeration;
@@ -236,6 +237,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement
*
* @return the <code>JMenu</code> that delivers help to the user
*/
+ @Transient
public JMenu getHelpMenu() {
throw new Error("getHelpMenu() not yet implemented.");
}
diff --git a/src/share/classes/javax/swing/JScrollPane.java b/src/share/classes/javax/swing/JScrollPane.java
index 1db9e459f..13c1365c0 100644
--- a/src/share/classes/javax/swing/JScrollPane.java
+++ b/src/share/classes/javax/swing/JScrollPane.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
@@ -43,8 +43,9 @@ import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.IOException;
-import java.beans.*;
-
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.Transient;
/**
* Provides a scrollable view of a lightweight component.
@@ -822,6 +823,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce
* @return the <code>horizontalScrollBar</code> property
* @see #setHorizontalScrollBar
*/
+ @Transient
public JScrollBar getHorizontalScrollBar() {
return horizontalScrollBar;
}
@@ -880,6 +882,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce
* @return the <code>verticalScrollBar</code> property
* @see #setVerticalScrollBar
*/
+ @Transient
public JScrollBar getVerticalScrollBar() {
return verticalScrollBar;
}
@@ -1012,6 +1015,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce
* @return the <code>rowHeader</code> property
* @see #setRowHeader
*/
+ @Transient
public JViewport getRowHeader() {
return rowHeader;
}
@@ -1081,6 +1085,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce
* @return the <code>columnHeader</code> property
* @see #setColumnHeader
*/
+ @Transient
public JViewport getColumnHeader() {
return columnHeader;
}
diff --git a/src/share/classes/javax/swing/JTabbedPane.java b/src/share/classes/javax/swing/JTabbedPane.java
index defffc711..706fc3732 100644
--- a/src/share/classes/javax/swing/JTabbedPane.java
+++ b/src/share/classes/javax/swing/JTabbedPane.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
@@ -27,7 +27,7 @@ package javax.swing;
import java.awt.*;
import java.awt.event.*;
-import java.beans.*;
+import java.beans.Transient;
import java.util.*;
import javax.swing.event.*;
import javax.swing.plaf.*;
@@ -563,6 +563,7 @@ public class JTabbedPane extends JComponent
* @return the index of the selected tab
* @see #setSelectedIndex
*/
+ @Transient
public int getSelectedIndex() {
return model.getSelectedIndex();
}
@@ -648,6 +649,7 @@ public class JTabbedPane extends JComponent
* @return the component corresponding to the selected tab
* @see #setSelectedComponent
*/
+ @Transient
public Component getSelectedComponent() {
int index = getSelectedIndex();
if (index == -1) {
diff --git a/src/share/classes/javax/swing/JViewport.java b/src/share/classes/javax/swing/JViewport.java
index 1825c7901..f5a16bbd2 100644
--- a/src/share/classes/javax/swing/JViewport.java
+++ b/src/share/classes/javax/swing/JViewport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
@@ -30,6 +30,7 @@ import java.awt.event.*;
import java.awt.image.VolatileImage;
import java.awt.peer.ComponentPeer;
import java.applet.Applet;
+import java.beans.Transient;
import javax.swing.plaf.ViewportUI;
import javax.swing.event.*;
@@ -1257,6 +1258,7 @@ public class JViewport extends JComponent implements Accessible
*
* @return a <code>Dimension</code> object giving the size of the view
*/
+ @Transient
public Dimension getExtentSize() {
return getSize();
}
diff --git a/src/share/classes/javax/swing/table/JTableHeader.java b/src/share/classes/javax/swing/table/JTableHeader.java
index fb99e058d..780996089 100644
--- a/src/share/classes/javax/swing/table/JTableHeader.java
+++ b/src/share/classes/javax/swing/table/JTableHeader.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
@@ -37,6 +37,7 @@ import javax.swing.plaf.*;
import javax.accessibility.*;
import java.beans.PropertyChangeListener;
+import java.beans.Transient;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
@@ -325,6 +326,7 @@ public class JTableHeader extends JComponent implements TableColumnModelListener
* @return the default renderer
* @since 1.3
*/
+ @Transient
public TableCellRenderer getDefaultRenderer() {
return defaultRenderer;
}
diff --git a/src/share/classes/javax/swing/text/JTextComponent.java b/src/share/classes/javax/swing/text/JTextComponent.java
index d340f281e..e45310035 100644
--- a/src/share/classes/javax/swing/text/JTextComponent.java
+++ b/src/share/classes/javax/swing/text/JTextComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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,6 +29,7 @@ import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.beans.Transient;
import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
@@ -571,6 +572,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
*
* @return the caret
*/
+ @Transient
public Caret getCaret() {
return caret;
}
@@ -1672,6 +1674,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
* @return the position of the text insertion caret for the
* text component >= 0
*/
+ @Transient
public int getCaretPosition() {
return caret.getDot();
}
@@ -1797,6 +1800,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
*
* @return the start position >= 0
*/
+ @Transient
public int getSelectionStart() {
int start = Math.min(caret.getDot(), caret.getMark());
return start;
@@ -1829,6 +1833,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
*
* @return the end position >= 0
*/
+ @Transient
public int getSelectionEnd() {
int end = Math.max(caret.getDot(), caret.getMark());
return end;