abstract class SettingsComponent<S : Settings<S, T>, T : Scheme<T>> : SettingsManager<S>
A component that allows the user to edit settings and its corresponding schemes.
Subclasses MUST call loadSettings
in their constructor.
There are multiple settings S instances at any time. The settings
given in the constructor is read when the
component is created and is written to when the user saves its changes. The currently-selected scheme is loaded into
the component's inputs. When the user selects a different scheme of which to change its values, the values in the
input fields are stored in a copy of settings
. This way, the local changes are not lost when switching between
schemes, and the user can still revert all unsaved changes if desired.
S
- the type of settings to manage
T
- the type of scheme to manage
settings
- the settings to manage
SettingsComponent(settings: S)
A component that allows the user to edit settings and its corresponding schemes. |
abstract val rootPane: JPanel?
The panel containing the settings. |
|
abstract val schemesPanel: SchemesPanel<T>
The panel containing the dropdown box of schemes and action buttons to rename, delete, etc. schemes. |
|
abstract val unsavedSettings: S
The local copy that represents the currently-unsaved settings that are being edited by the user. |
abstract fun doValidate(): ValidationInfo?
Validates all input fields. |
|
fun isModified(): Boolean open fun isModified(settings: S): Boolean
Returns true if this component contains unsaved changes. |
|
abstract fun loadScheme(scheme: T): Unit
Loads the given scheme into the component's state. |
|
fun loadSettings(): Unit
Loads the default settings object. fun loadSettings(settings: S): Unit
Loads |
|
fun reset(): Unit
Discards unsaved changes. |
|
abstract fun saveScheme(scheme: T): Unit
Saves the component's state into the given scheme. |
|
fun saveSettings(): Unit
Saves settings to the default settings object. fun saveSettings(settings: S): Unit
Saves settings to |
class ArraySettingsComponent : SettingsComponent<ArraySettings, ArrayScheme>
Component for settings of random array generation. |
|
class DecimalSettingsComponent : SettingsComponent<DecimalSettings, DecimalScheme>
Component for settings of random decimal generation. |
|
class IntegerSettingsComponent : SettingsComponent<IntegerSettings, IntegerScheme>
Component for settings of random integer generation. |
|
class StringSettingsComponent : SettingsComponent<StringSettings, StringScheme>
Component for settings of random string generation. |
|
class UuidSettingsComponent : SettingsComponent<UuidSettings, UuidScheme>
Component for settings of random UUID generation. |
|
class WordSettingsComponent : SettingsComponent<WordSettings, WordScheme>
Component for settings of random word generation. |