com.sun.rave.designtime
Class BasicCustomizer2


java.lang.Object

  extended bycom.sun.rave.designtime.BasicCustomizer2

All Implemented Interfaces:
Customizer2, DisplayItem

public class BasicCustomizer2
extends java.lang.Object
implements Customizer2

A basic implementation of Customizer2 to subclass and/or use for convenience. The 'panelClass' defines the piece of UI to use for the customizer. If the panelClass has a constructor that takes a DesignBean, that will be used. Otherwise, a null constructor will be used.

Version:
1.0
Author:
Joe Nuxoll
See Also:
Customizer2

Field Summary
protected  boolean applyCapable
           
protected  java.lang.String description
           
protected  DesignBean designBean
           
protected  java.lang.String displayName
           
protected  java.lang.String helpKey
           
protected  java.awt.Image largeIcon
           
protected  boolean modified
           
protected  java.lang.Class panelClass
           
protected  java.util.Vector propertyChangeListeners
           
protected  java.awt.Image smallIcon
           
 
Constructor Summary
BasicCustomizer2()
           
BasicCustomizer2(java.lang.Class panelClass)
           
BasicCustomizer2(java.lang.Class panelClass, java.lang.String displayName)
           
BasicCustomizer2(java.lang.Class panelClass, java.lang.String displayName, java.lang.String description)
           
BasicCustomizer2(java.lang.Class panelClass, java.lang.String displayName, java.lang.String description, java.lang.String helpKey)
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Standard propertyChange events - 'null' property name indicates that the bean changed in some other way than just a property.
 Result applyChanges()
          Notifies the customizer that the user has clicked "OK" or "Apply" and the customizer should commit it's changes to the DesignBean.
protected  java.awt.Component createCustomizerPanel()
           
 void firePropertyChange()
           
 void firePropertyChange(java.beans.PropertyChangeEvent e)
           
 void firePropertyChange(java.lang.String propName)
           
 void firePropertyChange(java.lang.String propName, java.lang.Object oldValue, java.lang.Object newValue)
           
 java.awt.Component getCustomizerPanel(DesignBean designBean)
          Returns a UI panel (should be lightweight) to be displayed to the user.
 java.lang.String getDescription()
          Returns a description for this item.
 DesignBean getDesignBean()
           
 java.lang.String getDisplayName()
          Returns a display name for this item.
 java.lang.String getHelpKey()
          Returns the help key for this item.
 java.awt.Image getLargeIcon()
          Returns a large image icon for this item.
 java.lang.Class getPanelClass()
           
 java.beans.PropertyChangeListener[] getPropertyChangeListeners()
          Standard propertyChange events - 'null' property name indicates that the bean changed in some other way than just a property.
 java.awt.Image getSmallIcon()
          Returns a small image icon for this item.
 boolean isApplyCapable()
          If a Customizer2 is apply capable (isApplyCapable() returns true), the host dialog will have three buttons: "OK", "Apply", and "Cancel" (and possibly "Help" if there is a helpKey).
 boolean isModified()
          Returns true if the customizer is in an edited state - to notify the customizer dialog that the "Apply" button should be activated
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Standard propertyChange events - 'null' property name indicates that the bean changed in some other way than just a property.
 void setApplyCapable(boolean applyCapable)
           
 void setDescription(java.lang.String description)
           
 void setDisplayName(java.lang.String displayName)
           
 void setHelpKey(java.lang.String helpKey)
           
 void setLargeIcon(java.awt.Image largeIcon)
           
 void setModified(boolean modified)
           
 void setPanelClass(java.lang.Class panelClass)
           
 void setSmallIcon(java.awt.Image smallIcon)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

applyCapable


protected boolean applyCapable

description


protected java.lang.String description

designBean


protected DesignBean designBean

displayName


protected java.lang.String displayName

helpKey


protected java.lang.String helpKey

largeIcon


protected java.awt.Image largeIcon

modified


protected boolean modified

panelClass


protected java.lang.Class panelClass

propertyChangeListeners


protected java.util.Vector propertyChangeListeners

smallIcon


protected java.awt.Image smallIcon
Constructor Detail

BasicCustomizer2


public BasicCustomizer2()

BasicCustomizer2


public BasicCustomizer2(java.lang.Class panelClass)

BasicCustomizer2


public BasicCustomizer2(java.lang.Class panelClass,
                        java.lang.String displayName)

BasicCustomizer2


public BasicCustomizer2(java.lang.Class panelClass,
                        java.lang.String displayName,
                        java.lang.String description)

BasicCustomizer2


public BasicCustomizer2(java.lang.Class panelClass,
                        java.lang.String displayName,
                        java.lang.String description,
                        java.lang.String helpKey)
Method Detail

addPropertyChangeListener


public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: Customizer2
Standard propertyChange events - 'null' property name indicates that the bean changed in some other way than just a property. An apply capable Customizer2 can use this as a hook to notify the host dialog that the 'modified' state has changed.

Specified by:
addPropertyChangeListener in interface Customizer2
Parameters:
l - The PropertyChangeListener to add

applyChanges


public Result applyChanges()
Description copied from interface: Customizer2
Notifies the customizer that the user has clicked "OK" or "Apply" and the customizer should commit it's changes to the DesignBean.

