com.wirefusion.propertyeditor
Class WfPropertyEditor

java.lang.Object
  extended by com.wirefusion.propertyeditor.WfPropertyEditor
Direct Known Subclasses:
BooleanPropertyEditor, ColorPropertyEditor, ComboBoxPropertyEditor, ComponentPropertyEditor, FilePropertyEditor, LabelPropertyEditor, NumberPropertyEditor, StringPropertyEditor, TextPropertyEditor

public abstract class WfPropertyEditor
extends java.lang.Object

A WfPropertyEditor class provides support for Wobs that want to allow users to edit a property value of a given type. WfPropertyEditor supports a variety of different kinds of ways of displaying and updating property values. Most WfPropertyEditors will only need to support a subset of the different options available in this API.


Field Summary
static int LEFT_POSITION
          Indicates that the label should be to the left of the editor
static int TOP_POSITION
          Indicates that the label should be above the editor
 
Constructor Summary
WfPropertyEditor(java.lang.String propertyId, java.lang.String label)
          Constructs a WFPropertyEditor object.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 void firePropertyChange(java.lang.Object newValue)
          This method should be called when the property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.
abstract  javax.swing.JComponent getEditor()
          Let this method return the property editor.
 java.lang.String getInfoString()
          Subclasses should override this method if a short description of the values that this property can contain is desired.
 java.lang.String getPropertyId()
          Returns the property ID
 boolean isEnabled()
          Returns true if enabled, otherwise false.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void setEnabled(boolean enabled)
          Enables or disables this component, depending on the value of the parameter enabled.
 void setLabelPosition(int labelPosition)
          Specifies if label should be shown above or to the left of the editor.
abstract  void setValue(java.lang.Object newValue)
          Subclasses should change the current property value to the new value sent as a parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_POSITION

public static final int LEFT_POSITION
Indicates that the label should be to the left of the editor

See Also:
Constant Field Values

TOP_POSITION

public static final int TOP_POSITION
Indicates that the label should be above the editor

See Also:
Constant Field Values
Constructor Detail

WfPropertyEditor

public WfPropertyEditor(java.lang.String propertyId,
                        java.lang.String label)
Constructs a WFPropertyEditor object.

Parameters:
propertyId - A unique string that is used to identidy the property.
label - The property label, that will be shown to the left or above the property value/editor.
Method Detail

getInfoString

public java.lang.String getInfoString()
Subclasses should override this method if a short description of the values that this property can contain is desired. The string will be shown as a tooltip text when hoovering the mouse cursor above the editor component.

Returns:
a short description of the property values accepted.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listener will be notified if the property of this class is modified.

Parameters:
listener - the PropertyChangeListener to be added

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list.

Parameters:
listener - the PropertyChangeListener to be removed

firePropertyChange

public void firePropertyChange(java.lang.Object newValue)
This method should be called when the property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

Parameters:
newValue - the property's new value

getPropertyId

public java.lang.String getPropertyId()
Returns the property ID

Returns:
the property ID

setEnabled

public void setEnabled(boolean enabled)
Enables or disables this component, depending on the value of the parameter enabled. If disabled, the ditor does not respond to user input. All subclasses of this class may not support being disabled.

Parameters:
enabled - If true, this editor is enabled; otherwise the editor is disabled.

isEnabled

public boolean isEnabled()
Returns true if enabled, otherwise false.

Returns:
true if enabled, otherwise false

setLabelPosition

public void setLabelPosition(int labelPosition)
Specifies if label should be shown above or to the left of the editor. The allowed values are WFPropertyEditor.LEFT_POSITION and WFPropertyEditor.TOP_POSITION. Default value is WFPropertyEditor.LEFT_POSITION.

Parameters:
labelPosition - the label position relative the editor

setValue

public abstract void setValue(java.lang.Object newValue)
Subclasses should change the current property value to the new value sent as a parameter. The parameter can be assumed to always be of the correct type and can safely be cast to the correct object type.

Parameters:
newValue - a new property value

getEditor

public abstract javax.swing.JComponent getEditor()
Let this method return the property editor. Do not create the editor here (since this method will be called frequently). Create the editor in the constructor instead.

Returns:
The property editor component