org.jppf.ui.options
Class AbstractOption

java.lang.Object
  extended by org.jppf.ui.options.AbstractOptionProperties
      extended by org.jppf.ui.options.AbstractOptionElement
          extended by org.jppf.ui.options.AbstractOption
All Implemented Interfaces:
Serializable, Option, OptionElement, OptionProperties
Direct Known Subclasses:
AbstractTreeTableOption, BooleanOption, ButtonOption, ComboBoxOption, FileChooserOption, FillerOption, FormattedNumberOption, JavaOption, LabelOption, ListOption, RadioButtonOption, SpinnerNumberOption, TextAreaOption, TextOption, ToolbarSeparatorOption

public abstract class AbstractOption
extends AbstractOptionElement
implements Option

Default abstract implementation of the Option interface.

Author:
Laurent Cohen
See Also:
Serialized Form

Field Summary
protected  List<ValueChangeListener> listeners
          List of listeners that are notified when the value of this option changes.
protected  boolean persistent
          Determines whether the value of this option should be saved in the user preferences.
protected  Object value
          The value of this option.
 
Fields inherited from class org.jppf.ui.options.AbstractOptionElement
parent, root
 
Fields inherited from class org.jppf.ui.options.AbstractOptionProperties
bordered, componentConstraints, eventsEnabled, finalizer, iconPath, initializer, label, layoutConstraints, name, scripts, scrollable, toolTipText, UIComponent
 
Constructor Summary
AbstractOption()
          Constructor provided as a convenience to facilitate the creation of option elements through reflexion.
 
Method Summary
 void addValueChangeListener(ValueChangeListener listener)
          Add a value change listener to this option's list of listeners.
 void fireValueChanged()
          Notify all registered listeners that the value of this option has changed.
 Object getValue()
          The value of this option.
 boolean isPersistent()
          Determine whether the value of this option should be saved in the user preferences.
protected  JPanel layoutComponents(JComponent comp1, JComponent comp2)
          Layout 2 components according to the specified layout constraints.
protected  JPanel layoutComponents(JComponent comp1, String constraint1, JComponent comp2, String constraint2)
          Layout 2 components according to the specified layout constraints.
 void removeValueChangeListener(ValueChangeListener listener)
          Remove a value change listener from this option's list of listeners.
 void setPersistent(boolean persistent)
          Set whether the value of this option should be saved in the user preferences.
protected abstract  void setupValueChangeNotifications()
          Concrete subclasses must implement this method, so they can properly forward changes in the value edited by the underlying UI component/editor.
 void setValue(Object value)
          Set the value of this option.
 
Methods inherited from class org.jppf.ui.options.AbstractOptionElement
findAll, findAllWithName, findElement, findFirstWithName, findLastWithName, getChildForName, getParent, getPath, getRoot, getStringPath, setParent, toString
 
Methods inherited from class org.jppf.ui.options.AbstractOptionProperties
createUI, getComponentConstraints, getFinalizer, getIconPath, getInitializer, getLabel, getLayoutConstraints, getName, getScripts, getToolTipText, getUIComponent, isBordered, isEventsEnabled, isScrollable, setBordered, setComponentConstraints, setEditable, setEventsEnabled, setFinalizer, setIconPath, setInitializer, setLabel, setLayoutConstraints, setName, setScrollable, setToolTipText, setUIComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jppf.ui.options.OptionElement
findAllWithName, findElement, findFirstWithName, findLastWithName, getParent, getPath, getRoot, getStringPath
 
Methods inherited from interface org.jppf.ui.options.OptionProperties
getComponentConstraints, getFinalizer, getIconPath, getInitializer, getLabel, getLayoutConstraints, getName, getScripts, getToolTipText, getUIComponent, isBordered, isEventsEnabled, isScrollable, setComponentConstraints, setEditable, setEnabled, setEventsEnabled, setLayoutConstraints
 

Field Detail

value

protected Object value
The value of this option.


listeners

protected List<ValueChangeListener> listeners
List of listeners that are notified when the value of this option changes.


persistent

protected boolean persistent
Determines whether the value of this option should be saved in the user preferences.

Constructor Detail

AbstractOption

public AbstractOption()
Constructor provided as a convenience to facilitate the creation of option elements through reflexion.

Method Detail

getValue

public Object getValue()
The value of this option.

Specified by:
getValue in interface Option
Returns:
the value as an Object instance.
See Also:
Option.getValue()

setValue

public void setValue(Object value)
Set the value of this option.

Parameters:
value - the value as an Object instance.

addValueChangeListener

public void addValueChangeListener(ValueChangeListener listener)
Add a value change listener to this option's list of listeners.

Parameters:
listener - the listener to add to the list.

removeValueChangeListener

public void removeValueChangeListener(ValueChangeListener listener)
Remove a value change listener from this option's list of listeners.

Parameters:
listener - the listener to remove from the list.

fireValueChanged

public void fireValueChanged()
Notify all registered listeners that the value of this option has changed.


setupValueChangeNotifications

protected abstract void setupValueChangeNotifications()
Concrete subclasses must implement this method, so they can properly forward changes in the value edited by the underlying UI component/editor.


layoutComponents

protected JPanel layoutComponents(JComponent comp1,
                                  JComponent comp2)
Layout 2 components according to the specified layout constraints.

Parameters:
comp1 - the first component to layout.
comp2 - the second component to layout.
Returns:
a JPanel instance, enclosing the 2 components plus the filler.

layoutComponents

protected JPanel layoutComponents(JComponent comp1,
                                  String constraint1,
                                  JComponent comp2,
                                  String constraint2)
Layout 2 components according to the specified layout constraints.

Parameters:
comp1 - the first component to layout.
constraint1 - the layout constraint for the 1st component.
comp2 - the second component to layout.
constraint2 - the layout constraint for the 2nd component.
Returns:
a JPanel instance, enclosing the 2 components plus the filler.

isPersistent

public boolean isPersistent()
Determine whether the value of this option should be saved in the user preferences.

Specified by:
isPersistent in interface Option
Returns:
true if the value should be saved, false otherwise.
See Also:
Option.isPersistent()

setPersistent

public void setPersistent(boolean persistent)
Set whether the value of this option should be saved in the user preferences.

Parameters:
persistent - true if the value should be saved, false otherwise.


Copyright © 2005-2010 JPPF Team.