org.openbp.jaspira.propertybrowser
Interface PropertyBrowser

All Known Implementing Classes:
PropertyBrowserImpl

public interface PropertyBrowser

Defines the methods an editor for an object must implement. The setObject(Object, boolean) method will be called by the framework when the object is about to be displayed in the editor.
If the user modifies a property of the object, the editor should create a clone of the object. In this case, the getModifiedObject() method should return the modified clone.

Author:
Heiko Erhardt

Method Summary
 void addPropertyBrowserListener(PropertyBrowserListener listener)
          Adds a PropertyBrowserListener to the receiver which notifies the listener of any property change when the firePropertyBrowserEvent(org.openbp.jaspira.propertybrowser.PropertyBrowserEvent) method is called.
 void configureSubComponent(javax.swing.JComponent propertyEditorComponent)
          Configures a property editor component for usage with this property browser.
 void firePropertyBrowserEvent(PropertyBrowserEvent e)
          Notifies all registered PropertyBrowserListener 's registered with the receiver that the property editor has stopped editing the property.
 java.lang.Object getModifiedObject()
          Gets the clone of the edited object that has been modified.
 java.lang.Object getObject()
          Gets the object that is currently edited.
 java.lang.Object getOriginalObject()
          Gets the optional object the 'object' is based upon.
 java.lang.String[] getVisibleMembers()
          Gets the array of property names that should be displayed or null for all.
 void handleKeyEvent(java.awt.event.KeyEvent e)
          Processses a key event.
 boolean isObjectModified()
          Gets the flag used to determine if the original object has changed.
 boolean isObjectNew()
          Gets the flag that determines if the object has just been created.
 boolean isReadOnly()
          Gets wheter the object is read only.
 boolean isSaveImmediately()
          Gets the save after modifying property flag.
 void removePropertyBrowserListener(PropertyBrowserListener listener)
          Removes a PropertyBrowserListener from the receiver.
 boolean reset()
           
 boolean saveObject()
          Save the object.
 void setObject(java.lang.Object object, boolean isObjectNew)
          Sets the object to be displayed/edited.
 void setObject(java.lang.Object object, boolean isObjectNew, MultiIcon rootIcon)
          Sets the object to be displayed/edited.
 void setObject(java.lang.Object object, boolean isObjectNew, ObjectNode rootNode)
          Sets the object to be displayed/edited.
 void setObject(java.lang.Object object, java.lang.Object modifiedObject, boolean isObjectNew, MultiIcon rootIcon)
          Sets the object to be displayed/edited.
 void setObject(java.lang.Object object, java.lang.Object modifiedObject, boolean isObjectNew, MultiIcon rootIcon, ObjectNode rootNode)
          Sets the object to be displayed/edited.
 void setObjectModified(boolean objectModified)
          Sets the flag used to determine if the original object has changed.
 void setObjectNew(boolean isObjectNew)
          Sets the flag that determines if the object has just been created.
 void setOriginalObject(java.lang.Object originalObject)
          Sets the optional object the 'object' is based upon.
 void setReadOnly(boolean readOnly)
          Sets the propertybrowser readonly.
 void setSaveImmediately(boolean saveImmediately)
          Sets the save after modifying property flag.
 void setVisibleMembers(java.lang.String[] visibleMembers)
          Sets the array of property names that should be displayed or null for all.
 

Method Detail

setObject

void setObject(java.lang.Object object,
               boolean isObjectNew)
               throws XMLDriverException,
                      java.lang.CloneNotSupportedException
Sets the object to be displayed/edited.

Parameters:
object - The object to edit or null
isObjectNew - Flag that determines if the object has just been created
Throws:
XMLDriverException - If no object descriptor could be found for the specified object
java.lang.CloneNotSupportedException - If the object is not cloneable

setObject

void setObject(java.lang.Object object,
               boolean isObjectNew,
               ObjectNode rootNode)
               throws XMLDriverException,
                      java.lang.CloneNotSupportedException
Sets the object to be displayed/edited.

Parameters:
object - The object to edit or null
isObjectNew - Flag that determines if the object has just been created
rootNode - Root node of the property browser tree or null if the property browser should create an appropriate property browser tree based on the class of the object
Throws:
XMLDriverException - If no object descriptor could be found for the specified object
java.lang.CloneNotSupportedException - If the object is not cloneable

setObject

void setObject(java.lang.Object object,
               boolean isObjectNew,
               MultiIcon rootIcon)
               throws XMLDriverException,
                      java.lang.CloneNotSupportedException
Sets the object to be displayed/edited. The class of the object will be used to determine the object descriptor from.

Parameters:
object - Object to edit
isObjectNew - Flag that determines if the object has just been created
rootIcon - Image of the root node
Throws:
XMLDriverException - If no object descriptor could be found for the specified object
java.lang.CloneNotSupportedException

