com.sun.rave.designtime
Interface Customizer2

All Superinterfaces:
DisplayItem
All Known Implementing Classes:
BasicCustomizer2

public interface Customizer2
extends DisplayItem

The Customizer2 interface describes a context-aware customizer for a JavaBean. A component author may wish to supply a customizer for their JavaBean, which is a dialog that pops up and provides a rich set of UI controls to manipulate the configuration of the entire JavaBean. This type of Customizer has significantly more access to the context that the JavaBean is being designed in, and thus allows for much greater functionality.

The dialog title and icon will use the values from 'getDisplayName()' and 'getSmallIcon()' respectively.

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.

IMPLEMENTED BY THE COMPONENT AUTHOR - This interface is designed to be implemented by the component (bean) author.

Version:
1.0
Author:
Joe Nuxoll
See Also:
Customizer

Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          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.
 java.awt.Component getCustomizerPanel(DesignBean designBean)
          Returns a UI panel (should be lightweight) to be displayed to the user.
 java.beans.PropertyChangeListener[] getPropertyChangeListeners()
          Standard propertyChange events - 'null' property name indicates that the bean changed in some other way than just a property.
 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 listener)
          Standard propertyChange events - 'null' property name indicates that the bean changed in some other way than just a property.
 
Methods inherited from interface com.sun.rave.designtime.DisplayItem
getDescription, getDisplayName, getHelpKey, getLargeIcon, getSmallIcon
 

Method Detail

addPropertyChangeListener


public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
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.

Parameters:
listener - The PropertyChangeListener to add

applyChanges


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

Returns:
A Result object, indicating success or failure, and optionally including messages for the user

getCustomizerPanel


public java.awt.Component getCustomizerPanel(DesignBean designBean)
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.

Parameters:
designBean - the DesignBean to be customized
Returns:
a lightweight panel to display to the user

getPropertyChangeListeners


public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
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.

Returns:
An array of PropertyChangeListener representing all the current listeners

isApplyCapable


public 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). 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.

Returns:
returns true if the customizer is stateful and is capable of handling an apply operation
See Also:
isModified(), applyChanges()

isModified


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

Returns:
returns true if the customizer is in an edited state, false if not

removePropertyChangeListener


public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
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.

Parameters:
listener - The PropertyChangeListener to remove