org.opa.option
Class OPADefaultOptionManager

java.lang.Object
  extended byorg.opa.option.OPADefaultOptionManager
All Implemented Interfaces:
OPAManager, OPAOptionManager

public class OPADefaultOptionManager
extends java.lang.Object
implements OPAOptionManager

This class is the default implementation of the OPAOptionManager interface.


Constructor Summary
OPADefaultOptionManager()
          Creates a new instance of OPADefaultOptionManager
 
Method Summary
 void addOption(OPAOptionPanel optionPanel)
          Adds an OPAOptionPanel to the system.
 void addOption(java.util.Properties moduleDefaults)
          Adds a default Properties object to the system option manager.
 void addOptionListener(OPAOptionListener listener)
          regsiters an OPAOptionListener object with OPAOptionManager.
 java.lang.String get(java.lang.String key)
          retrieves an options value.
 boolean getBoolean(java.lang.String key)
          Convenience method to simplify the handling of boolean values
 java.awt.Color getColor(java.lang.String key)
          Convenience method to simplify the handling of Color values
 int getInt(java.lang.String key)
          Convenience method to simplify the handling of int values
 void load()
          Loads the OPAManager.
 void removeOptionListener(OPAOptionListener listener)
          Removes an OPAOptionListener.
 void set(java.lang.String key, java.lang.String value)
          Sets an options value.
 void setAndSignal(java.lang.String key, java.lang.String value)
          Sets a single option AND signals an option change to listening code.
 void setAndSignalBoolean(java.lang.String key, boolean value)
          Convenience method to simplify the handling of boolean values
 void setAndSignalColor(java.lang.String key, java.awt.Color value)
          Convenience method to simplify the handling of Color values
 void setAndSignalHexInt(java.lang.String key, int value)
          Convenience method to simplify the handling of int values
 void setAndSignalOctInt(java.lang.String key, int value)
          Convenience method to simplify the handling of int values
 void setBoolean(java.lang.String key, boolean value)
          Convenience method to simplify the handling of boolean values
 void setColor(java.lang.String key, java.awt.Color value)
          Convenience method to simplify the handling of Color values
 void setHexInt(java.lang.String key, int value)
          Convenience method to simplify the handling of int values
 void setOctInt(java.lang.String key, int value)
          Convenience method to simplify the handling of int values
 void showOptions(java.lang.String panelName)
          Displays the options panel specified.
 void signal()
          Notifies listeners that options have been changed.
 void start()
          Starts the OPAXXXManager service.
 void stop()
          Stops the OPAXXXManager service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OPADefaultOptionManager

public OPADefaultOptionManager()
Creates a new instance of OPADefaultOptionManager

Method Detail

addOption

public void addOption(java.util.Properties moduleDefaults)
Description copied from interface: OPAOptionManager
Adds a default Properties object to the system option manager. This is called by each modules 'Loader' object at boot time. These properties are static and options selected by each user are layed over these to create the in-use system options.

Specified by:
addOption in interface OPAOptionManager

addOption

public void addOption(OPAOptionPanel optionPanel)
Description copied from interface: OPAOptionManager
Adds an OPAOptionPanel to the system. OPAOptionManager instances are then responsible go for collecting the Properties from the OPAOptionPanels and creating a single Properties file.

Specified by:
addOption in interface OPAOptionManager

get

public java.lang.String get(java.lang.String key)
Description copied from interface: OPAOptionManager
retrieves an options value. The key must begin with the module name to avoid naming conflicts within the entire application.

Specified by:
get in interface OPAOptionManager

set

public void set(java.lang.String key,
                java.lang.String value)
Description copied from interface: OPAOptionManager
Sets an options value. This DOES NOT SIGNAL a change. This is best used to increase performance when there are MANY option changes. After calling this (multiple times), signal() must be called to notify listeners that options have been changed.

Specified by:
set in interface OPAOptionManager

signal

public void signal()
Description copied from interface: OPAOptionManager
Notifies listeners that options have been changed. If nothing has changed no signal is sent.

Specified by:
signal in interface OPAOptionManager

