intellij-randomness / com.fwdekker.randomness / SettingsComponent

SettingsComponent

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.

Parameters

S - the type of settings to manage

T - the type of scheme to manage

settings - the settings to manage

Constructors

<init>

SettingsComponent(settings: S)

A component that allows the user to edit settings and its corresponding schemes.

Properties

rootPane

abstract val rootPane: JPanel?

The panel containing the settings.

schemesPanel

abstract val schemesPanel: SchemesPanel<T>

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

unsavedSettings

abstract val unsavedSettings: S

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

Functions

doValidate

abstract fun doValidate(): ValidationInfo?

Validates all input fields.

isModified

fun isModified(): Boolean
open fun isModified(settings: S): Boolean

Returns true if this component contains unsaved changes.

loadScheme

abstract fun loadScheme(scheme: T): Unit

Loads the given scheme into the component's state.

loadSettings

fun loadSettings(): Unit

Loads the default settings object.

fun loadSettings(settings: S): Unit

Loads settings.

reset

fun reset(): Unit

Discards unsaved changes.

saveScheme

abstract fun saveScheme(scheme: T): Unit

Saves the component's state into the given scheme.

saveSettings

fun saveSettings(): Unit

Saves settings to the default settings object.

fun saveSettings(settings: S): Unit

Saves settings to settings.

Inheritors

ArraySettingsComponent

class ArraySettingsComponent : SettingsComponent<ArraySettings, ArrayScheme>

Component for settings of random array generation.

DecimalSettingsComponent

class DecimalSettingsComponent : SettingsComponent<DecimalSettings, DecimalScheme>

Component for settings of random decimal generation.

IntegerSettingsComponent

class IntegerSettingsComponent : SettingsComponent<IntegerSettings, IntegerScheme>

Component for settings of random integer generation.

StringSettingsComponent

class StringSettingsComponent : SettingsComponent<StringSettings, StringScheme>

Component for settings of random string generation.

UuidSettingsComponent

class UuidSettingsComponent : SettingsComponent<UuidSettings, UuidScheme>

Component for settings of random UUID generation.

WordSettingsComponent

class WordSettingsComponent : SettingsComponent<WordSettings, WordScheme>

Component for settings of random word generation.