Interface ConfigEditor<T>
-
- Type Parameters:
T- The type of object returned by getValue.
- All Known Subinterfaces:
ContentConfigEditor<T>
- All Known Implementing Classes:
AbstractEditorMap,EditorBigDecimal,EditorBoolean,EditorClass,EditorColor,EditorDefault,EditorDouble,EditorEnum,EditorInt,EditorList,EditorLong,EditorMap,EditorNull,EditorPassword,EditorString,EditorSubclass
public interface ConfigEditor<T>Interface defining configuration editors.- Author:
- hylke
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_PROFILE_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancanEdit()True if the component is editable in the current profile.com.google.gson.JsonElementgetConfig()Get the current (edited) state of the configuration.StringgetDescription()Get the description for this editor.GuiFactoryFxgetGuiFactoryFx()Get a factory that can generate a JavaFX-based gui for this editor.GuiFactorySwinggetGuiFactorySwing()Get a factory that can generate a swing-based gui for this editor.default RootSchemagetJsonRootSchema()Get the Schema for this editor, in the form of a root schema.SchemaItemgetJsonSchema(RootSchema rootSchema)Get the JSON Schema for this editor, using the given rootSchema for shared $defs.StringgetLabel()Get the human-readable label to use for this editor.TgetValue()Get the value configured in the editor.voidinitFor(Field field)Initialise the editor for the given Field, using the Field name and type and any annotations present on the Field.default voidinitFor(Field field, String key)Initialise the editor for the given Field, using the Field name and type and the annotation on the Field, identified by the given key.default booleanisDefault()voidsetConfig(com.google.gson.JsonElement config)Load the given configuration into this editor.voidsetDescription(String description)The longer description for this editor.voidsetLabel(String label)The human readable label for this editor.default voidsetProfile(String profile)Sets the currently active profile.voidsetValue(T value)Set the value in the editor.
-
-
-
Field Detail
-
DEFAULT_PROFILE_NAME
static final String DEFAULT_PROFILE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setConfig
void setConfig(com.google.gson.JsonElement config)
Load the given configuration into this editor.- Parameters:
config- the configuration to load into this editor.
-
getConfig
com.google.gson.JsonElement getConfig()
Get the current (edited) state of the configuration.- Returns:
- The current (edited) configuration.
-
getValue
T getValue() throws ConfigurationException
Get the value configured in the editor.- Returns:
- the value configured in the editor.
- Throws:
ConfigurationException- when the configuration can not be used to create a value.
-
setValue
void setValue(T value)
Set the value in the editor. Used for saving an (externally) updated configuration.- Parameters:
value- the value in the editor.
-
getJsonRootSchema
default RootSchema getJsonRootSchema()
Get the Schema for this editor, in the form of a root schema.- Returns:
- The schema for this editor, as a root schema.
-
getJsonSchema
SchemaItem getJsonSchema(RootSchema rootSchema)
Get the JSON Schema for this editor, using the given rootSchema for shared $defs.- Parameters:
rootSchema- the root schema to use for $defs. If null, the return value must be a root schema.- Returns:
- the schema for this editor.
-
getGuiFactorySwing
GuiFactorySwing getGuiFactorySwing()
Get a factory that can generate a swing-based gui for this editor.- Returns:
- A factory that can generate a swing-based gui for this editor.
-
getGuiFactoryFx
GuiFactoryFx getGuiFactoryFx()
Get a factory that can generate a JavaFX-based gui for this editor.- Returns:
- A factory that can generate a JavaFX-based gui for this editor.
-
getLabel
String getLabel()
Get the human-readable label to use for this editor. Can return an empty string.- Returns:
- The label to use for this editor.
-
setLabel
void setLabel(String label)
The human readable label for this editor.- Parameters:
label- the label to set
-
getDescription
String getDescription()
Get the description for this editor. Can return an empty string.- Returns:
- The description to use for this editor.
-
setDescription
void setDescription(String description)
The longer description for this editor.- Parameters:
description- the description to set
-
initFor
void initFor(Field field)
Initialise the editor for the given Field, using the Field name and type and any annotations present on the Field.- Parameters:
field- the Field to initialise the editor for.
-
initFor
default void initFor(Field field, String key)
Initialise the editor for the given Field, using the Field name and type and the annotation on the Field, identified by the given key.- Parameters:
field- the Field to initialise the editor for.key- the key to use to identify the annotation to load the configuration from.
-
setProfile
default void setProfile(String profile)
Sets the currently active profile.- Parameters:
profile- the currently active profile.
-
canEdit
default boolean canEdit()
True if the component is editable in the current profile.- Returns:
- True if the component is editable in the current profile.
-
isDefault
default boolean isDefault()
-
-