Class CheckBoxCellEditor

  • All Implemented Interfaces:
    ICellEditor

    public class CheckBoxCellEditor
    extends AbstractCellEditor
    ICellEditor implementation for checkbox editors. Compared to a TextCellEditor, this editor will immediately commit and close itself on interaction. This is the same behaviour like a regular for a regular checkbox.
    • Constructor Detail

      • CheckBoxCellEditor

        public CheckBoxCellEditor()
    • Method Detail

      • activateCell

        protected org.eclipse.swt.widgets.Control activateCell​(org.eclipse.swt.widgets.Composite parent,
                                                               Object originalCanonicalValue)
        As soon as the editor is activated, flip the current data value and commit it. The repaint will pick up the new value and flip the image. This is only done if the mouse click is done within the rectangle of the painted checkbox image.
        Specified by:
        activateCell in class AbstractCellEditor
        Parameters:
        parent - The parent Composite, needed for the creation of the editor control.
        originalCanonicalValue - The value that should be put to the activated editor control.
        Returns:
        The SWT Control to be used for capturing the new cell value.
      • getEditorValue

        public Boolean getEditorValue()
        Description copied from interface: ICellEditor
        Returns the current value in this editor prior to conversion. For a text editor that is used to edit integer values, this would mean it returns the text value instead of the converted integer value. This method is only intended to be used internally .
        Returns:
        The current value in this editor prior to conversion.
      • setEditorValue

        public void setEditorValue​(Object value)
        Sets the given value to editor control. As this method is called by AbstractCellEditor.setCanonicalValue(Object) the given value should be already a converted Boolean value. The only other values accepted in here are null which is interpreted as false and Strings than can be converted to Boolean directly. Every other object will result in setting the editor value to false.
        Parameters:
        value - The display value to set to the wrapped editor control.
      • getEditorControl

        public org.eclipse.swt.widgets.Canvas getEditorControl()
        Returns:
        The editor control that is wrapped by this ICellEditor.
      • createEditorControl

        public org.eclipse.swt.widgets.Canvas createEditorControl​(org.eclipse.swt.widgets.Composite parent)
        Description copied from interface: ICellEditor
        Creates the editor control that is wrapped by this ICellEditor. Will use the style configurations in ConfigRegistry for styling the control.
        Parameters:
        parent - The Composite that will be the parent of the new editor control. Can not be null
        Returns:
        The created editor control that is wrapped by this ICellEditor.
      • openMultiEditDialog

        public boolean openMultiEditDialog()
        Description copied from interface: ICellEditor
        This is a very special configuration to tell whether an ICellEditor should open a multi edit dialog for multi editing or not. Usually for multi editing there should be always a multi edit dialog be opened. There are only special cases where this doesn't make sense. The only types of ICellEditors that shouldn't open multi edit dialogs are editors that change their values directly and there is no interactively editor control opened, e.g. checkboxes.
        Specified by:
        openMultiEditDialog in interface ICellEditor
        Overrides:
        openMultiEditDialog in class AbstractCellEditor
        Returns:
        true if for multi editing a multi edit dialog should be opened, false if the multi editing should be performed directly without opening a multi edit dialog. Note: true is the default value and changing it to false for a custom editor might cause issues if not dealed correctly.
      • activateAtAnyPosition

        public boolean activateAtAnyPosition()
        Description copied from interface: ICellEditor
        This method is intended to be used by IMouseEventMatcher implementations that need to check for the editor and the click position to determine whether an editor should be activated or not. By default this method will return true. Special implementations that need a different behavior need to return false instead. E.g. checkbox editors should only be activated in case the icon that represents the checkbox is clicked.
        Specified by:
        activateAtAnyPosition in interface ICellEditor
        Overrides:
        activateAtAnyPosition in class AbstractCellEditor
        Returns:
        true if this ICellEditor should be activated by clicking at any position in the corresponding cell, false if there need to be a special position clicked.