Class ComboboxGUIVariable

    • Constructor Detail

      • ComboboxGUIVariable

        ComboboxGUIVariable​(IDecisionVariable variable,
                            org.eclipse.swt.widgets.Composite parent,
                            IDatatype type,
                            ComboboxGUIVariable.ComboItem[] values,
                            IGUIConfigurableElement confParent)
        Sole constructor for this class.
        Parameters:
        variable - The IDecisionVariable represented by this GUIVariable
        parent - The controlling composite, needed for the creation of CellEditors
        type - The type of this GUIVairable, cannot be set by this constructor since RefernceTypes need a special consideration.
        values - The list of possible values for this GUIVariable.
        confParent - The parent holding this variable. Can be the GUIConfiguration if and only if this variable is a top level variable stored inside the configuration.
    • Method Detail

      • createItems

        private java.lang.String[] createItems()
        Creates the items to be displayed in the resulting combobox.
        Returns:
        the items
      • getCellEditor

        public org.eclipse.jface.viewers.CellEditor getCellEditor​(org.eclipse.swt.widgets.Composite parent)
        Description copied from class: GUIVariable
        Returns a CellEditor for a table.
        Specified by:
        getCellEditor in class GUIVariable
        Parameters:
        parent - The GUI component where this GUIVariable and, thus, its editor are displayed.
        Returns:
        CellEditor to configure the enclosed IDecisionVariable
      • getEditor

        public GUIEditor getEditor()
        Description copied from class: GUIVariable
        Returns the (non-cell) editor for this variable. The editor shall be ready to use, i.e., properly initialized.
        Specified by:
        getEditor in class GUIVariable
        Returns:
        the editor, may be null if the variable shall not be displayed / being edited
      • getValueText

        public java.lang.String getValueText()
        Description copied from class: GUIVariable
        Returns 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:
        getValueText in class GUIVariable
        Returns:
        A string representation of the current value or null.
      • getValue

        public java.lang.Object getValue()
        Description copied from class: GUIVariable
        Returns the value of the given IDecisionVariable so that it can be used as return value for the EditingSupport.getValue(Object) method.
        Specified by:
        getValue in class GUIVariable
        Returns:
        A value as needed by the Eclipse UI.
      • isEqual

        private boolean isEqual​(java.lang.Object currentValue,
                                ComboboxGUIVariable.ComboItem possibleItem)
        Compares the current value of the IDecisionVariable with an element of the possible value from the combo box.
        Parameters:
        currentValue - The current value of the IDecisionVariable, maybe null.
        possibleItem - An item of values.
        Returns:
        true if the currentValue matches the given possibleItem
      • toObjectValue

        private java.lang.Object toObjectValue​(Value value)
        Returns Value.getValue() considering ReferenceValues, which are also handled by this GUIVariable.
        Parameters:
        value - A value from which the value should be extracted from.
        Returns:
        The Value.getValue() or maybe null if no value is set.
      • refreshContents

        java.lang.String[] refreshContents()
        Refreshes the contents of this combobox variable.
        Returns:
        the new combobox elements (may be null if nothing needs to be refreshed)