Class PreferenceElement

java.lang.Object
megamek.client.ui.preferences.PreferenceElement
Direct Known Subclasses:
JComboBoxPreference, JDoubleNumberSpinnerPreference, JIntNumberSpinnerPreference, JListPreference, JSplitPanePreference, JTabbedPanePreference, JTablePreference, JTextFieldPreference, JToggleButtonPreference, JWindowPreference

public abstract class PreferenceElement extends Object
Represents the set of information needed to be part of the user preferences system for MegaMek. A preference is a value that the user can set anywhere in MegaMek and that will be persisted between user sessions. PreferenceElements are contained inside PreferencesNodes, forming a tree. You can imagine a PreferenceElement as a field, and a PreferencesNode as a class. This class is not thread-safe.
  • Constructor Details

  • Method Details

    • getName

      protected String getName()
      Name for this preference. The name has to be unique for this node.
      Returns:
      the name of the preference.
    • getValue

      protected abstract String getValue()
      Gets the current value for the preference.
      Returns:
      the value of the preference.
    • initialize

      protected abstract void initialize(String value) throws Exception
      Sets the initial value for the preference.
      Parameters:
      value - initial value.
      Throws:
      Exception - if there's an error during initialization
    • dispose

      protected abstract void dispose()
      Cleans the preference resources.