Package megamek.client.ui.preferences
Class PreferenceElement
java.lang.Object
megamek.client.ui.preferences.PreferenceElement
- Direct Known Subclasses:
JComboBoxPreference
,JDoubleNumberSpinnerPreference
,JIntNumberSpinnerPreference
,JListPreference
,JSplitPanePreference
,JTabbedPanePreference
,JTablePreference
,JTextFieldPreference
,JToggleButtonPreference
,JWindowPreference
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
PreferencesNode
s, forming a tree. You can
imagine a PreferenceElement as a field, and a PreferencesNode as a class.
This class is not thread-safe.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
dispose()
Cleans the preference resources.protected String
getName()
Name for this preference.protected abstract String
getValue()
Gets the current value for the preference.protected abstract void
initialize
(String value) Sets the initial value for the preference.
-
Constructor Details
-
PreferenceElement
- Throws:
Exception
-
-
Method Details
-
getName
Name for this preference. The name has to be unique for this node.- Returns:
- the name of the preference.
-
getValue
Gets the current value for the preference.- Returns:
- the value of the preference.
-
initialize
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.
-