Crossfire JXClient, Trunk
com.realtime.crossfire.jxclient.settings.options.OptionManager Class Reference

Maintains a set of named options. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.settings.options.OptionManager:

Classes

class  Entry
 Pair of Option and corresponding documentation string. More...
 

Public Member Functions

void addOption (@NotNull final String optionName, @NotNull final String documentation, @NotNull final Option option) throws OptionException
 Adds a new option. More...
 
CheckBoxOption getCheckBoxOption (@NotNull final String optionName) throws OptionException
 Returns a checkbox option. More...
 
Map< String, EntrygetOptions ()
 Returns all defined option names. More...
 
void loadOptions ()
 Loads all options' states from the backing settings instance. More...
 
 OptionManager (@NotNull final Settings settings)
 Creates a new instance. More...
 
void removeOption (@NotNull final String optionName)
 Removes an option by name. More...
 
void saveOptions ()
 Saves all options' states to the backing settings instance. More...
 

Private Attributes

final Map< String, Entryoptions = new HashMap<>()
 Maps option name to option instance. More...
 
final Settings settings
 The settings instance for loading/saving option values. More...
 

Detailed Description

Maintains a set of named options.

Author
Andreas Kirschbaum

Definition at line 36 of file OptionManager.java.

Constructor & Destructor Documentation

◆ OptionManager()

com.realtime.crossfire.jxclient.settings.options.OptionManager.OptionManager ( @NotNull final Settings  settings)

Creates a new instance.

Parameters
settingsthe settings instance for loading/saving option values

Definition at line 54 of file OptionManager.java.

References com.realtime.crossfire.jxclient.settings.options.OptionManager.settings.

Member Function Documentation

◆ addOption()

void com.realtime.crossfire.jxclient.settings.options.OptionManager.addOption ( @NotNull final String  optionName,
@NotNull final String  documentation,
@NotNull final Option  option 
) throws OptionException

Adds a new option.

Parameters
optionNamethe option name to add
documentationthe documentation string for the settings
optionthe option to add
Exceptions
OptionExceptionif the option name is not unique

Definition at line 65 of file OptionManager.java.

References com.realtime.crossfire.jxclient.settings.options.OptionManager.options.

Referenced by com.realtime.crossfire.jxclient.skin.skin.DefaultJXCSkin.addOption(), and com.realtime.crossfire.jxclient.main.JXClient.JXClient().

+ Here is the caller graph for this function:

◆ getCheckBoxOption()

CheckBoxOption com.realtime.crossfire.jxclient.settings.options.OptionManager.getCheckBoxOption ( @NotNull final String  optionName) throws OptionException

Returns a checkbox option.

Parameters
optionNamethe option name to look up
Returns
the option
Exceptions
OptionExceptionif the option name does not exist

Definition at line 97 of file OptionManager.java.

References com.realtime.crossfire.jxclient.settings.options.OptionManager.Entry.getOption(), and com.realtime.crossfire.jxclient.settings.options.OptionManager.options.

Referenced by com.realtime.crossfire.jxclient.commands.SetCommand.execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOptions()

Map<String, Entry> com.realtime.crossfire.jxclient.settings.options.OptionManager.getOptions ( )

Returns all defined option names.

Returns
the option names

Definition at line 86 of file OptionManager.java.

References com.realtime.crossfire.jxclient.settings.options.OptionManager.options.

Referenced by com.realtime.crossfire.jxclient.commands.SetCommand.getHelp().

+ Here is the caller graph for this function:

◆ loadOptions()

void com.realtime.crossfire.jxclient.settings.options.OptionManager.loadOptions ( )

Loads all options' states from the backing settings instance.

Definition at line 109 of file OptionManager.java.

References com.realtime.crossfire.jxclient.settings.Settings.getBoolean(), com.realtime.crossfire.jxclient.settings.options.OptionManager.options, and com.realtime.crossfire.jxclient.settings.options.OptionManager.settings.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeOption()

void com.realtime.crossfire.jxclient.settings.options.OptionManager.removeOption ( @NotNull final String  optionName)

Removes an option by name.

Does nothing if the option does not exist.

Parameters
optionNamethe option name to remove

Definition at line 77 of file OptionManager.java.

References com.realtime.crossfire.jxclient.settings.options.OptionManager.options.

◆ saveOptions()

Member Data Documentation

◆ options

◆ settings

final Settings com.realtime.crossfire.jxclient.settings.options.OptionManager.settings
private

The documentation for this class was generated from the following file: