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
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis method is intended to be used byIMouseEventMatcherimplementations 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.ControlactivateCell(org.eclipse.swt.widgets.Composite parent, Object originalCanonicalValue) As soon as the editor is activated, flip the current data value and commit it.booleanactivateOnTraversal(IConfigRegistry configRegistry, List<String> configLabels) This method is asked on tab traversal whether thisICellEditorshould be automatically activated or not.org.eclipse.swt.widgets.CanvascreateEditorControl(org.eclipse.swt.widgets.Composite parent) Creates the editor control that is wrapped by this ICellEditor.org.eclipse.swt.widgets.CanvasReturns the current value in this editor prior to conversion.booleanThis is a very special configuration to tell whether an ICellEditor should open a multi edit dialog for multi editing or not.voidsetEditorValue(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
-
Constructor Details
-
CheckBoxCellEditor
public CheckBoxCellEditor()
-
-
Method Details
-
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:
activateCellin 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
Controlto be used for capturing the new cell value.
-
getEditorValue
Description copied from interface:ICellEditorReturns 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
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 arenullwhich is interpreted asfalseand 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:ICellEditorCreates 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:ICellEditorThis 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:
openMultiEditDialogin interfaceICellEditor- Overrides:
openMultiEditDialogin classAbstractCellEditor- Returns:
trueif for multi editing a multi edit dialog should be opened,falseif the multi editing should be performed directly without opening a multi edit dialog. Note:trueis the default value and changing it tofalsefor a custom editor might cause issues if not dealed correctly.
-
activateAtAnyPosition
public boolean activateAtAnyPosition()Description copied from interface:ICellEditorThis method is intended to be used byIMouseEventMatcherimplementations 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 returnfalseinstead. E.g. checkbox editors should only be activated in case the icon that represents the checkbox is clicked.- Specified by:
activateAtAnyPositionin interfaceICellEditor- Overrides:
activateAtAnyPositionin classAbstractCellEditor- Returns:
trueif thisICellEditorshould be activated by clicking at any position in the corresponding cell,falseif there need to be a special position clicked.
-
activateOnTraversal
Description copied from interface:ICellEditorThis method is asked on tab traversal whether thisICellEditorshould 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:
activateOnTraversalin interfaceICellEditor- Overrides:
activateOnTraversalin classAbstractCellEditor- Parameters:
configRegistry- TheIConfigRegistryto retrieve the configuration out of. Needed here because the instanceIConfigRegistrymight not be set on calling this method.configLabels- The labels out of the LabelStack of the cell whose editor should be activated.- Returns:
trueif thisICellEditorshould be activated in case of tab traversal,falseif not.- See Also:
-