Specified by:
applyChanges in interface Customizer2
Returns:
A Result object, indicating success or failure, and optionally including messages for the user

createCustomizerPanel


protected java.awt.Component createCustomizerPanel()

firePropertyChange


public void firePropertyChange()

firePropertyChange


public void firePropertyChange(java.beans.PropertyChangeEvent e)

firePropertyChange


public void firePropertyChange(java.lang.String propName)

firePropertyChange


public void firePropertyChange(java.lang.String propName,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)

getCustomizerPanel


public java.awt.Component getCustomizerPanel(DesignBean designBean)
Description copied from interface: Customizer2
Returns a UI panel (should be lightweight) to be displayed to the user. The passed in DesignBean is the design-time proxy representing the JavaBean being customized. This method will be called *every* time the Customizer2 is invoked.

Specified by:
getCustomizerPanel in interface Customizer2
Parameters:
designBean - the DesignBean to be customized
Returns:
a lightweight panel to display to the user

getDescription


public java.lang.String getDescription()
Description copied from interface: DisplayItem
Returns a description for this item. This will be used as a tooltip in a menu or on a button, depending on the subinterface.

Specified by:
getDescription in interface DisplayItem
Returns:
A String representing the description for this item.

getDesignBean


public DesignBean getDesignBean()

getDisplayName


public java.lang.String getDisplayName()
Description copied from interface: DisplayItem
Returns a display name for this item. This will be used to show in a menu or as a button label, depending on the subinterface.

Specified by:
getDisplayName in interface DisplayItem
Returns:
A String representing the display name for this item.

getHelpKey


public java.lang.String getHelpKey()
Description copied from interface: DisplayItem
Returns the help key for this item. This is usually a key used to look up a help context item in an online help facility.

Specified by:
getHelpKey in interface DisplayItem
Returns:
A String representing the help key for this item.

getLargeIcon


public java.awt.Image getLargeIcon()
Description copied from interface: DisplayItem
Returns a large image icon for this item. Generally "large" means 32x32 pixels.

Specified by:
getLargeIcon in interface DisplayItem
Returns:
An Image representing the large icon for this item.

getPanelClass


public java.lang.Class getPanelClass()

getPropertyChangeListeners


public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
Description copied from interface: Customizer2
Standard propertyChange events - 'null' property name indicates that the bean changed in some other way than just a property. An apply capable Customizer2 can use this as a hook to notify the host dialog that the 'modified' state has changed.

Specified by:
getPropertyChangeListeners in interface Customizer2
Returns:
An array of PropertyChangeListener representing all the current listeners

getSmallIcon


public java.awt.Image getSmallIcon()
Description copied from interface: DisplayItem
Returns a small image icon for this item. Generally "small" means 16x16 pixels.

Specified by:
getSmallIcon in interface DisplayItem
Returns:
An Image representing the large icon for this item.

isApplyCapable


public boolean isApplyCapable()
Description copied from interface: Customizer2

If a Customizer2 is apply capable (isApplyCapable() returns true), the host dialog will have three buttons: "OK", "Apply", and "Cancel" (and possibly "Help" if there is a helpKey). The 'isModified' method will be called each time a PropertyChangeEvent is fired to check if the "Apply" button should be enabled. When the user clicks "OK" or "Apply", the 'applyChanges' method is called. This implies that manipulations in the dialog are not directly affecting the DesignBean. The DesignBean should not be touched until 'applyChanges' has been called.

If a Customizer2 is NOT apply capable (isApplyCapable() returns false), the host dialog will only have one button: "Done" (and possibly "Help" if there is a helpKey). The DesignBean may be manipulated at will in this dialog, as it is considered to be non-stateful. When the user clicks "Done", the 'applyChanges' method will be called.

Specified by:
isApplyCapable in interface Customizer2
Returns:
returns true if the customizer is stateful and is capable of handling an apply operation
See Also:
Customizer2.isModified(), Customizer2.applyChanges()

isModified


public boolean isModified()
Description copied from interface: Customizer2
Returns true if the customizer is in an edited state - to notify the customizer dialog that the "Apply" button should be activated

Specified by:
isModified in interface Customizer2
Returns:
returns true if the customizer is in an edited state, false if not

removePropertyChangeListener


public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: Customizer2
Standard propertyChange events - 'null' property name indicates that the bean changed in some other way than just a property. An apply capable Customizer2 can use this as a hook to notify the host dialog that the 'modified' state has changed.

Specified by:
removePropertyChangeListener in interface Customizer2
Parameters:
l - The PropertyChangeListener to remove

setApplyCapable


public void setApplyCapable(boolean applyCapable)

setDescription


public void setDescription(java.lang.String description)

setDisplayName


public void setDisplayName(java.lang.String displayName)

setHelpKey


public void setHelpKey(java.lang.String helpKey)

setLargeIcon


public void setLargeIcon(java.awt.Image largeIcon)

setModified


public void setModified(boolean modified)

setPanelClass


public void setPanelClass(java.lang.Class panelClass)

setSmallIcon


public void setSmallIcon(java.awt.Image smallIcon)