setObject

void setObject(java.lang.Object object,
               java.lang.Object modifiedObject,
               boolean isObjectNew,
               MultiIcon rootIcon)
               throws XMLDriverException,
                      java.lang.CloneNotSupportedException
Sets the object to be displayed/edited. The class of the object will be used to determine the object descriptor from.

Parameters:
object - Object to edit
modifiedObject - The modified Object
isObjectNew - Flag that determines if the object has just been created
rootIcon - Image of the root node
Throws:
XMLDriverException - If no object descriptor could be found for the specified object
java.lang.CloneNotSupportedException

setObject

void setObject(java.lang.Object object,
               java.lang.Object modifiedObject,
               boolean isObjectNew,
               MultiIcon rootIcon,
               ObjectNode rootNode)
               throws XMLDriverException,
                      java.lang.CloneNotSupportedException
Sets the object to be displayed/edited. The class of the object will be used to determine the object descriptor from.

Parameters:
object - Object to edit
modifiedObject - The modified Object
isObjectNew - Flag that determines if the object has just been created
rootIcon - Image of the root node
rootNode - Root node of the property browser tree or null if the property browser should create an appropriate property browser tree based on the class of the object
Throws:
XMLDriverException - If no object descriptor could be found for the specified object
java.lang.CloneNotSupportedException

getObject

java.lang.Object getObject()
Gets the object that is currently edited.

Returns:
The object that is currently edited or null

getModifiedObject

java.lang.Object getModifiedObject()
Gets the clone of the edited object that has been modified. The clone is usually a first-level clone (see the Copyable class).

Returns:
The modified object or null if nothing has been changed

getOriginalObject

java.lang.Object getOriginalObject()
Gets the optional object the 'object' is based upon. This is used for name uniqueness checks by the model object validator if the object passed to the property browser has been cloned. Since the property browser clones the given object once more (into the modifiedObject) we loose the reference to the original. originalObject will refer the non-cloned original.

Returns:
The modified object or null if there is no original

setOriginalObject

void setOriginalObject(java.lang.Object originalObject)
Sets the optional object the 'object' is based upon. This is used for name uniqueness checks by the model object validator if the object passed to the property browser has been cloned. Since the property browser clones the given object once more (into the modifiedObject) we loose the reference to the original. originalObject will refer the non-cloned original.

Parameters:
originalObject - The modified object or null if there is no original

isObjectModified

boolean isObjectModified()
Gets the flag used to determine if the original object has changed.


setObjectModified

void setObjectModified(boolean objectModified)
Sets the flag used to determine if the original object has changed.


isObjectNew

boolean isObjectNew()
Gets the flag that determines if the object has just been created.


setObjectNew

void setObjectNew(boolean isObjectNew)
Sets the flag that determines if the object has just been created.


saveObject

boolean saveObject()
Save the object.

Returns:
true The object has been successfully saved or the change was discarded
false The object has not been saved, return

reset

boolean reset()
See Also:
reset()

addPropertyBrowserListener

void addPropertyBrowserListener(PropertyBrowserListener listener)
Adds a PropertyBrowserListener to the receiver which notifies the listener of any property change when the firePropertyBrowserEvent(org.openbp.jaspira.propertybrowser.PropertyBrowserEvent) method is called.

Parameters:
listener - Listener to add

removePropertyBrowserListener

void removePropertyBrowserListener(PropertyBrowserListener listener)
Removes a PropertyBrowserListener from the receiver.

Parameters:
listener - Listener to remove

firePropertyBrowserEvent

void firePropertyBrowserEvent(PropertyBrowserEvent e)
Notifies all registered PropertyBrowserListener 's registered with the receiver that the property editor has stopped editing the property.

Parameters:
e - Event

handleKeyEvent

void handleKeyEvent(java.awt.event.KeyEvent e)
Processses a key event.

Parameters:
e - Event

configureSubComponent

void configureSubComponent(javax.swing.JComponent propertyEditorComponent)
Configures a property editor component for usage with this property browser.

Parameters:
propertyEditorComponent - Property editor component

setReadOnly

void setReadOnly(boolean readOnly)
Sets the propertybrowser readonly.


isReadOnly

boolean isReadOnly()
Gets wheter the object is read only.


isSaveImmediately

boolean isSaveImmediately()
Gets the save after modifying property flag.


setSaveImmediately

void setSaveImmediately(boolean saveImmediately)
Sets the save after modifying property flag.


getVisibleMembers

java.lang.String[] getVisibleMembers()
Gets the array of property names that should be displayed or null for all. This can be used to limit the number of properties that are displayed for complex objects.


setVisibleMembers

void setVisibleMembers(java.lang.String[] visibleMembers)
Sets the array of property names that should be displayed or null for all. This can be used to limit the number of properties that are displayed for complex objects.



Copyright © 2011. All Rights Reserved.