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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget()abstract JComponentgetComponent(Window parent, Consumer<EventObject> fct) Generate aJComponentfor thePreferencesDialog, so users can change the value.getID()abstract com.google.gson.JsonElementvoidreset()voidabstract voidsetValueFromComponent(JComponent component) abstract voidsetValueFromJsonElement(com.google.gson.JsonElement object) toString()
-
Field Details
-
value
-
-
Constructor Details
-
PreferencesEntry
-
-
Method Details
-
getComponent
Generate a
JComponentfor thePreferencesDialog, so users can change the value.- Parameters:
parent-The component's parent, which is the opened
PreferencesDialog.fct-This is the
Consumerused to enable the apply button when the value of theJComponentis changed.- Returns:
The
JComponentto use inside thePreferencesDialogfor 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
-