java.lang.Object
com.realtime.crossfire.jxclient.settings.options.OptionManager

public class OptionManager extends Object
Maintains a set of named options.
  • Constructor Details

    • OptionManager

      public OptionManager(@NotNull @NotNull Settings settings)
      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 add
      documentation - the documentation string for the settings
      option - the option to add
      Throws:
      OptionException - if the option name is not unique
    • removeOption

      public void removeOption(@NotNull @NotNull String optionName)
      Removes an option by name. Does nothing if the option does not exist.
      Parameters:
      optionName - the option name to remove
    • getOptions

      @NotNull public @NotNull Map<String,OptionManager.Entry> 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.