Package com.j3d.gen.settings.types
Class ComplexSetting<T>
java.lang.Object
com.j3d.gen.settings.Setting<T>
com.j3d.gen.settings.types.ComplexSetting<T>
- All Implemented Interfaces:
EventEmitterInterface,SettingsChild
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final TriFunction<ActionEvent, JLabel, PopoutSPanel<T>, T> -
Constructor Summary
ConstructorsConstructorDescriptionComplexSetting(String name, T value, String description, TriFunction<ActionEvent, JLabel, PopoutSPanel<T>, T> onOpen, Supplier<String> onCreate) -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(ArrayList<String> leftover) Deserializes the setting's value from a list of strings.fromString(String str) Converts a string representation back to the setting's type.voidopen()panel()Returns the panel associated with this setting for display and interaction.Serializes the current setting into a list of strings.valueToString(T value) Converts the setting's value to its string representation.Methods inherited from class com.j3d.gen.settings.Setting
attachListener, broadcast, detachAll, detachListener, getDefaultValue, getDescription, getName, getValue, isAttached, onSetValue, setValue, setValueNoBroadcastMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.j3d.gen.settings.SettingsChild
serializedName
-
Field Details
-
onOpen
-
onCreate
-
isSerializable
private boolean isSerializable -
forward
-
backward
-
-
Constructor Details
-
ComplexSetting
public ComplexSetting(String name, T value, String description, TriFunction<ActionEvent, JLabel, PopoutSPanel<T>, T> onOpen, Supplier<String> onCreate)
-
-
Method Details
-
serializable
-
getOnCreate
-
fromString
Description copied from class:SettingConverts a string representation back to the setting's type.- Overrides:
fromStringin classSetting<T>- Parameters:
str- The string to convert.- Returns:
- The value of type T parsed from the string.
-
valueToString
Description copied from class:SettingConverts the setting's value to its string representation.- Overrides:
valueToStringin classSetting<T>- Parameters:
value- The value to convert to a string.- Returns:
- The string representation of the value.
-
deserialize
Description copied from class:SettingDeserializes the setting's value from a list of strings. It searches for a string containing the serialized name of this setting, parses its value, and updates the setting. If no match is found or parsing fails, the setting is reset to its default value.- Specified by:
deserializein interfaceSettingsChild- Overrides:
deserializein classSetting<T>- Parameters:
leftover- AnArrayListof strings from which to deserialize the setting.
-
serialize
Description copied from class:SettingSerializes the current setting into a list of strings. For a single setting, this typically returns a list containing one string in the format "settingName = settingValue". -
panel
Description copied from class:SettingReturns the panel associated with this setting for display and interaction.- Specified by:
panelin interfaceSettingsChild- Overrides:
panelin classSetting<T>- Returns:
- A UI component representing this setting, or
nullif not implemented by a subclass.
-
open
public void open()
-