y.option
Class OptionHandler

java.lang.Object
  extended by y.option.OptionHandler
All Implemented Interfaces:
ChildChangeReporter, PropertyChangeReporter

public class OptionHandler
extends Object
implements PropertyChangeReporter, ChildChangeReporter

A class that manages a set of parameters.

To get a view component that allows to modify the values interactively, an Editor has to be created. This can be done implicitly by the various showEditor methods or explicitly by instantiating an EditorFactory and using the factory's createEditor method.

Parties interested in PropertyChange or VetoableChange events on option item level can registered appropriate listeners for all option items in the handler via the addChildPropertyChangeListener and addChildVetoableChangeListener methods.

See Also:
EditorFactory, DefaultEditorFactory, TableEditorFactory, Editor, ItemEditor
 

Field Summary
static String ATTRIBUTE_TITLE
          Attribute key used to store a String to be displayed in the title bar of dialogs created by the showEditor methods.
static String ATTRIBUTE_TITLE_KEY
          Attribute key used to store an i18n key to retrieve a localized String to be displayed in the title bar of dialogs created by the showEditor methods.
protected  EditorFactory editorFactory
          The editor factory used constructing the panel.
protected  GuiFactory guiFactory
          The guifactory used for constructing the panel.
static byte OK_APPLY_CANCEL_BUTTONS
          Button mask for the editor dialog.
static byte OK_CANCEL_BUTTONS
          Button mask for the editor dialog.
static byte OK_RESET_APPLY_CANCEL_BUTTONS
          Button mask for the editor dialog.
static byte OK_RESET_CANCEL_BUTTONS
          Button mask for the editor dialog.
protected  OptionsIOHandler optionsIOHandler
          The iohandler used for serializing the values.
 
Constructor Summary
OptionHandler(GuiFactory factory, InputStream is)
          Deprecated. Use the OptionsIOhandler way.
OptionHandler(GuiFactory factory, OptionsIOHandler optionsIOHandler, String name)
          Create a new OptionHandler instance with a given name using the given IOHandler and GUIFactory.
OptionHandler(InputStream is)
          Deprecated. use the OptionsIOhandler way
OptionHandler(String name)
          Create a new OptionHandler instance with a given name, no (default) GuiFactory and no (default) OptionsIOHandler.
 
Method Summary
 OptionItem addBool(String name, boolean value)
          Adds a boolean option item.
 void addChildPropertyChangeListener(PropertyChangeListener pcl)
          Registers a PropertyChangeListener to receive all PropertyChange events from all PropertyChangeReporter children of this reporter.
 void addChildPropertyChangeListener(String pn, PropertyChangeListener pcl)
          Registers a PropertyChangeListener to receive specific PropertyChange events from all PropertyChangeReporter children of this reporter.
 void addChildVetoableChangeListener(String pn, VetoableChangeListener vcl)
          Registers a VetoableChangeListener to receive specific VetoableChange events from all VetoableChangeReporter children of this reporter.
 void addChildVetoableChangeListener(VetoableChangeListener vcl)
          Registers a VetoableChangeListener to receive all VetoableChange events from all VetoableChangeReporter children of this reporter.
 OptionItem addColor(String name, Object value)
          Adds a color option item.
 OptionItem addColor(String name, Object value, boolean showPopup)
          Adds a color option item.
 OptionItem addColor(String name, Object value, boolean showNoColor, boolean showSomeColors, boolean showMostRecentlyUsedColors, boolean showMoreColors)
          Adds a color option item.
 void addComment(String text)
          Adds a commentary text to the option editor.
 void addComment(String text, int fontSize)
          Adds a commentary text to the option editor.
 CommentOptionItem addCommentItem(String text)
          Adds a commentary text to the option editor.
 CommentOptionItem addCommentItem(String text, int fontSize)
          Adds a commentary text to the option editor.
 OptionItem addDouble(String name, double value)
          Adds a double option item.
 OptionItem addDouble(String name, double value, double minValue, double maxValue)
          Adds a double option item that has a lower and upper value bound.
 OptionItem addDouble(String name, double value, double minValue, double maxValue, int precision)
          Like addDouble(String,double,double,double).
 Editor addEditor(Editor editor)
          Adds the specified editor to this handler.
 void addEditorListener(Editor.Listener el)
          Register el so that it will receive notifications when an editor is added or removed.
 EnumOptionItem addEnum(String name)
          Adds an empty enumeration option item.
 EnumOptionItem addEnum(String name, Object[] values, int valueIndex)
          Adds an enumeration option item.
 EnumOptionItem addEnum(String name, Object[] values, Object defaultValue, ListCellRenderer renderer)
          Adds an enumeration option item.
 FileOptionItem addFile(String name, String value)
          Adds a file name option item.
 OptionItem addInt(String name, int value)
          Adds an integer option item.
 OptionItem addInt(String name, int value, int minValue, int maxValue)
          Adds an integer option item that has a lower and upper value bound.
 OptionItem addItem(OptionItem it)
          Adds a generic option item.
 void addOptionHandler(OptionHandler childHandler, String defaultName)
          Adds all the sections of another optionhandler to this one.
 void addPropertyChangeListener(PropertyChangeListener pcl)
          Adds a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(String propertyname, PropertyChangeListener pcl)
          Adds a PropertyChangeListener to the listener list for a specific property.
 OptionItem addString(String name, String value)
          Adds a string option item.
 OptionItem addString(String name, String value, int rowCount)
          Adds a string option item whose text editor has a specific number of rows.
 OptionItem addString(String name, String value, int rowCount, int columnCount)
          Adds a string option item whose text editor has a specific number of rows and columns.
 boolean checkValues()
          Checks if the values in the option editor are valid.
 void clear()
          Removes all sections and option items from this option handler.
 void commitValues()
          Commits all values that were modified with the option editor to the corresponding option items.
 Object get(String name)
          Returns the value of the option item that has the given identifying name.
 Object get(String section, String name)
          Returns the value of an option item.
 Object getAttribute(String name)
          Returns the value of the attribute with the specified name.
 boolean getBool(String name)
          Returns the boolean value of an option item.
 boolean getBool(String section, String name)
          Returns the boolean value of an option item.
static GuiFactory getDefaultGuiFactory()
          Getter for the default GUIFactory.
static OptionsIOHandler getDefaultOptionsIOHandler()
          Getter for the default OptionsIOhandler.
 double getDouble(String name)
          Returns the double value of an option item.
 double getDouble(String section, String name)
          Returns the double value of an option item.
 JComponent getE