java.lang.Object com.realtime.crossfire.jxclient.settings.options.OptionManager
public class OptionManager
Maintains a set of named options.
Field Summary | |
---|---|
private java.util.Map<java.lang.String,Option> |
options
Maps option name to option instance. |
private Settings |
settings
The settings instance for loading/saving option values. |
Constructor Summary | |
---|---|
OptionManager(Settings settings)
Create a new instance. |
Method Summary | |
---|---|
void |
addOption(java.lang.String optionName,
java.lang.String documentation,
Option option)
Add a new option. |
CheckBoxOption |
getCheckBoxOption(java.lang.String optionName)
Return a check box option. |
void |
loadOptions()
Load all options' states from the backing settings instance. |
void |
removeOption(java.lang.String optionName)
Removes an option by name. |
void |
saveOptions()
Save all options' states to the backing settings instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private final java.util.Map<java.lang.String,Option> options
@NotNull private final Settings settings
Constructor Detail |
---|
public OptionManager(@NotNull Settings settings)
settings
- The settings instance for loading/saving option values.Method Detail |
---|
public void addOption(@NotNull java.lang.String optionName, @NotNull java.lang.String documentation, @NotNull Option option) throws OptionException
optionName
- The option name to add.documentation
- The documentation string for the settings.option
- The option to add.
OptionException
- If the option name is not unique.@NotNull public CheckBoxOption getCheckBoxOption(@NotNull java.lang.String optionName) throws OptionException
optionName
- The option name to look up.
OptionException
- If the option name does not exist.public void loadOptions()
public void removeOption(@NotNull java.lang.String optionName)
optionName
- the option name to removepublic void saveOptions()