Class CDateTimeCellEditor
java.lang.Object
org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor
org.eclipse.nebula.widgets.nattable.extension.nebula.cdatetime.CDateTimeCellEditor
- All Implemented Interfaces:
ICellEditor
ICellEditor implementation that uses the Nebula
CDateTime
control for
editing. It supports objects of type Date and Calendar aswell.
Introduces the contract that the editor control value is of type Calendar. Therefore the methods to deal with the canonical values need to be overriden too, to avoid conversion of the canonical value to display value by using the IDisplayConverter that is registered together with this editor.
- Since:
- 1.1
-
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
ConstructorDescriptionCreates the default DateCellEditor that does not move the selection on committing the value by pressing enter.CDateTimeCellEditor
(boolean moveSelectionOnEnter) Creates a DateCellEditor.CDateTimeCellEditor
(boolean moveSelectionOnEnter, int style) Creates a DateCellEditor. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.swt.widgets.Control
activateCell
(org.eclipse.swt.widgets.Composite parent, Object originalCanonicalValue) This method will be called byAbstractCellEditor.activateCell(Composite, Object, EditModeEnum, ICellEditHandler, ILayerCell, IConfigRegistry)
after initializing the activation values and before adding the default listeners.org.eclipse.nebula.widgets.cdatetime.CDateTime
createEditorControl
(org.eclipse.swt.widgets.Composite parent) Creates the editor control that is wrapped by this ICellEditor.Converts the current value in this editor using the configuredIDisplayConverter
.org.eclipse.nebula.widgets.cdatetime.CDateTime
Returns the current value in this editor prior to conversion.void
setCanonicalValue
(Object canonicalValue) Sets the given canonical value to the wrapped editor control.void
setEditorValue
(Object value) Sets the given value to editor control.void
setProvideCalendar
(boolean provideCalendar) Methods inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor
activateAtAnyPosition, activateCell, activateOnTraversal, addEditorControlListeners, calculateControlBounds, close, commit, commit, commit, getCanonicalValue, getColumnIndex, getColumnPosition, getRowIndex, getRowPosition, handleConversion, isClosed, openAdjacentEditor, openInline, openMultiEditDialog, removeEditorControlListeners, setDataValidator, supportMultiEdit, validateCanonicalValue, validateCanonicalValue
-
Constructor Details
-
CDateTimeCellEditor
public CDateTimeCellEditor()Creates the default DateCellEditor that does not move the selection on committing the value by pressing enter. -
CDateTimeCellEditor
public CDateTimeCellEditor(boolean moveSelectionOnEnter) Creates a DateCellEditor.- Parameters:
moveSelectionOnEnter
- Flag to configure whether the selection should move after a value was committed after pressing enter.
-
CDateTimeCellEditor
public CDateTimeCellEditor(boolean moveSelectionOnEnter, int style) Creates a DateCellEditor.- Parameters:
moveSelectionOnEnter
- Flag to configure whether the selection should move after a value was committed after pressing enter.style
- The style bits that should be used to create theCDateTime
control of the editor.
-
-
Method Details
-
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
Description copied from interface:ICellEditor
Sets the given value to editor control. This method is used to put the display values to the wrapped editor.- Parameters:
value
- The display value to set to the wrapped editor control.
-
getCanonicalValue
Description copied from class:AbstractCellEditor
Converts the current value in this editor using the configuredIDisplayConverter
. If there is noIDisplayConverter
registered for this editor, the value itself will be returned.- Specified by:
getCanonicalValue
in interfaceICellEditor
- Overrides:
getCanonicalValue
in classAbstractCellEditor
- Returns:
- The canonical value after converting the current value or the
value itself if no
IDisplayConverter
is configured. - See Also:
-
setCanonicalValue
Description copied from interface:ICellEditor
Sets the given canonical value to the wrapped editor control. Prior to setting the value it needs to be converted to the display value, using the configuredIDisplayConverter
.- Specified by:
setCanonicalValue
in interfaceICellEditor
- Overrides:
setCanonicalValue
in classAbstractCellEditor
- Parameters:
canonicalValue
- The canonical value to be set to the wrapped editor control.
-
getEditorControl
public org.eclipse.nebula.widgets.cdatetime.CDateTime getEditorControl()- Returns:
- The editor control that is wrapped by this ICellEditor.
-
createEditorControl
public org.eclipse.nebula.widgets.cdatetime.CDateTime 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.
-
activateCell
protected org.eclipse.swt.widgets.Control activateCell(org.eclipse.swt.widgets.Composite parent, Object originalCanonicalValue) Description copied from class:AbstractCellEditor
This method will be called byAbstractCellEditor.activateCell(Composite, Object, EditModeEnum, ICellEditHandler, ILayerCell, IConfigRegistry)
after initializing the activation values and before adding the default listeners. In this method the underlying editor control should be created and initialized, hiding default configuration from editor implementors.- 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.
-
setProvideCalendar
public void setProvideCalendar(boolean provideCalendar)
-