Search this API

y.option
Class OptionHandler

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

public class OptionHandler
extends java.lang.Object
implements AttributeOwner, 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 java.lang.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 java.lang.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 gui factory 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 io handler used for serializing the values.
 
Constructor Summary
OptionHandler(GuiFactory factory, java.io.InputStream is)
          Deprecated. Use the OptionsIOhandler way.
OptionHandler(GuiFactory factory, OptionsIOHandler optionsIOHandler, java.lang.String name)
          Create a new OptionHandler instance with a given name using the given IOHandler and GUIFactory.
OptionHandler(java.io.InputStream is)
          Deprecated. use the OptionsIOhandler way
OptionHandler(java.lang.String name)
          Create a new OptionHandler instance with a given name, no (default) GuiFactory and no (default) OptionsIOHandler.
 
Method Summary
 OptionItem addBool(java.lang.String name, boolean value)
          Adds a boolean option item.
 void addChildPropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Registers a PropertyChangeListener to receive all PropertyChange events from all PropertyChangeReporter children of this reporter.
 void addChildPropertyChangeListener(java.lang.String pn, java.beans.PropertyChangeListener pcl)
          Registers a PropertyChangeListener to receive specific PropertyChange events from all PropertyChangeReporter children of this reporter.
 void addChildVetoableChangeListener(java.lang.String pn, java.beans.VetoableChangeListener vcl)
          Registers a VetoableChangeListener to receive specific VetoableChange events from all VetoableChangeReporter children of this reporter.
 void addChildVetoableChangeListener(java.beans.VetoableChangeListener vcl)
          Registers a VetoableChangeListener to receive all VetoableChange events from all VetoableChangeReporter children of this reporter.
 OptionItem addColor(java.lang.String name, java.lang.Object value)
          Adds a color option item.
 OptionItem addColor(java.lang.String name, java.lang.Object value, boolean showPopup)
          Adds a color option item.
 OptionItem addColor(java.lang.String name, java.lang.Object value, boolean showNoColor, boolean showSomeColors, boolean showMostRecentlyUsedColors, boolean showMoreColors)
          Adds a color option item.
 void addComment(java.lang.String text)
          Adds a commentary text to the option editor.
 void addComment(java.lang.String text, int fontSize)
          Adds a commentary text to the option editor.
 CommentOptionItem addCommentItem(java.lang.String text)
          Adds a commentary text to the option editor.
 CommentOptionItem addCommentItem(java.lang.String text, int fontSize)
          Adds a commentary text to the option editor.
 OptionItem addDouble(java.lang.String name, double value)
          Adds a double option item.
 OptionItem addDouble(java.lang.String name, double value, double minValue, double maxValue)
          Adds a double option item that has a lower and upper value bound.
 OptionItem addDouble(java.lang.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(java.lang.String name)
          Adds an empty enumeration option item.
 EnumOptionItem addEnum(java.lang.String name, java.lang.Object[] values, int valueIndex)
          Adds an enumeration option item.
 EnumOptionItem addEnum(java.lang.String name, java.lang.Object[] values, java.lang.Object defaultValue, javax.swing.ListCellRenderer renderer)
          Adds an enumeration option item.
 FileOptionItem addFile(java.lang.String name, java.lang.String value)
          Adds a file name option item.
 OptionItem addInt(java.lang.String name, int value)
          Adds an integer option item.
 OptionItem addInt(java.lang.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, java.lang.String defaultName)
          Adds all the sections of another option handler to this one.
 void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Adds a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(java.lang.String propertyname, java.beans.PropertyChangeListener pcl)
          Adds a PropertyChangeListener to the listener list for a specific property.
 OptionItem addString(java.lang.String name, java.lang.String value)
          Adds a string option item.
 OptionItem addString(java.lang.String name, java.lang.String value, int rowCount)
          Adds a string option item whose text editor has a specific number of rows.
 OptionItem addString(java.lang.String name, java.lang.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.
 java.lang.Object get(java.lang.String name)
          Returns the value of the option item that has the given identifying name.
 java.lang.Object get(java.lang.String section, java.lang.String name)
          Returns the value of an option item.
 java.lang.Object getAttribute(java.lang.String name)
          Returns the value of the attribute with the specified name.
 boolean getBool(java.lang.String name)
          Returns the boolean value of an option item.
 boolean getBool(java.lang.String section, java.lang.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(java.lang.String name)
          Returns the double value of an option item.
 double getDouble(java.lang.String section, java.lang.String name)
          Returns the double value of an option item.
 javax.swing.JComponent getEditor()
          Deprecated. Use EditorFactory.createEditor(y.option.OptionHandler) instead.
 EditorFactory getEditorFactory()
          Returns the editor factory.
 java.util.List getEditors()
          Returns a list of all the editors that were added to the OptionHandler with addEditor(y.option.Editor).
 int getEnum(java.lang.String name)
          Returns the index value of an enumeration item.
 int getEnum(java.lang.String section, java.lang.String name)
          Returns the index value of an enumeration item.
 GuiFactory getGuiFactory()
          Getter for property guiFactory.
static byte getIndex(java.lang.Object[] values, java.lang.Object value)
          Returns the index for the given array at which the given value is found.
 int getInt(java.lang.String name)
          Returns the integer value of an option item.
 int getInt(java.lang.String section, java.lang.String name)
          Returns the integer value of an option item.
 OptionItem getItem(java.lang.String name)
          Returns the option item that has the given identifying name.
 OptionItem getItem(java.lang.String section, java.lang.String name)
          Returns the option item found in the given section under the given name.
 java.lang.String getName()
          Returns the name of the option handler.
 OptionsIOHandler getOptionsIOHandler()
          Getter for property OptionsIOHandler.
static java.util.List getRegisteredOptionHandlers()
          This method returns a list of all non-garbage collected instances of OptionHandlers, which have been instantiated during this session.
 java.lang.String getString(java.lang.String name)
          Returns the String value of an option item.
 java.lang.String getString(java.lang.String section, java.lang.String name)
          Returns the String value of an option item.
 java.lang.String getStringValue(java.lang.String section, java.lang.String name)
          Returns the stringified value of an option item.
static void installDefaultGuiFactory(GuiFactory guiFactory)
          Static method to install a default GUIFactory for all option handlers, which will be used if no specific GUIFactory is provided for each instance.
static void installDefaultOptionsIOHandler(OptionsIOHandler optionsIOHandler)
          Static method to install a default IOHandler for all option handlers, which will be used if no specific instance is provided for each instance.
 boolean read()
          Reads in the values for the items from the installed IOHandler.
 boolean read(OptionsIOHandler ioh)
          Reads in the values for the items from the given IOHandler.
 void removeAttribute(java.lang.String name)
          Removes the attribute with the specified name.
 void removeChildPropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Unregisters a PropertyChangeListener, that received all PropertyChange events from PropertyChangeReporter children of this reporter.
 void removeChildPropertyChangeListener(java.lang.String pn, java.beans.PropertyChangeListener pcl)
          Unregisters a PropertyChangeListener, that received specific PropertyChange events from PropertyChangeReporter children of this reporter.
 void removeChildVetoableChangeListener(java.lang.String pn, java.beans.VetoableChangeListener vcl)
          Unregisters a VetoableChangeListener, that received specific VetoableChange events from VetoableChangeReporter children of this reporter.
 void removeChildVetoableChangeListener(java.beans.VetoableChangeListener vcl)
          Unregisters a VetoableChangeListener, that received all VetoableChange events from VetoableChangeReporter children of this reporter.
 void removeEditor(Editor editor)
          Removes the specified editor from this handler.
 void removeEditorListener(Editor.Listener el)
          Unregister el so that it will no longer receive notifications when an editor is added or removed.
 void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Removes a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(java.lang.String propertyname, java.beans.PropertyChangeListener pcl)
          Removes a PropertyChangeListener from the listener list for a specific property.
 void resetValues()
          Resets all option values to their original settings.
 OptionSection section(int index)
          Returns the option section at position index.
 OptionSection section(java.lang.String name)
          Returns the option section that has the given name.
 int sectionCount()
          Returns the number of sections of this option handler.
 void set(java.lang.String name, java.lang.Object value)
          Sets the value for the option that has the given name.
 void set(java.lang.String section, java.lang.String name, java.lang.Object value)
          Sets the value for the option that has the given name in the given section.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Sets an arbitrary attribute with the specified name and value.
 void setEditorFactory(EditorFactory editorFactory)
          Sets the editor factory.
 void setGuiFactory(GuiFactory guiFactory)
          Setter for property guiFactory.
 void setName(java.lang.String name)
          Sets the name of the option handler.
 void setOptionsIOHandler(OptionsIOHandler optionsIOHandler)
          Setter for property OptionsIOHandler.
 void setPreferredEditorWidth(int width)
          Sets the preferred width of the option editor.
 void setStringValue(java.lang.String section, java.lang.String name, java.lang.String value)
          Sets the value for the option that has the given name in the given section.
 boolean showEditor()
          Displays the editor for this option handler as a modal dialog window.
 boolean showEditor(java.awt.Frame frame)
          Displays the editor for this option handler as a modal dialog window.
 boolean showEditor(java.awt.Frame frame, byte buttonMask)
          Displays the editor for this option handler as a modal dialog window.
 java.lang.String toString()
          Returns a String that contains what would be written out by write(OutputStream).
 OptionSection useSection(java.lang.String name)
          Switch to specific section.
 void write(OptionsIOHandler ioh)
          Writes out the values from the items to the given IOHandler.
 void write(java.io.OutputStream os)
          Deprecated. use the OptionsIOhandler way
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OK_RESET_CANCEL_BUTTONS

public static final byte OK_RESET_CANCEL_BUTTONS
Button mask for the editor dialog. Adds an OK button, a Reset button and a Cancel button.

See Also:
Constant Field Values

OK_APPLY_CANCEL_BUTTONS

public static final byte OK_APPLY_CANCEL_BUTTONS
Button mask for the editor dialog. Adds an OK button, an Apply button, and a Cancel button.

See Also:
Constant Field Values

OK_CANCEL_BUTTONS

public static final byte OK_CANCEL_BUTTONS
Button mask for the editor dialog. Adds an OK button and a Cancel button.

See Also:
Constant Field Values

OK_RESET_APPLY_CANCEL_BUTTONS

public static final byte OK_RESET_APPLY_CANCEL_BUTTONS
Button mask for the editor dialog. Adds an OK button, a Reset button, an Apply button, and a Cancel button.

See Also:
Constant Field Values

ATTRIBUTE_TITLE

public static final java.lang.String ATTRIBUTE_TITLE
Attribute key used to store a String to be displayed in the title bar of dialogs created by the showEditor methods.

See Also:
showEditor(), showEditor(java.awt.Frame), showEditor(java.awt.Frame,byte), Constant Field Values

ATTRIBUTE_TITLE_KEY

public static final java.lang.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.

See Also:
showEditor(), showEditor(java.awt.Frame), showEditor(java.awt.Frame,byte), Constant Field Values

guiFactory

protected GuiFactory guiFactory
The gui factory used for constructing the panel.


optionsIOHandler

protected OptionsIOHandler optionsIOHandler
The io handler used for serializing the values.


editorFactory

protected EditorFactory editorFactory
The editor factory used constructing the panel.

Constructor Detail

OptionHandler

public OptionHandler(java.lang.String name)
Create a new OptionHandler instance with a given name, no (default) GuiFactory and no (default) OptionsIOHandler. The handler will be registered and added to the list of all active OptionHandlers.


OptionHandler

public OptionHandler(GuiFactory factory,
                     OptionsIOHandler optionsIOHandler,
                     java.lang.String name)
Create a new OptionHandler instance with a given name using the given IOHandler and GUIFactory. The handler will be registered and added to the list of all active OptionHandlers.

Parameters:
factory - the default factory
optionsIOHandler -
name - the name of the OptionHandler

OptionHandler

public OptionHandler(java.io.InputStream is)
Deprecated. use the OptionsIOhandler way

Creates a new OptionHandler from an input stream. The input stream must provide access to a option handler format as created by write(OutputStream).


OptionHandler

public OptionHandler(GuiFactory factory,
                     java.io.InputStream is)
Deprecated. Use the OptionsIOhandler way.

Creates a new OptionHandler from an input stream. The input stream must provide access to a option handler format as created by write(OutputStream).

Parameters:
factory - the default factory
is -
Method Detail

installDefaultGuiFactory

public static void installDefaultGuiFactory(GuiFactory guiFactory)
Static method to install a default GUIFactory for all option handlers, which will be used if no specific GUIFactory is provided for each instance.

Parameters:
guiFactory - the default factory

installDefaultOptionsIOHandler

public static void installDefaultOptionsIOHandler(OptionsIOHandler optionsIOHandler)
Static method to install a default IOHandler for all option handlers, which will be used if no specific instance is provided for each instance.

Parameters:
optionsIOHandler - the default handler

getDefaultOptionsIOHandler

public static OptionsIOHandler getDefaultOptionsIOHandler()
Getter for the default OptionsIOhandler.

Returns:
the current default

getDefaultGuiFactory

public static GuiFactory getDefaultGuiFactory()
Getter for the default GUIFactory.

Returns:
the current default

getRegisteredOptionHandlers

public static java.util.List getRegisteredOptionHandlers()
This method returns a list of all non-garbage collected instances of OptionHandlers, which have been instantiated during this session. If multiple handlers with the same name have been instantiated, only the last one will be returned.

Returns:
a list of OptionHandlers

getIndex

public static byte getIndex(java.lang.Object[] values,
                            java.lang.Object value)
Returns the index for the given array at which the given value is found. If the value is not found at all -1 is returned. Convenience method for enumeration option items.


setName

public void setName(java.lang.String name)
Sets the name of the option handler.


getName

public java.lang.String getName()
Returns the name of the option handler.


getEditorFactory

public EditorFactory getEditorFactory()
Returns the editor factory.

Returns:
the editor factory

setEditorFactory

public void setEditorFactory(EditorFactory editorFactory)
Sets the editor factory.

Parameters:
editorFactory - the EditorFactory instance.

addFile

public FileOptionItem addFile(java.lang.String name,
                              java.lang.String value)
Adds a file name option item.

Parameters:
name - the identifier of this option
value - the initial path to the file

addInt

public OptionItem addInt(java.lang.String name,
                         int value)
Adds an integer option item.

Parameters:
name - the identifier of this option
value - the initial value of the option

addInt

public OptionItem addInt(java.lang.String name,
                         int value,
                         int minValue,
                         int maxValue)
Adds an integer option item that has a lower and upper value bound.

Parameters:
name - the identifier of this option
value - the initial value of the option
minValue - the minimal value of the option
maxValue - the maximal value of the option

addDouble

public OptionItem addDouble(java.lang.String name,
                            double value)
Adds a double option item.

Parameters:
name - the identifier of this option
value - the initial value of the option

addDouble

public OptionItem addDouble(java.lang.String name,
                            double value,
                            double minValue,
                            double maxValue)
Adds a double option item that has a lower and upper value bound.

Parameters:
name - the identifier of this option
value - the initial value of the option
minValue - the minimal value of the option
maxValue - the maximal value of the option

addDouble

public OptionItem addDouble(java.lang.String name,
                            double value,
                            double minValue,
                            double maxValue,
                            int precision)
Like addDouble(String,double,double,double). Additionally the precision of the double can be specified as the number of decimal places.


addEnum

public EnumOptionItem addEnum(java.lang.String name,
                              java.lang.Object[] values,
                              int valueIndex)
Adds an enumeration option item.

Parameters:
name - the identifier of this option
values - an array that holds all possible values for this item.
valueIndex - the array index of the initial value.

addEnum

public EnumOptionItem addEnum(java.lang.String name)
Adds an empty enumeration option item.

Parameters:
name - the identifier of this option

addEnum

public EnumOptionItem addEnum(java.lang.String name,
                              java.lang.Object[] values,
                              java.lang.Object defaultValue,
                              javax.swing.ListCellRenderer renderer)
Adds an enumeration option item.

Parameters:
name - the identifier of this option
values - an array that holds all possible values for this item
defaultValue - the initial value chosen (must be found in enum!)
renderer - The renderer being used in the editor component to display the values of the enumeration.

addBool

public OptionItem addBool(java.lang.String name,
                          boolean value)
Adds a boolean option item.

Parameters:
name - the identifier of this option
value - the initial value of the option

addItem

public OptionItem addItem(OptionItem it)
Adds a generic option item. This method can be used to home cooked option items

Parameters:
it - an option item.

addString

public OptionItem addString(java.lang.String name,
                            java.lang.String value)
Adds a string option item.

Parameters:
name - the identifier of this option
value - the initial value of the option

addString

public OptionItem addString(java.lang.String name,
                            java.lang.String value,
                            int rowCount)
Adds a string option item whose text editor has a specific number of rows.

Parameters:
name - the identifier of this option
value - the initial value of the option
rowCount - the number of rows of the text editor

addString

public OptionItem addString(java.lang.String name,
                            java.lang.String value,
                            int rowCount,
                            int columnCount)
Adds a string option item whose text editor has a specific number of rows and columns.

Parameters:
name - the identifier of this option
value - the initial value of the option
rowCount - the number of rows of the text editor
columnCount - the number of columns of the text editor

addColor

public OptionItem addColor(java.lang.String name,
                           java.lang.Object value)
Adds a color option item.

Parameters:
name - the identifier of this option
value - the initial value of the option

addColor

public OptionItem addColor(java.lang.String name,
                           java.lang.Object value,
                           boolean showPopup)
Adds a color option item.

Parameters:
name - the identifier of this option
value - the initial value of the option

addColor

public OptionItem addColor(java.lang.String name,
                           java.lang.Object value,
                           boolean showNoColor,
                           boolean showSomeColors,
                           boolean showMostRecentlyUsedColors,
                           boolean showMoreColors)
Adds a color option item.

Parameters:
name - the identifier of this option
value - the initial value of the option

addComment

public void addComment(java.lang.String text,
                       int fontSize)
Adds a commentary text to the option editor.

Parameters:
text - the text of the comment
fontSize - the size of the text font used
See Also:
addCommentItem(String,int)

addComment

public void addComment(java.lang.String text)
Adds a commentary text to the option editor.

Parameters:
text - the text of the comment
See Also:
addCommentItem(String)

addCommentItem

public CommentOptionItem addCommentItem(java.lang.String text,
                                        int fontSize)
Adds a commentary text to the option editor.

Parameters:
text - the text of the comment
fontSize - the size of the text font used
Returns:
the item created

addCommentItem

public CommentOptionItem addCommentItem(java.lang.String text)
Adds a commentary text to the option editor.

Parameters:
text - the text of the comment
Returns:
the item created

addOptionHandler

public void addOptionHandler(OptionHandler childHandler,
                             java.lang.String defaultName)
Adds all the sections of another option handler to this one.


set

public void set(java.lang.String name,
                java.lang.Object value)
Sets the value for the option that has the given name.


set

public void set(java.lang.String section,
                java.lang.String name,
                java.lang.Object value)
Sets the value for the option that has the given name in the given section.


setStringValue

public void setStringValue(java.lang.String section,
                           java.lang.String name,
                           java.lang.String value)
Sets the value for the option that has the given name in the given section.


getInt

public int getInt(java.lang.String section,
                  java.lang.String name)
Returns the integer value of an option item.

Parameters:
section - the name of the section where the item resides
name - the identifying name of the item

getInt

public int getInt(java.lang.String name)
Returns the integer value of an option item.

Parameters:
name - the identifying name of the item

getDouble

public double getDouble(java.lang.String section,
                        java.lang.String name)
Returns the double value of an option item.

Parameters:
section - the name of the section where the item resides
name - the identifying name of the item

getDouble

public double getDouble(java.lang.String name)
Returns the double value of an option item.

Parameters:
name - the identifying name of the item

getBool

public boolean getBool(java.lang.String name)
Returns the boolean value of an option item.

Parameters:
name - the identifying name of the item

getBool

public boolean getBool(java.lang.String section,
                       java.lang.String name)
Returns the boolean value of an option item.

Parameters:
section - the name of the section where the item resides
name - the identifying name of the item

getString

public java.lang.String getString(java.lang.String name)
Returns the String value of an option item.

Parameters:
name - the identifying name of the item

getString

public java.lang.String getString(java.lang.String section,
                                  java.lang.String name)
Returns the String value of an option item.

Parameters:
section - the name of the section where the item resides
name - the identifying name of the item

getEnum

public int getEnum(java.lang.String name)
Returns the index value of an enumeration item.

Parameters:
name - the identifying name of the item

getEnum

public int getEnum(java.lang.String section,
                   java.lang.String name)
Returns the index value of an enumeration item.

Parameters:
section - the name of the section where the item resides
name - the identifying name of the item

get

public java.lang.Object get(java.lang.String section,
                            java.lang.String name)
Returns the value of an option item.

Parameters:
section - the name of the section where the item resides
name - the identifying name of the item

getStringValue

public java.lang.String getStringValue(java.lang.String section,
                                       java.lang.String name)
Returns the stringified value of an option item.

Parameters:
section - the name of the section where the item resides
name - the identifying name of the item

getItem

public OptionItem getItem(java.lang.String section,
                          java.lang.String name)
Returns the option item found in the given section under the given name.


get

public java.lang.Object get(java.lang.String name)
Returns the value of the option item that has the given identifying name.


getItem

public OptionItem getItem(java.lang.String name)
Returns the option item that has the given identifying name.


setPreferredEditorWidth

public void setPreferredEditorWidth(int width)
Sets the preferred width of the option editor.


clear

public void clear()
Removes all sections and option items from this option handler.


useSection

public OptionSection useSection(java.lang.String name)
Switch to specific section. When a new option is inserted, and the section name is not provided, it is inserted in this section. When no section with this names exists a new one with that name will be created.


section

public OptionSection section(int index)
Returns the option section at position index. The first section has the index 0.


sectionCount

public int sectionCount()
Returns the number of sections of this option handler.


section

public OptionSection section(java.lang.String name)
Returns the option section that has the given name.


showEditor

public boolean showEditor()
Displays the editor for this option handler as a modal dialog window. It uses OK_RESET_CANCEL_BUTTONS as button mask.


showEditor

public boolean showEditor(java.awt.Frame frame)
Displays the editor for this option handler as a modal dialog window. It uses OK_RESET_CANCEL_BUTTONS as button mask.

Parameters:
frame - centers the dialog relative to this frame

showEditor

public boolean showEditor(java.awt.Frame frame,
                          byte buttonMask)
Displays the editor for this option handler as a modal dialog window.

Parameters:
frame - centers the dialog relative to this frame
buttonMask - the button layout and functionality for the dialog.

getEditor

public javax.swing.JComponent getEditor()
Deprecated. Use EditorFactory.createEditor(y.option.OptionHandler) instead.

Returns the editor component of this option handler.


commitValues

public void commitValues()
Commits all values that were modified with the option editor to the corresponding option items.


checkValues

public boolean checkValues()
Checks if the values in the option editor are valid.


resetValues

public void resetValues()
Resets all option values to their original settings.


addChildPropertyChangeListener

public void addChildPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Description copied from interface: ChildChangeReporter
Registers a PropertyChangeListener to receive all PropertyChange events from all PropertyChangeReporter children of this reporter.

Specified by:
addChildPropertyChangeListener in interface ChildChangeReporter
Parameters:
pcl - the PropertyChangeListener to be registered

removeChildPropertyChangeListener

public void removeChildPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Description copied from interface: ChildChangeReporter
Unregisters a PropertyChangeListener, that received all PropertyChange events from PropertyChangeReporter children of this reporter.

Specified by:
removeChildPropertyChangeListener in interface ChildChangeReporter
Parameters:
pcl - the PropertyChangeListener to be unregistered

addChildPropertyChangeListener

public void addChildPropertyChangeListener(java.lang.String pn,
                                           java.beans.PropertyChangeListener pcl)
Description copied from interface: ChildChangeReporter
Registers a PropertyChangeListener to receive specific PropertyChange events from all PropertyChangeReporter children of this reporter.

Specified by:
addChildPropertyChangeListener in interface ChildChangeReporter
Parameters:
pn - the name of the property to listen on
pcl - the PropertyChangeListener to be registered

removeChildPropertyChangeListener

public void removeChildPropertyChangeListener(java.lang.String pn,
                                              java.beans.PropertyChangeListener pcl)
Description copied from interface: ChildChangeReporter
Unregisters a PropertyChangeListener, that received specific PropertyChange events from PropertyChangeReporter children of this reporter.

Specified by:
removeChildPropertyChangeListener in interface ChildChangeReporter
Parameters:
pn - the name of the property that was listened on
pcl - the PropertyChangeListener to be unregistered

addChildVetoableChangeListener

public void addChildVetoableChangeListener(java.beans.VetoableChangeListener vcl)
Description copied from interface: ChildChangeReporter
Registers a VetoableChangeListener to receive all VetoableChange events from all VetoableChangeReporter children of this reporter.

Specified by:
addChildVetoableChangeListener in interface ChildChangeReporter
Parameters:
vcl - the VetoableChangeListener to be registered

removeChildVetoableChangeListener

public void removeChildVetoableChangeListener(java.beans.VetoableChangeListener vcl)
Description copied from interface: ChildChangeReporter
Unregisters a VetoableChangeListener, that received all VetoableChange events from VetoableChangeReporter children of this reporter.

Specified by:
removeChildVetoableChangeListener in interface ChildChangeReporter
Parameters:
vcl - the VetoableChangeListener to be unregistered

addChildVetoableChangeListener

public void addChildVetoableChangeListener(java.lang.String pn,
                                           java.beans.VetoableChangeListener vcl)
Description copied from interface: ChildChangeReporter
Registers a VetoableChangeListener to receive specific VetoableChange events from all VetoableChangeReporter children of this reporter.

Specified by:
addChildVetoableChangeListener in interface ChildChangeReporter
Parameters:
pn - the name of the property to listen on
vcl - the VetoableChangeListener to be registered

removeChildVetoableChangeListener

public void removeChildVetoableChangeListener(java.lang.String pn,
                                              java.beans.VetoableChangeListener vcl)
Description copied from interface: ChildChangeReporter
Unregisters a VetoableChangeListener, that received specific VetoableChange events from VetoableChangeReporter children of this reporter.

Specified by:
removeChildVetoableChangeListener in interface ChildChangeReporter
Parameters:
pn - the name of the property that was listened on
vcl - the VetoableChangeListener to be unregistered

write

public void write(java.io.OutputStream os)
Deprecated. use the OptionsIOhandler way

Writes out this option handler in an XML like format.


toString

public java.lang.String toString()
Returns a String that contains what would be written out by write(OutputStream).

Overrides:
toString in class java.lang.Object

read

public boolean read(OptionsIOHandler ioh)
Reads in the values for the items from the given IOHandler.

Parameters:
ioh - the ioHandler to write to
Returns:
whether the reading was successful

read

public boolean read()
Reads in the values for the items from the installed IOHandler.

Returns:
whether the reading was successful

write

public void write(OptionsIOHandler ioh)
Writes out the values from the items to the given IOHandler.

Parameters:
ioh - the io handler to use

getGuiFactory

public GuiFactory getGuiFactory()
Getter for property guiFactory.

Returns:
Value of property guiFactory.

setGuiFactory

public void setGuiFactory(GuiFactory guiFactory)
Setter for property guiFactory.

Parameters:
guiFactory - new value of property guiFactory.

getOptionsIOHandler

public OptionsIOHandler getOptionsIOHandler()
Getter for property OptionsIOHandler.

Returns:
Value of property OptionsIOHandler.

setOptionsIOHandler

public void setOptionsIOHandler(OptionsIOHandler optionsIOHandler)
Setter for property OptionsIOHandler.

Parameters:
optionsIOHandler - new value of property OptionsIOHandler.

addEditor

public Editor addEditor(Editor editor)
Adds the specified editor to this handler.
Note: Editors are referenced using WeakReferences.

Parameters:
editor - the editor to be added
Returns:
the editor argument
See Also:
WeakReference

removeEditor

public void removeEditor(Editor editor)
Removes the specified editor from this handler.

Parameters:
editor - the editor to be removed

getEditors

public java.util.List getEditors()
Returns a list of all the editors that were added to the OptionHandler with addEditor(y.option.Editor).

Returns:
a list of all the editors that were added to the OptionHandler with addEditor(y.option.Editor).

addEditorListener

public void addEditorListener(Editor.Listener el)
Register el so that it will receive notifications when an editor is added or removed.


removeEditorListener

public void removeEditorListener(Editor.Listener el)
Unregister el so that it will no longer receive notifications when an editor is added or removed.


getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Returns the value of the attribute with the specified name.

Specified by:
getAttribute in interface AttributeOwner
Parameters:
name - the name of the attribute being queried
Returns:
the value of the attribute with the specified name

removeAttribute

public void removeAttribute(java.lang.String name)
Removes the attribute with the specified name.
Removing an attribute is reported with PropertyChange events.

Specified by:
removeAttribute in interface AttributeOwner
Parameters:
name - the name of the attribute being removed

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Sets an arbitrary attribute with the specified name and value.

If value is null, this method will remove the attribute.
Setting an attribute is reported with PropertyChange events.

Specified by:
setAttribute in interface AttributeOwner
Parameters:
name - the name of the attribute being added
value - the value of the attribute being added

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Adds a PropertyChangeListener to the listener list. The listener is registered for all bound properties of this class.

If listener is null, no exception is thrown and no action is performed.

Specified by:
addPropertyChangeListener in interface PropertyChangeReporter
Parameters:
pcl - the PropertyChangeListener to be added
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener), addPropertyChangeListener(String,java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Removes a PropertyChangeListener from the listener list. This method should be used to remove the PropertyChangeListeners that were registered for all bound properties of this class.

If listener is null, no exception is thrown and no action is performed.

Specified by:
removePropertyChangeListener in interface PropertyChangeReporter
Parameters:
pcl - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), removePropertyChangeListener(String,java.beans.PropertyChangeListener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyname,
                                      java.beans.PropertyChangeListener pcl)
Adds a PropertyChangeListener to the listener list for a specific property.

If listener is null, no exception is thrown and no action is performed.

Specified by:
addPropertyChangeListener in interface PropertyChangeReporter
Parameters:
propertyname - the name of the property to receive change notifications for
pcl - the PropertyChangeListener to be added
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), removePropertyChangeListener(String,java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyname,
                                         java.beans.PropertyChangeListener pcl)
Removes a PropertyChangeListener from the listener list for a specific property. This method should be used to remove PropertyChangeListeners that were registered for a specific property.

If listener is null, no exception is thrown and no action is performed.

Specified by:
removePropertyChangeListener in interface PropertyChangeReporter
Parameters:
propertyname - a valid property name
pcl - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(String,java.beans.PropertyChangeListener), removePropertyChangeListener(java.beans.PropertyChangeListener)

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.