Class CDateTimeCellEditor

  • All Implemented Interfaces:
    ICellEditor

    public class CDateTimeCellEditor
    extends AbstractCellEditor
    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
    • Constructor Detail

      • 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 the CDateTime control of the editor.
    • Method Detail

      • getEditorValue

        public Object 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)
        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.
      • setCanonicalValue

        public void setCanonicalValue​(Object canonicalValue)
        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 configured IDisplayConverter.
        Specified by:
        setCanonicalValue in interface ICellEditor
        Overrides:
        setCanonicalValue in class AbstractCellEditor
        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 be null
        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 by AbstractCellEditor.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 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.
      • setProvideCalendar

        public void setProvideCalendar​(boolean provideCalendar)
        Parameters:
        provideCalendar - true if this editor should provide a Calendar object on editing, false if it should provide a Date object.