SettingsComponent

abstract class SettingsComponent<S : Settings<S, T>, T : Scheme<T>>(settings: S) : 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.

Parameters

S

the type of settings to manage

T

the type of scheme to manage

Constructors

Link copied to clipboard
fun <S : Settings<S, T>> SettingsComponent(settings: S)

Functions

Link copied to clipboard
abstract fun doValidate(): ValidationInfo?

Validates all input fields.

Link copied to clipboard
fun isModified(): Boolean
open fun isModified(settings: S): Boolean

Returns true if this component contains unsaved changes.

Link copied to clipboard
abstract fun loadScheme(scheme: T)

Loads the given scheme into the component's state.

Link copied to clipboard
override fun loadSettings()

Loads the default settings object.

override fun loadSettings(settings: S)

Loads settings.

Link copied to clipboard
fun reset()

Discards unsaved changes.

Link copied to clipboard
abstract fun saveScheme(scheme: T)

Saves the component's state into the given scheme.

Link copied to clipboard
override fun saveSettings()

Saves settings to the default settings object.

override fun saveSettings(settings: S)

Saves settings to settings.

Properties

Link copied to clipboard
abstract val rootPane: JPanel?

The panel containing the settings.

Link copied to clipboard
abstract val schemesPanel: SchemesPanel<T>

The panel containing the dropdown box of schemes and action buttons to rename, delete, etc. schemes.

Link copied to clipboard
abstract val unsavedSettings: S

The local copy that represents the currently-unsaved settings that are being edited by the user.

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Sources

Link copied to clipboard