Class ConfigurationTableEditorFactory.DelegatingGuiVariable
- java.lang.Object
-
- net.ssehub.easy.producer.ui.confModel.GUIVariable
-
- net.ssehub.easy.producer.ui.productline_editor.ConfigurationTableEditorFactory.DelegatingGuiVariable
-
- All Implemented Interfaces:
java.lang.Comparable<GUIVariable>,GUIEditor,IGUIConfigurableElement
- Enclosing class:
- ConfigurationTableEditorFactory
private static class ConfigurationTableEditorFactory.DelegatingGuiVariable extends GUIVariable implements GUIEditor
Implements a delegating GuiVariable for externally created editors, so that they can be handled like EASy variables.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.jface.viewers.CellEditorcellEditorprivate org.eclipse.swt.widgets.Controlcontrolprivate IOverridingEditoroverridingEditor
-
Constructor Summary
Constructors Modifier Constructor Description privateDelegatingGuiVariable(IDecisionVariable variable, GUIConfiguration parentConfig, org.eclipse.jface.viewers.CellEditor cellEditor)Creates an instance.privateDelegatingGuiVariable(IDecisionVariable variable, GUIConfiguration parentConfig, org.eclipse.swt.widgets.Control control)Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.jface.viewers.CellEditorgetCellEditor(org.eclipse.swt.widgets.Composite parent)Returns aCellEditorfor a table.org.eclipse.swt.widgets.ControlgetControl()Returns the actual SWT control of the editor.GUIEditorgetEditor()Returns the (non-cell) editor for this variable.java.lang.ObjectgetValue()Returns the value of the givenIDecisionVariableso that it can be used as return value for theEditingSupport.getValue(Object)method.protected ValuegetValueAssignment(java.lang.Object value)Converts the given object into aValue.java.lang.StringgetValueText()Returns a string representation of the current value.booleanisPseudoEditor()Returns whether this representation actually holds an editable SWT element or whether it is a pseudo editor such as a Label.voidrefreshContents()Refreshes the contents of this editor.private <T> TsetOverridingEditor(T editor)Defines the overriding editor.-
Methods inherited from class net.ssehub.easy.producer.ui.confModel.GUIVariable
compareTo, extend, freeze, getAssignmentState, getComment, getComposite, getConfiguration, getErrorMessages, getHistory, getName, getNestedDepth, getNestedElement, getNestedElementsCount, getNullLabel, getParent, getTooltip, getTopLevelParent, getType, getVariable, hasErrors, hasNullValue, hasValue, isAnnotated, isEditable, isExpandable, isExtendable, isFreezable, isFrozen, remove, replace, setEmptyValue, setNULLValue, setValue, setVariable, toString, unfreeze
-
-
-
-
Field Detail
-
control
private org.eclipse.swt.widgets.Control control
-
cellEditor
private org.eclipse.jface.viewers.CellEditor cellEditor
-
overridingEditor
private IOverridingEditor overridingEditor
-
-
Constructor Detail
-
DelegatingGuiVariable
private DelegatingGuiVariable(IDecisionVariable variable, GUIConfiguration parentConfig, org.eclipse.swt.widgets.Control control)
Creates an instance.- Parameters:
variable- TheIDecisionVariablerepresented by this GUIVariableparentConfig- TheGUIConfigurationholding this GUIVariablecontrol- the external editor control, shall be instanceofIOverridingEditor
-
DelegatingGuiVariable
private DelegatingGuiVariable(IDecisionVariable variable, GUIConfiguration parentConfig, org.eclipse.jface.viewers.CellEditor cellEditor)
Creates an instance.- Parameters:
variable- TheIDecisionVariablerepresented by this GUIVariableparentConfig- TheGUIConfigurationholding this GUIVariablecellEditor- the external editor control, shall be instanceofIOverridingEditor
-
-
Method Detail
-
setOverridingEditor
private <T> T setOverridingEditor(T editor)
Defines the overriding editor.- Type Parameters:
T- the editor type- Parameters:
editor- the editor instance- Returns:
editor
-
getCellEditor
public 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
-
getValue
public java.lang.Object getValue()
Description copied from class:GUIVariableReturns the value of the givenIDecisionVariableso that it can be used as return value for theEditingSupport.getValue(Object)method.- Specified by:
getValuein interfaceGUIEditor- Specified by:
getValuein classGUIVariable- Returns:
- A value as needed by the Eclipse UI.
-
getValueAssignment
protected 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.
-
getValueText
public java.lang.String getValueText()
Description copied from class:GUIVariableReturns a string representation of the current value. This is used when no cursor is inside the cell (if the user is not editing the variable).- Specified by:
getValueTextin classGUIVariable- Returns:
- A string representation of the current value or null.
-
getControl
public org.eclipse.swt.widgets.Control getControl()
Description copied from interface:GUIEditorReturns the actual SWT control of the editor.- Specified by:
getControlin interfaceGUIEditor- Returns:
- the control
-
isPseudoEditor
public boolean isPseudoEditor()
Description copied from interface:GUIEditorReturns whether this representation actually holds an editable SWT element or whether it is a pseudo editor such as a Label.- Specified by:
isPseudoEditorin interfaceGUIEditor- Returns:
trueif it is a pseudo editor,falseelse
-
refreshContents
public void refreshContents()
Description copied from interface:GUIEditorRefreshes the contents of this editor.- Specified by:
refreshContentsin interfaceGUIEditor
-
-