Class MultiLineTextCellEditor
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor
-
- org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor
-
- org.eclipse.nebula.widgets.nattable.edit.editor.MultiLineTextCellEditor
-
- All Implemented Interfaces:
ICellEditor
public class MultiLineTextCellEditor extends TextCellEditor
A specialization ofTextCellEditor
that uses a multi line text editor as editor control. To support multi line editing correctly, the behaviour to commit on pressing the enter key is disabled.A multi line editor usually needs some space. Therefore it might be a good decision to set the configuration attribute
EditConfigAttributes.OPEN_IN_DIALOG
totrue
for this editor, so the editor always opens in a subdialog.As some table layouts may support enough space for an inline cell editor, this editor does not specify
ICellEditor.openInline(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.util.List)
to always returnfalse
.
-
-
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.TextCellEditor
autoActivationCharacters, autoActivationDelay, commitOnEnter, contentProposalAdapter, controlContentAdapter, decorationProvider, keyStroke, proposalAcceptanceStyle, proposalProvider
-
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 MultiLineTextCellEditor()
Create a new multi line text editor that ensures to not commit the editor value in case enter is typed.MultiLineTextCellEditor(boolean lineWrap)
Create a new multi line text editor that ensures to not commit the editor value in case enter is typed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.swt.graphics.Rectangle
calculateControlBounds(org.eclipse.swt.graphics.Rectangle cellBounds)
This method is used to calculate the bounds of the edit control when opened inline.org.eclipse.swt.widgets.Text
createEditorControl(org.eclipse.swt.widgets.Composite parent)
Creates the editor control that is wrapped by this ICellEditor.void
setLineWrap(boolean lineWrap)
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor
activateCell, close, configureContentProposalAdapter, createEditorControl, enableContentProposal, enableContentProposal, getDecorationProvider, getEditorControl, getEditorValue, getInputConversionErrorHandler, getInputValidationErrorHandler, getSelectionMode, isCommitOnEnter, isCommitWithCtrlKey, isEditable, isProposalPopupOpen, setCommitOnEnter, setCommitWithCtrlKey, setDecorationPositionOverride, setEditable, setEditorValue, setErrorDecorationEnabled, setFieldDecorationId, setInputConversionErrorHandler, setInputValidationErrorHandler, setSelectionMode, showErrorDecorationHover
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor
activateAtAnyPosition, activateCell, activateOnTraversal, addEditorControlListeners, commit, commit, commit, getCanonicalValue, getCanonicalValue, getColumnIndex, getColumnPosition, getRowIndex, getRowPosition, handleConversion, isClosed, openAdjacentEditor, openInline, openMultiEditDialog, removeEditorControlListeners, setCanonicalValue, setDataValidator, supportMultiEdit, validateCanonicalValue, validateCanonicalValue
-
-
-
-
Constructor Detail
-
MultiLineTextCellEditor
public MultiLineTextCellEditor()
Create a new multi line text editor that ensures to not commit the editor value in case enter is typed. The text control will support automatic line wrapping.
-
MultiLineTextCellEditor
public MultiLineTextCellEditor(boolean lineWrap)
Create a new multi line text editor that ensures to not commit the editor value in case enter is typed.- Parameters:
lineWrap
- Flag to configure whether the text control should enable automatic line wrap behaviour or not.
-
-
Method Detail
-
createEditorControl
public org.eclipse.swt.widgets.Text 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.- Specified by:
createEditorControl
in interfaceICellEditor
- Overrides:
createEditorControl
in classTextCellEditor
- 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.
-
calculateControlBounds
public org.eclipse.swt.graphics.Rectangle calculateControlBounds(org.eclipse.swt.graphics.Rectangle cellBounds)
Description copied from interface:ICellEditor
This method is used to calculate the bounds of the edit control when opened inline. By default it should return the given cell bounds to match the cell structure in NatTable. For several cases it might be useful to return the preferred size to show all content rather than trimming the control to the cell size.Note: By changing the bounds you should ensure to only modify width and height attributes and not x and y coordinate, otherwise the editor control will show up somewhere else and not in place of the cell that is edited.
- Specified by:
calculateControlBounds
in interfaceICellEditor
- Overrides:
calculateControlBounds
in classAbstractCellEditor
- Parameters:
cellBounds
- The bounds of the cell for which the editor is opened.- Returns:
- The bounds of the editor control that should be applied. By default the cell bounds for several cases bigger.
-
setLineWrap
public void setLineWrap(boolean lineWrap)
- Parameters:
lineWrap
-true
if the text control should enable automatic line wrap behaviour,false
if not
-
-