Class OptionManager
java.lang.Object
com.realtime.crossfire.jxclient.settings.options.OptionManager
Maintains a set of named options.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPair ofOptionand corresponding documentation string. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new option.@NotNull CheckBoxOptiongetCheckBoxOption(@NotNull String optionName) Returns a checkbox option.@NotNull Map<String,OptionManager.Entry> Returns all defined option names.voidLoads all options' states from the backing settings instance.voidremoveOption(@NotNull String optionName) Removes an option by name.voidSaves all options' states to the backing settings instance.
-
Constructor Details
-
OptionManager
Creates a new instance.- Parameters:
settings- the settings instance for loading/saving option values
-
-
Method Details
-
addOption
public void addOption(@NotNull @NotNull String optionName, @NotNull @NotNull String documentation, @NotNull @NotNull Option option) throws OptionException Adds a new option.- Parameters:
optionName- the option name to adddocumentation- the documentation string for the settingsoption- the option to add- Throws:
OptionException- if the option name is not unique
-
removeOption
Removes an option by name. Does nothing if the option does not exist.- Parameters:
optionName- the option name to remove
-
getOptions
Returns all defined option names.- Returns:
- the option names
-
getCheckBoxOption
@NotNull public @NotNull CheckBoxOption getCheckBoxOption(@NotNull @NotNull String optionName) throws OptionException Returns a checkbox option.- Parameters:
optionName- the option name to look up- Returns:
- the option
- Throws:
OptionException- if the option name does not exist
-
loadOptions
public void loadOptions()Loads all options' states from the backing settings instance. -
saveOptions
public void saveOptions()Saves all options' states to the backing settings instance.
-