public class TextCellEditor extends AbstractCellEditor
ICellEditor
implementation that wraps a SWT Text
control to support
text editing. This is also the default editor in NatTable if you didn't configure
something else.Modifier and Type | Field and Description |
---|---|
protected boolean |
commitOnEnter
Flag to determine whether this editor should try to commit and close on pressing the enter key.
|
protected ControlDecorationProvider |
decorationProvider
The
ControlDecorationProvider responsible for adding a ControlDecoration
to the wrapped editor control. |
cellStyle, configRegistry, conversionEditErrorHandler, dataValidator, displayConverter, editMode, labelStack, layerCell, validationEditErrorHandler
Constructor and Description |
---|
TextCellEditor()
Creates the default TextCellEditor that does not commit on pressing the up/down arrow keys
and will not move the selection on committing a value by pressing enter.
|
TextCellEditor(boolean commitOnUpDown)
Creates a TextCellEditor that will not move the selection on committing a value by pressing enter.
|
TextCellEditor(boolean commitOnUpDown,
boolean moveSelectionOnEnter)
Creates a TextCellEditor.
|
Modifier and Type | Method and Description |
---|---|
protected org.eclipse.swt.widgets.Control |
activateCell(org.eclipse.swt.widgets.Composite parent,
Object originalCanonicalValue)
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. |
void |
close()
Close/dispose the contained
Control |
org.eclipse.swt.widgets.Text |
createEditorControl(org.eclipse.swt.widgets.Composite parent)
Creates the editor control that is wrapped by this ICellEditor.
|
protected org.eclipse.swt.widgets.Text |
createEditorControl(org.eclipse.swt.widgets.Composite parent,
int style)
Creates the editor control that is wrapped by this ICellEditor.
|
ControlDecorationProvider |
getDecorationProvider() |
org.eclipse.swt.widgets.Text |
getEditorControl() |
String |
getEditorValue()
Returns the current value in this editor prior to conversion.
|
IEditErrorHandler |
getInputConversionErrorHandler() |
IEditErrorHandler |
getInputValidationErrorHandler() |
EditorSelectionEnum |
getSelectionMode()
Returns the current configured selection mode that is used on activating the wrapped
text editor control.
|
boolean |
isEditable() |
void |
setDecorationPositionOverride(int decorationPositionOverride)
Set the position of the control decoration relative to the control.
|
void |
setEditable(boolean editable) |
void |
setEditorValue(Object value)
Sets the given value to editor control.
|
void |
setErrorDecorationEnabled(boolean enabled)
Enables/disables the error decoration for the wrapped text control.
|
void |
setErrorDecorationText(String errorText)
Set the error description text that will be shown in the decoration hover.
|
void |
setInputConversionErrorHandler(IEditErrorHandler inputConversionErrorHandler) |
void |
setInputValidationErrorHandler(IEditErrorHandler inputValidationErrorHandler) |
void |
setSelectionMode(EditorSelectionEnum selectionMode)
Set the selection mode that should be used on the content of the wrapped text editor control
when it gets activated.
|
void |
showErrorDecorationHover(String customErrorText)
Force the error decoration hover to show immediately.
|
activateAtAnyPosition, activateCell, addEditorControlListeners, commit, commit, commit, getCanonicalValue, getCanonicalValue, getColumnIndex, getColumnPosition, getRowIndex, getRowPosition, handleConversion, isClosed, openAdjacentEditor, openInline, removeEditorControlListeners, setCanonicalValue, setDataValidator, supportMultiEdit, validateCanonicalValue, validateCanonicalValue
protected final ControlDecorationProvider decorationProvider
ControlDecorationProvider
responsible for adding a ControlDecoration
to the wrapped editor control. Can be configured via convenience methods of this TextCellEditor.protected boolean commitOnEnter
true
, but for a multi line text editor, the enter key
should be treated as inserting a new line instead of committing.public TextCellEditor()
public TextCellEditor(boolean commitOnUpDown)
commitOnUpDown
- Flag to configure whether the editor should commit
and move the selection in the corresponding way if the up or down key is pressed.public TextCellEditor(boolean commitOnUpDown, boolean moveSelectionOnEnter)
commitOnUpDown
- Flag to configure whether the editor should commit
and move the selection in the corresponding way if the up or down key is pressed.moveSelectionOnEnter
- Flag to configure whether the selection should move after a value was
committed after pressing enter.protected org.eclipse.swt.widgets.Control activateCell(org.eclipse.swt.widgets.Composite parent, Object originalCanonicalValue)
AbstractCellEditor
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.activateCell
in class AbstractCellEditor
parent
- The parent Composite, needed for the creation of the editor control.originalCanonicalValue
- The value that should be put to the activated editor control.Control
to be used for capturing the new cell value.public String getEditorValue()
ICellEditor
public void setEditorValue(Object value)
ICellEditor
value
- The display value to set to the wrapped editor control.public org.eclipse.swt.widgets.Text getEditorControl()
public org.eclipse.swt.widgets.Text createEditorControl(org.eclipse.swt.widgets.Composite parent)
ICellEditor
parent
- The Composite that will be the parent of the new editor control.
Can not be null
protected org.eclipse.swt.widgets.Text createEditorControl(org.eclipse.swt.widgets.Composite parent, int style)
parent
- The Composite that will be the parent of the new editor control.
Can not be null
style
- The SWT style of the text control to create.public void close()
ICellEditor
Control
close
in interface ICellEditor
close
in class AbstractCellEditor
public boolean isEditable()
true
if the wrapped Text control is editable,
false
if not.public void setEditable(boolean editable)
editable
- true
if the wrapped Text control should be editable,
false
if not.public final EditorSelectionEnum getSelectionMode()
null
which causes the following
default behaviour. If the text editor control is activated with an initial value then
the selection is set at the end of the containing text. If it is activated
only specifying the original canonical value, the default behaviour is to select
the whole text contained in the text editor control.null
for default behaviour.public final void setSelectionMode(EditorSelectionEnum selectionMode)
null
will reactivate the default behaviour like described
here getSelectionMode()
.selectionMode
- The selection mode that should be used on the content of the
wrapped text editor control when it gets activated.public ControlDecorationProvider getDecorationProvider()
ControlDecorationProvider
responsible for adding a ControlDecoration
to the wrapped editor control.public void setErrorDecorationEnabled(boolean enabled)
enabled
- true
if an error decoration should be added to
the wrapped text control, false
if not.public void setErrorDecorationText(String errorText)
errorText
- The text to be shown as a description for the decoration, or
null
if there should be no description.ControlDecoration.setDescriptionText(String)
public void showErrorDecorationHover(String customErrorText)
customErrorText
- The text to show in the hover popup.ControlDecoration.show()
,
ControlDecoration.showHoverText(String)
public void setDecorationPositionOverride(int decorationPositionOverride)
decorationPositionOverride
- bit-wise or of position constants (SWT.TOP
,
SWT.BOTTOM
, SWT.LEFT
,
SWT.RIGHT
, and SWT.CENTER
).ControlDecoration.ControlDecoration(Control, int)
public IEditErrorHandler getInputConversionErrorHandler()
IEditErrorHandler
that is used for showing conversion errors on typing into
this editor. By default this is the RenderErrorHandling
which will render the
content in the editor red to indicate a conversion error.public void setInputConversionErrorHandler(IEditErrorHandler inputConversionErrorHandler)
inputConversionErrorHandler
- The IEditErrorHandler
that is should be used for showing
conversion errors on typing into this editor.public IEditErrorHandler getInputValidationErrorHandler()
IEditErrorHandler
that is used for showing validation errors on typing into
this editor. By default this is the RenderErrorHandling
which will render the
content in the editor red to indicate a validation error.public void setInputValidationErrorHandler(IEditErrorHandler inputValidationErrorHandler)
inputValidationErrorHandler
- The IEditErrorHandler
that is should used for showing
validation errors on typing into this editor.Copyright © 2013. All Rights Reserved.