org.openbp.jaspira.option
Class OptionMgr

java.lang.Object
  extended by org.openbp.jaspira.plugin.AbstractPlugin
      extended by org.openbp.jaspira.option.OptionMgr
All Implemented Interfaces:
Plugin

public final class OptionMgr
extends AbstractPlugin

Singleton class that manages all options of the application.

Author:
Jens Ferchland

Nested Class Summary
 class OptionMgr.Events
          Event module.
 
Nested classes/interfaces inherited from class org.openbp.jaspira.plugin.AbstractPlugin
AbstractPlugin.StandardPluginEvents
 
Field Summary
static java.lang.String OPTIONROOT
          root of all otions in the optiontree
 
Fields inherited from class org.openbp.jaspira.plugin.AbstractPlugin
PROPERTY_CONDITION, PROPERTY_DESCRIPTION, PROPERTY_ICON, PROPERTY_NAME, PROPERTY_SEQUENCE, PROPERTY_TITLE, PROPERTY_VENDOR, PROPERTY_VERSION
 
Fields inherited from interface org.openbp.jaspira.plugin.Plugin
ID_DELIMETER, LEVEL_APPLICATION, LEVEL_FRAME, LEVEL_PAGE, LEVEL_PLUGIN
 
Method Summary
 void addOption(Option option)
          Adds an option to the option manager.
 boolean getBooleanOption(java.lang.String optionName, boolean dfltValue)
          Gets a boolean option (convenience method).
static OptionMgr getInstance()
          Gets the singleton instance of the option manager.
 int getIntegerOption(java.lang.String optionName, int dfltValue)
          Gets a integer option (convenience method).
 Option getOption(java.lang.String optionName)
          Gets an option.
 java.lang.String getResourceCollectionContainerName()
          Gets the name of the resource component the default resource of the plugin belongs to.
 java.lang.String getStringOption(java.lang.String optionName, java.lang.String dfltValue)
          Gets a string option (convenience method).
 void removeOption(Option option)
          Removes a option from the manager.
 void saveOptions()
          Saves the option values to persistent storage.
 void setOption(Option option, java.lang.Object newValue)
          Sets an option value and fires an option event.
 void setOption(java.lang.String optionName, java.lang.Object optionValue)
          Sets an option value and fires an option event.
 
Methods inherited from class org.openbp.jaspira.plugin.AbstractPlugin
addActionKeySequence, addPlugin, addToPeerGroup, canClose, closeCanceled, containsStackedEvent, fireEvent, fireEvent, fireEvent, getAction, getChildPlugins, getClassName, getCondition, getDescendantPlugins, getDescription, getEventActionNames, getEventModules, getExternalActions, getExternalEventModuleClasses, getExternalOptionModuleClasses, getIcon, getIcon, getLevel, getName, getOptionModules, getParentPlugin, getPeerGroup, getPeerGroupNames, getPeerGroups, getPluginResourceCollection, getPluginState, getSubClients, getSubTitle, getTitle, getUniqueId, getVendor, getVersion, handleEvent, handleKeySequence, inheritEvent, initializeFromPluginProfile, initializePlugin, initializeResources, installFirstPlugin, installPlugin, installPluginContent, matchesPeerGroup, matchesPeerGroups, passDown, pluginInstalled, pluginUninstalled, preClose, receiveEvent, removeFromPeerGroup, removePlugin, removeStackedEvent, requestClose, setDescription, setIcon, setName, setParentPlugin, setPluginState, setResourceCollection, setTitle, stackEvent, toString, uninstallLastPlugin, uninstallPlugin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPTIONROOT

public static final java.lang.String OPTIONROOT
root of all otions in the optiontree

See Also:
Constant Field Values
Method Detail

getInstance

public static OptionMgr getInstance()
Gets the singleton instance of the option manager.


getResourceCollectionContainerName

public java.lang.String getResourceCollectionContainerName()
Description copied from class: AbstractPlugin
Gets the name of the resource component the default resource of the plugin belongs to.

Specified by:
getResourceCollectionContainerName in class AbstractPlugin
Returns:
The container name

getOption

public Option getOption(java.lang.String optionName)
Gets an option.

Parameters:
optionName - Name of the option
Returns:
The option or null if no such option exists

getStringOption

public java.lang.String getStringOption(java.lang.String optionName,
                                        java.lang.String dfltValue)
Gets a string option (convenience method).

Parameters:
optionName - Name of the option
dfltValue - Default value of the option
Returns:
The string value of the option or the default value if no such option exists

getBooleanOption

public boolean getBooleanOption(java.lang.String optionName,
                                boolean dfltValue)
Gets a boolean option (convenience method).

Parameters:
optionName - Name of the option
dfltValue - Default value of the option
Returns:
The boolean value of the option or the default value if no such option exists

getIntegerOption

public int getIntegerOption(java.lang.String optionName,
                            int dfltValue)
Gets a integer option (convenience method).

Parameters:
optionName - Name of the option
dfltValue - Default value of the option
Returns:
The integer value of the option or the default value if no such option exists

setOption

public void setOption(java.lang.String optionName,
                      java.lang.Object optionValue)
Sets an option value and fires an option event.

Parameters:
optionName - Name of the option to set
optionValue - New value of the option

setOption

public void setOption(Option option,
                      java.lang.Object newValue)
Sets an option value and fires an option event. The name of the event equals the name of the option. The event object is the option itself.

Parameters:
option - Option to set
newValue - New value of the option

addOption

public void addOption(Option option)
Adds an option to the option manager.


removeOption

public void removeOption(Option option)
Removes a option from the manager.


saveOptions

public void saveOptions()
Saves the option values to persistent storage.



Copyright © 2011. All Rights Reserved.