Class EditorList<U,T extends ConfigEditor<U>>
- java.lang.Object
-
- de.fraunhofer.iosb.ilt.configurable.editor.EditorDefault<List<U>>
-
- de.fraunhofer.iosb.ilt.configurable.editor.EditorList<U,T>
-
- Type Parameters:
T- The type of editors that edit the items in the list.U- The type of items in the list.
- All Implemented Interfaces:
ConfigEditor<List<U>>,Iterable<T>
public class EditorList<U,T extends ConfigEditor<U>> extends EditorDefault<List<U>> implements Iterable<T>
An editor for a list of editors, all of the same type.- Author:
- Hylke van der Schaaf
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceEditorList.EdOptsListstatic interfaceEditorList.EdOptsListListContainer for repeated EdOptsList annotations.
-
Field Summary
Fields Modifier and Type Field Description Set<String>profilesEdit-
Fields inherited from interface de.fraunhofer.iosb.ilt.configurable.ConfigEditor
DEFAULT_PROFILE_NAME
-
-
Constructor Summary
Constructors Constructor Description EditorList()EditorList(EditorFactory<T> factory)EditorList(EditorFactory<T> factory, String label, String description)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddItem()booleancanEdit()True if the component is editable in the current profile.com.google.gson.JsonElementgetConfig()Get the current (edited) state of the configuration.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.SchemaItemgetJsonSchema(RootSchema rootSchema)Get the JSON Schema for this editor, using the given rootSchema for shared $defs.intgetMaxCount()intgetMinCount()List<T>getRawValue()List<U>getValue()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.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.Iterator<T>iterator()voidremoveItem(T item)voidsetConfig(com.google.gson.JsonElement config)Load the given configuration into this editor.voidsetContexts(Object context, Object edtCtx)The contexts to pass on to item editors.voidsetMaxCount(int maxCount)voidsetMinCount(int minCount)voidsetProfile(String profile)Sets the currently active profile.voidsetProfilesEdit(String csv)voidsetValue(List<U> value)Set the value in the editor.-
Methods inherited from class de.fraunhofer.iosb.ilt.configurable.editor.EditorDefault
getDescription, getHelpButton, getHelpFrame, getLabel, popupDescription, setDescription, setLabel
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.fraunhofer.iosb.ilt.configurable.ConfigEditor
getJsonRootSchema, isDefault
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
EditorList
public EditorList()
-
EditorList
public EditorList(EditorFactory<T> factory)
-
EditorList
public EditorList(EditorFactory<T> factory, String label, String description)
-
-
Method Detail
-
setContexts
public final void setContexts(Object context, Object edtCtx)
The contexts to pass on to item editors. Only needed when using annotations, since then the factory is not externally supplied.- Parameters:
context- the context.edtCtx- the edit context.
-
initFor
public void initFor(Field field)
Description copied from interface:ConfigEditorInitialise the editor for the given Field, using the Field name and type and any annotations present on the Field.- Specified by:
initForin interfaceConfigEditor<U>- Overrides:
initForin classEditorDefault<List<U>>- Parameters:
field- the Field to initialise the editor for.
-
initFor
public void initFor(Field field, String key)
Description copied from interface:ConfigEditorInitialise the editor for the given Field, using the Field name and type and the annotation on the Field, identified by the given key.- Specified by:
initForin interfaceConfigEditor<U>- Parameters:
field- the Field to initialise the editor for.key- the key to use to identify the annotation to load the configuration from.
-
setConfig
public void setConfig(com.google.gson.JsonElement config)
Description copied from interface:ConfigEditorLoad the given configuration into this editor.- Specified by:
setConfigin interfaceConfigEditor<U>- Parameters:
config- the configuration to load into this editor.
-
getConfig
public com.google.gson.JsonElement getConfig()
Description copied from interface:ConfigEditorGet the current (edited) state of the configuration.- Specified by:
getConfigin interfaceConfigEditor<U>- Returns:
- The current (edited) configuration.
-
getJsonSchema
public SchemaItem getJsonSchema(RootSchema rootSchema)
Description copied from interface:ConfigEditorGet the JSON Schema for this editor, using the given rootSchema for shared $defs.- Specified by:
getJsonSchemain interfaceConfigEditor<U>- 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
public GuiFactorySwing getGuiFactorySwing()
Description copied from interface:ConfigEditorGet a factory that can generate a swing-based gui for this editor.- Specified by:
getGuiFactorySwingin interfaceConfigEditor<U>- Returns:
- A factory that can generate a swing-based gui for this editor.
-
getGuiFactoryFx
public GuiFactoryFx getGuiFactoryFx()
Description copied from interface:ConfigEditorGet a factory that can generate a JavaFX-based gui for this editor.- Specified by:
getGuiFactoryFxin interfaceConfigEditor<U>- Returns:
- A factory that can generate a JavaFX-based gui for this editor.
-
addItem
public void addItem()
-
removeItem
public void removeItem(T item)
-
getValue
public List<U> getValue() throws ConfigurationException
Description copied from interface:ConfigEditorGet the value configured in the editor.- Specified by:
getValuein interfaceConfigEditor<U>- Returns:
- the value configured in the editor.
- Throws:
ConfigurationException- when the configuration can not be used to create a value.
-
setValue
public void setValue(List<U> value)
Description copied from interface:ConfigEditorSet the value in the editor. Used for saving an (externally) updated configuration.- Specified by:
setValuein interfaceConfigEditor<U>- Parameters:
value- the value in the editor.
-
getMinCount
public int getMinCount()
-
setMinCount
public void setMinCount(int minCount)
-
getMaxCount
public int getMaxCount()
-
setMaxCount
public void setMaxCount(int maxCount)
-
setProfilesEdit
public void setProfilesEdit(String csv)
-
setProfile
public void setProfile(String profile)
Description copied from interface:ConfigEditorSets the currently active profile.- Specified by:
setProfilein interfaceConfigEditor<U>- Parameters:
profile- the currently active profile.
-
canEdit
public boolean canEdit()
Description copied from interface:ConfigEditorTrue if the component is editable in the current profile.- Specified by:
canEditin interfaceConfigEditor<U>- Returns:
- True if the component is editable in the current profile.
-
-