Package net.mcreator.preferences
Class PreferencesEntry<T>
java.lang.Object
net.mcreator.preferences.PreferencesEntry<T>
- Type Parameters:
T
-The type of the stored value.
- Direct Known Subclasses:
BooleanEntry
,ColorEntry
,HiddenEntry
,IntegerEntry
,LocaleEntry
,StringEntry
This is the basic and the common class for all preferences of the software.
It stores everything the preference needs to have to be used or saved, such as an ID, its value or its JComponent
for PreferencesDialog
.
This is also the class used to save each preference inside the user's folder. However, only required (fields without transient) fields are saved.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget()
abstract JComponent
getComponent
(Window parent, Consumer<EventObject> fct) Generate aJComponent
for thePreferencesDialog
, so users can change the value.getID()
abstract com.google.gson.JsonElement
void
reset()
void
abstract void
setValueFromComponent
(JComponent component) abstract void
setValueFromJsonElement
(com.google.gson.JsonElement object) toString()
-
Field Details
-
value
-
-
Constructor Details
-
PreferencesEntry
-
-
Method Details
-
getComponent
Generate a
JComponent
for thePreferencesDialog
, so users can change the value.- Parameters:
parent
-The component's parent, which is the opened
PreferencesDialog
.fct
-This is the
Consumer
used to enable the apply button when the value of theJComponent
is changed.- Returns:
The
JComponent
to use inside thePreferencesDialog
for all preference entries using the same type.
-
setValueFromComponent
-
setValueFromJsonElement
public abstract void setValueFromJsonElement(com.google.gson.JsonElement object) -
getSerializedValue
public abstract com.google.gson.JsonElement getSerializedValue() -
getID
-
get
-
reset
public void reset() -
set
-
getSectionKey
-
getSection
-
toString
-