Class CheckBoxCellEditor
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor
-
- org.eclipse.nebula.widgets.nattable.edit.editor.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor
AbstractCellEditor.InlineFocusListener, AbstractCellEditor.InlineTraverseListener
-
-
Field Summary
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor
cellStyle, configRegistry, conversionEditErrorHandler, dataValidator, displayConverter, editMode, focusListener, labelStack, layerCell, parent, traverseListener, validationEditErrorHandler
-
-
Constructor Summary
Constructors Constructor Description CheckBoxCellEditor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
activateAtAnyPosition()
This method is intended to be used byIMouseEventMatcher
implementations that need to check for the editor and the click position to determine whether an editor should be activated or not.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.boolean
activateOnTraversal(IConfigRegistry configRegistry, List<String> configLabels)
This method is asked on tab traversal whether thisICellEditor
should be automatically activated or not.org.eclipse.swt.widgets.Canvas
createEditorControl(org.eclipse.swt.widgets.Composite parent)
Creates the editor control that is wrapped by this ICellEditor.org.eclipse.swt.widgets.Canvas
getEditorControl()
Boolean
getEditorValue()
Returns the current value in this editor prior to conversion.boolean
openMultiEditDialog()
This is a very special configuration to tell whether an ICellEditor should open a multi edit dialog for multi editing or not.void
setEditorValue(Object value)
Sets the given value to editor control.-
Methods inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor
activateCell, addEditorControlListeners, calculateControlBounds, close, commit, commit, commit, getCanonicalValue, getCanonicalValue, getColumnIndex, getColumnPosition, getRowIndex, getRowPosition, handleConversion, isClosed, openAdjacentEditor, openInline, removeEditorControlListeners, setCanonicalValue, setDataValidator, supportMultiEdit, validateCanonicalValue, validateCanonicalValue
-
-
-
-
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 classAbstractCellEditor
- 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 byAbstractCellEditor.setCanonicalValue(Object)
the given value should be already a converted Boolean value. The only other values accepted in here arenull
which is interpreted asfalse
and Strings than can be converted to Boolean directly. Every other object will result in setting the editor value tofalse
.- 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 benull
- 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 interfaceICellEditor
- Overrides:
openMultiEditDialog
in classAbstractCellEditor
- 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 tofalse
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 byIMouseEventMatcher
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 returntrue
. Special implementations that need a different behavior need to returnfalse
instead. E.g. checkbox editors should only be activated in case the icon that represents the checkbox is clicked.- Specified by:
activateAtAnyPosition
in interfaceICellEditor
- Overrides:
activateAtAnyPosition
in classAbstractCellEditor
- Returns:
true
if thisICellEditor
should be activated by clicking at any position in the corresponding cell,false
if there need to be a special position clicked.
-
activateOnTraversal
public boolean activateOnTraversal(IConfigRegistry configRegistry, List<String> configLabels)
Description copied from interface:ICellEditor
This method is asked on tab traversal whether thisICellEditor
should be automatically activated or not. This is necessary to avoid automatically changing the value of a checkbox or opening a dialog editor on traversal.- Specified by:
activateOnTraversal
in interfaceICellEditor
- Overrides:
activateOnTraversal
in classAbstractCellEditor
- Parameters:
configRegistry
- TheIConfigRegistry
to retrieve the configuration out of. Needed here because the instanceIConfigRegistry
might not be set on calling this method.configLabels
- The labels out of the LabelStack of the cell whose editor should be activated.- Returns:
true
if thisICellEditor
should be activated in case of tab traversal,false
if not.- See Also:
EditConfigAttributes.ACTIVATE_EDITOR_ON_TRAVERSAL
-
-