All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.swing.beaninfo.SwingBeanInfo

java.lang.Object
    |
    +----java.beans.SimpleBeanInfo
            |
            +----java.awt.swing.beaninfo.SwingBeanInfo

public abstract class SwingBeanInfo
extends SimpleBeanInfo
The superclass for all Swing BeanInfo classes. It provides default implementations of getIcon and getDefaultPropertyIndex as well as utility methods, like createPropertyDescriptor, for writing BeanInfo implementations. This classes is intended to be used along with GenSwingBeanInfo a BeanInfo class code generator.

See Also:
GenSwingBeanInfo

Variable Index

 o BOUND
 o CONSTRAINED
 o CUSTOMIZERCLASS
 o DISPLAYNAME
 o EXPERT
 o HIDDEN
 o PREFERRED
 o PROPERTYEDITORCLASS
 o READMETHOD
 o SHORTDESCRIPTION
 o WRITEMETHOD

Constructor Index

 o SwingBeanInfo()

Method Index

 o createBeanDescriptor(Class, Object[])
Create a BeanDescriptor object given an of keyword/value arguments.
 o createPropertyDescriptor(Class, String, Object[])
Create a beans PropertyDescriptor given an of keyword/value arguments.
 o getAdditionalBeanInfo()
Returns the BeanInfo for the superclass of our bean, so that its PropertyDescriptors will be included.
 o getDefaultPropertyIndex()
The default index is always 0.
 o getIcon(int)
Returns a generic Swing icon, all icon "kinds" are supported.
 o throwError(Exception, String)
Fatal errors are handled by calling this method.

Variables

 o BOUND
public static final String BOUND
 o CONSTRAINED
public static final String CONSTRAINED
 o PROPERTYEDITORCLASS
public static final String PROPERTYEDITORCLASS
 o READMETHOD
public static final String READMETHOD
 o WRITEMETHOD
public static final String WRITEMETHOD
 o DISPLAYNAME
public static final String DISPLAYNAME
 o EXPERT
public static final String EXPERT
 o HIDDEN
public static final String HIDDEN
 o PREFERRED
public static final String PREFERRED
 o SHORTDESCRIPTION
public static final String SHORTDESCRIPTION
 o CUSTOMIZERCLASS
public static final String CUSTOMIZERCLASS

Constructors

 o SwingBeanInfo
public SwingBeanInfo()

Methods

 o throwError
protected void throwError(Exception e,
                          String s)
Fatal errors are handled by calling this method.

 o createPropertyDescriptor
public PropertyDescriptor createPropertyDescriptor(Class cls,
                                                   String name,
                                                   Object[] args)
Create a beans PropertyDescriptor given an of keyword/value arguments. The following sample call shows all of the supported keywords:
      createPropertyDescriptor("contentPane", new Object[] {
			   BOUND, Boolean.TRUE,
  	     CONSTRAINED, Boolean.TRUE,
	     PROPERTYEDITORCLASS, package.MyEditor.class,
		      READMETHOD, "getContentPane",
  	     WRITEMETHOD, "setContentPane",
  	     DISPLAYNAME, "contentPane",
			  EXPERT, Boolean.FALSE,
			  HIDDEN, Boolean.FALSE,
		       PREFERRED, Boolean.TRUE,
		SHORTDESCRIPTION, "A top level window with a window manager border",
	       "random attribute","random object value" 
	      }
	   );
 
The keywords correspond to java.beans.PropertyDescriptor and java.beans.FeatureDescriptor properties, e.g. providing a value for displayName is comparable to FeatureDescriptor.setDisplayName(). Using createPropertyDescriptor instead of the PropertyDescriptor constructor and set methods is preferrable in that it regularizes the code in a java.beans.BeanInfo.getPropertyDescriptors() method implementation. One can use createPropertyDescriptor to set FeatureDescriptor attributes, as in "random attribute" "random object value".

All properties should provide a reasonable value for the SHORTDESCRIPTION keyword and should set BOUND to Boolean.TRUE if neccessary. The remaining keywords are optional. There's no need to provide values for keywords like READMETHOD if the correct value can be computed, i.e. if the properties get/is method follows the standard beans pattern.

The PREFERRED keyword is not supported by the JDK1.1 java.beans package. It's still worth setting it to true for properties that are most likely to be interested to the average developer, e.g. AbstractButton.title is a preferred property, AbstractButton.focusPainted is not.

See Also:
java.beans#BeanInfo, java.beans#PropertyDescriptor, java.beans#FeatureDescriptor
 o createBeanDescriptor
public BeanDescriptor createBeanDescriptor(Class cls,
                                           Object[] args)
Create a BeanDescriptor object given an of keyword/value arguments. The following sample call shows all of the supported keywords:
      createPropertyDescriptor("contentPane", new Object[] {
	         CUSTOMIZERCLASS, package.MyCustomizer.class,
  	     DISPLAYNAME, "contentPane",
			  EXPERT, Boolean.FALSE,
			  HIDDEN, Boolean.FALSE,
		       PREFERRED, Boolean.TRUE,
		SHORTDESCRIPTION, "A top level window with a window manager border",
	       "random attribute","random object value" 
	      }
	   );
 
The keywords correspond to java.beans.BeanDescriptor and java.beans.FeatureDescriptor properties, e.g. providing a value for displayName is comparable to FeatureDescriptor.setDisplayName(). Using createBeanDescriptor instead of the BeanDescriptor constructor and set methods is preferrable in that it regularizes the code in a java.beans.BeanInfo.getBeanDescriptor() method implementation. One can use createBeanDescriptor to set FeatureDescriptor attributes, as in "random attribute" "random object value".

See Also:
java.beans#BeanInfo, java.beans#PropertyDescriptor
 o getDefaultPropertyIndex
public int getDefaultPropertyIndex()
The default index is always 0. In other words the first property listed in the getPropertyDescriptors() method is the one to show a (JFC builder) user in a situation where just a single property will be shown.

Overrides:
getDefaultPropertyIndex in class SimpleBeanInfo
 o getIcon
public Image getIcon(int kind)
Returns a generic Swing icon, all icon "kinds" are supported. Subclasses should defer to this method when they don't have a particular beans icon kind.

Overrides:
getIcon in class SimpleBeanInfo
 o getAdditionalBeanInfo
public BeanInfo[] getAdditionalBeanInfo()
Returns the BeanInfo for the superclass of our bean, so that its PropertyDescriptors will be included.

Overrides:
getAdditionalBeanInfo in class SimpleBeanInfo

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature