Class MultiLineTextCellEditor

All Implemented Interfaces:
ICellEditor

public class MultiLineTextCellEditor extends TextCellEditor
A specialization of TextCellEditor 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 to true 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 return false.

  • Constructor Details

    • 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 Details

    • 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 interface ICellEditor
      Overrides:
      createEditorControl in class TextCellEditor
      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.
    • 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 interface ICellEditor
      Overrides:
      calculateControlBounds in class AbstractCellEditor
      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