setAndSignal

public void setAndSignal(java.lang.String key,
                         java.lang.String value)
Description copied from interface: OPAOptionManager
Sets a single option AND signals an option change to listening code. This is a convenience method. It is the same as calling set(key, value) THEN calling signal().

Specified by:
setAndSignal in interface OPAOptionManager

start

public void start()
Description copied from interface: OPAManager
Starts the OPAXXXManager service. This should be used to restore any state (if necessary).

Specified by:
start in interface OPAManager

stop

public void stop()
Description copied from interface: OPAManager
Stops the OPAXXXManager service. This should be used to save any state (if necessary).

Specified by:
stop in interface OPAManager

showOptions

public void showOptions(java.lang.String panelName)
Description copied from interface: OPAOptionManager
Displays the options panel specified. If null or invalid, opens to the first OPAOptionPanel.

Specified by:
showOptions in interface OPAOptionManager

addOptionListener

public void addOptionListener(OPAOptionListener listener)
Description copied from interface: OPAOptionManager
regsiters an OPAOptionListener object with OPAOptionManager. OPAOptionListener objects are notified when an option changes - more specifically, when a change is signalled. Multiple changes may occur BEFORE a signal is sent. This is for efficiency.

Specified by:
addOptionListener in interface OPAOptionManager

removeOptionListener

public void removeOptionListener(OPAOptionListener listener)
Description copied from interface: OPAOptionManager
Removes an OPAOptionListener.

Specified by:
removeOptionListener in interface OPAOptionManager

getBoolean

public boolean getBoolean(java.lang.String key)
                   throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of boolean values

Specified by:
getBoolean in interface OPAOptionManager
Throws:
java.lang.Throwable

setBoolean

public void setBoolean(java.lang.String key,
                       boolean value)
                throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of boolean values

Specified by:
setBoolean in interface OPAOptionManager
Throws:
java.lang.Throwable

setAndSignalBoolean

public void setAndSignalBoolean(java.lang.String key,
                                boolean value)
                         throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of boolean values

Specified by:
setAndSignalBoolean in interface OPAOptionManager
Throws:
java.lang.Throwable

getColor

public java.awt.Color getColor(java.lang.String key)
                        throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of Color values

Specified by:
getColor in interface OPAOptionManager
Throws:
java.lang.Throwable

setColor

public void setColor(java.lang.String key,
                     java.awt.Color value)
              throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of Color values

Specified by:
setColor in interface OPAOptionManager
Throws:
java.lang.Throwable

setAndSignalColor

public void setAndSignalColor(java.lang.String key,
                              java.awt.Color value)
                       throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of Color values

Specified by:
setAndSignalColor in interface OPAOptionManager
Throws:
java.lang.Throwable

getInt

public int getInt(java.lang.String key)
           throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of int values

Specified by:
getInt in interface OPAOptionManager
Throws:
java.lang.Throwable

setHexInt

public void setHexInt(java.lang.String key,
                      int value)
               throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of int values

Specified by:
setHexInt in interface OPAOptionManager
Throws:
java.lang.Throwable

setAndSignalHexInt

public void setAndSignalHexInt(java.lang.String key,
                               int value)
                        throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of int values

Specified by:
setAndSignalHexInt in interface OPAOptionManager
Throws:
java.lang.Throwable

setOctInt

public void setOctInt(java.lang.String key,
                      int value)
               throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of int values

Specified by:
setOctInt in interface OPAOptionManager
Throws:
java.lang.Throwable

setAndSignalOctInt

public void setAndSignalOctInt(java.lang.String key,
                               int value)
                        throws java.lang.Throwable
Description copied from interface: OPAOptionManager
Convenience method to simplify the handling of int values

Specified by:
setAndSignalOctInt in interface OPAOptionManager
Throws:
java.lang.Throwable

load

public void load()
Description copied from interface: OPAManager
Loads the OPAManager. This should be used to set-up and install any OPA services needed. For example, OPAOption panels needed by this OPAManager should be added to OPA here. This method is called before start().

Specified by:
load in interface OPAManager