Class AbstractExpandableGUIVariable
- java.lang.Object
-
- net.ssehub.easy.producer.ui.confModel.GUIVariable
-
- net.ssehub.easy.producer.ui.confModel.AbstractExpandableGUIVariable
-
- All Implemented Interfaces:
java.lang.Comparable<GUIVariable>,IGUIConfigurableElement
- Direct Known Subclasses:
CompoundGUIVariable,ContainerGUIVariable
abstract class AbstractExpandableGUIVariable extends GUIVariable
Super class for variables, which contain nested elements and can be expanded.- Author:
- El-Sharkawy
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<GUIVariable>nested
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractExpandableGUIVariable(IDecisionVariable variable, org.eclipse.swt.widgets.Composite parent, GUIConfiguration parentConfig, GUIVariable varParent)Sole constructor for this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcreateNestedVariables()Creates nested GUIVariables for this variable.GUIVariableextend()Creates a new empty nested value/variable if supported.org.eclipse.jface.viewers.CellEditorgetCellEditor(org.eclipse.swt.widgets.Composite parent)Returns aCellEditorfor a table.GUIEditorgetEditor()Returns the (non-cell) editor for this variable.GUIVariablegetNestedElement(int index)Returns a nested element specified by the given index.intgetNestedElementsCount()Returns the number of nested elements.protected ValuegetValueAssignment(java.lang.Object value)Converts the given object into aValue.booleanisExpandable()Returns whether is variable can be expanded.protected GUIVariablereplace(GUIVariable nestedVariable, Value value)Replaces a variable to reflect the new value (of a more or less specific type).voidsetValue(java.lang.Object value)Sets the value of the wrappedIDecisionVariable.-
Methods inherited from class net.ssehub.easy.producer.ui.confModel.GUIVariable
addErrorMessage, compareTo, freeze, getAssignmentState, getComment, getComposite, getConfiguration, getErrorMessages, getHistory, getName, getNestedDepth, getNullLabel, getParent, getTooltip, getTopLevelParent, getType, getValue, getValueText, getVariable, hasErrors, hasNullValue, hasValue, isAnnotated, isEditable, isExtendable, isFreezable, isFrozen, isTopLevelDeclaration, remove, removeErrorMessages, replaceValue, setEmptyValue, setNULLValue, setVariable, toString, unfreeze
-
-
-
-
Field Detail
-
nested
private java.util.List<GUIVariable> nested
-
-
Constructor Detail
-
AbstractExpandableGUIVariable
protected AbstractExpandableGUIVariable(IDecisionVariable variable, org.eclipse.swt.widgets.Composite parent, GUIConfiguration parentConfig, GUIVariable varParent)
Sole constructor for this class.- Parameters:
variable- TheIDecisionVariablerepresented by this GUIVariableparent- The controlling composite, needed for the creation of CellEditorsparentConfig- TheGUIConfigurationholding this GUIVariablevarParent- The parent GUIVariable holding this variable. Can be null if and only if this variable is a top level variable stored inside the configuration.
-
-
Method Detail
-
getNestedElementsCount
public int getNestedElementsCount()
Description copied from class:GUIVariableReturns the number of nested elements. The return value should be 0 unless thisIDecisionVariableis anAbstractExpandableGUIVariable.- Overrides:
getNestedElementsCountin classGUIVariable- Returns:
- An integer value greater or equal to 0.
-
createNestedVariables
protected void createNestedVariables()
Creates nested GUIVariables for this variable. This method should be called inside the constructor and if the number of nested variables has been changed, e.g. a nested sequence item has been added to this variable.
-
getCellEditor
public final org.eclipse.jface.viewers.CellEditor getCellEditor(org.eclipse.swt.widgets.Composite parent)
Description copied from class:GUIVariableReturns aCellEditorfor a table.- Specified by:
getCellEditorin classGUIVariable- Parameters:
parent- The GUI component where thisGUIVariableand, thus, its editor are displayed.- Returns:
CellEditorto configure the enclosedIDecisionVariable
-
getEditor
public GUIEditor getEditor()
Description copied from class:GUIVariableReturns the (non-cell) editor for this variable. The editor shall be ready to use, i.e., properly initialized.- Specified by:
getEditorin classGUIVariable- Returns:
- the editor, may be null if the variable shall not be displayed / being edited
-
setValue
public void setValue(java.lang.Object value)
Description copied from class:GUIVariableSets the value of the wrappedIDecisionVariable.- Overrides:
setValuein classGUIVariable- Parameters:
value- The value to be set.
-
getValueAssignment
protected final Value getValueAssignment(java.lang.Object value) throws ValueDoesNotMatchTypeException
Description copied from class:GUIVariableConverts the given object into aValue.- Specified by:
getValueAssignmentin classGUIVariable- Parameters:
value- An object given by the Eclipse GUI.- Returns:
- A
Valuerepresentation of the object, maybe null. - Throws:
ValueDoesNotMatchTypeException- in case ofvaluecannot be converted to the related data type of the wrappedIDecisionVariable.
-
getNestedElement
public GUIVariable getNestedElement(int index)
Description copied from class:GUIVariableReturns a nested element specified by the given index.- Overrides:
getNestedElementin classGUIVariable- Parameters:
index- The 0-based index of the nested element.- Returns:
- The specified nestedvariable.
-
isExpandable
public final boolean isExpandable()
Returns whether is variable can be expanded. Subclasses may override this method.- Overrides:
isExpandablein classGUIVariable- Returns:
- true if this variable is expandable, otherwise false.
-
extend
public GUIVariable extend()
Description copied from class:GUIVariableCreates a new empty nested value/variable if supported. This method shall only be called by the set and sequence variables.- Overrides:
extendin classGUIVariable- Returns:
- the new empty variable or null if nothing happened, e.g., not
GUIVariable.isExtendable().
-
replace
protected GUIVariable replace(GUIVariable nestedVariable, Value value) throws ConfigurationException
Description copied from class:GUIVariableReplaces a variable to reflect the new value (of a more or less specific type).- Overrides:
replacein classGUIVariable- Parameters:
nestedVariable- the variable to be replaced (may affect top-level GUI variables)value- the new value carrying the type- Returns:
- the new variable or
nestedVariable - Throws:
ConfigurationException- in case that configuring the variable is not possible
-
-