# Class EditField

java.lang.Object
com.codename1.ui.Component
com.codename1.ui.editor.EditorView
com.codename1.ui.EditField

All Implemented Interfaces:
  `Animation, Editable, EditorHost, ActionSource, StyleListener, TextHolder, TextInputClient`

public class EditField extends EditorView implements EditorHost, TextHolder, ActionSource

A pure Codename One text field.

`EditField` is a drop-in alternative to `TextField` / `TextArea` that edits text entirely with the framework's own text engine (the same engine that backs `CodeEditor` and `RichTextArea`) instead of a native peer. Selection, caret movement, word / line navigation, undo and clipboard all work on every port: on iOS, Android and JavaScript the platform soft keyboard, hardware keyboard and IME drive it through the low-level text-input SPI; on the desktop ports the raw physical-keyboard path is used. Because there is no native peer the field is a real, self-contained lightweight component -- it never floats above the UI, scrolls perfectly with its parent and can live anywhere a `Component` can.

It intentionally mirrors the common `TextField` / `TextArea` API (`#setText(String)`, `#getText()`, `#setHint(String)`, `#setConstraint(int)`, `#addDataChangedListener(DataChangedListener)`, `#addActionListener(ActionListener)`, `#setSingleLineTextArea(boolean)`) and implements the same `TextHolder` and `ActionSource` interfaces those components do, so code written against those interfaces (validators, form binding, generic listeners) works unchanged. It also offers the same constructor families: the `TextField`-style constructors create single-line fields while the `TextArea`-style `(rows, columns)` constructors create multi-line editors, making the single- vs multi-line choice explicit at construction. It is still a distinct class -- not assignable to `TextField` / `TextArea` -- so switching to the pure engine is always a deliberate, opt-in choice.

    // single line, like TextField
    EditField name = new EditField("", "Name", TextArea.EMAILADDR);
    name.addActionListener(e -> submit(name.getText()));
    form.add(name);

    // multi line, like TextArea
    EditField notes = new EditField(5, 30);
    form.add(notes);

- ## Field Summary

  ### Fields inherited from class Component

  `BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR`

  ### Fields inherited from interface TextInputClient

  `KEY_BACKSPACE, KEY_COPY, KEY_CUT, KEY_DELETE, KEY_DOWN, KEY_END, KEY_ESCAPE, KEY_HOME, KEY_LEFT, KEY_PAGE_DOWN, KEY_PAGE_UP, KEY_PASTE, KEY_REDO, KEY_RIGHT, KEY_SELECT_ALL, KEY_TAB, KEY_UNDO, KEY_UP, MOD_ALT, MOD_CTRL, MOD_SHIFT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EditField()`
  Creates an empty single-line field.
  `EditField(int columns)`
  Creates an empty single-line field with the given visible column count.
  `EditField(int rows, int columns)`
  Creates an empty multi-line field with the given visible row and column counts (the `TextArea` equivalent).
  `EditField(String text)`
  Creates a single-line field with the given initial text.
  `EditField(String text, int columns)`
  Creates a single-line field with the given text and visible column count.
  `EditField(String text, int rows, int columns)`
  Creates a multi-line field with the given text, visible row and column counts (the `TextArea` equivalent).
  `EditField(String text, int rows, int columns, int constraint)`
  Creates a multi-line field with the given text, visible row and column counts and constraint (the `TextArea` equivalent).
  `EditField(String text, String hint)`
  Creates a single-line field with the given text and hint.
  `EditField(String text, String hint, int constraint)`
  Creates a single-line field with the given text, hint and constraint.
  `EditField(String text, String hint, int columns, int constraint)`
  Creates a single-line field with the given text, hint, visible column count and constraint.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addActionListener(ActionListener l)`
  Adds a listener notified when the action key (return on a single-line field) is pressed.
  `void`
  `addDataChangedListener(DataChangedListener l)`
  Adds a listener notified whenever the text changes.
  `protected Dimension`
  `calcPreferredSize()`
  Calculates the preferred size based on component content.
  `void`
  `editorChanged()`
  Notifies the owning editor that the document content changed so it can fire its change listeners.
  `void`
  `fireEditorEvent(String type, String value)`
  Delivers a semantic editor event (e.g. a code completion request) back to the owning editor.
  `int`
  `getColumns()`
  Returns the number of visible columns.
  `TextInputConfig`
  `getConfig()`
  Returns the configuration describing the desired keyboard type and input behavior.
  `int`
  `getConstraint()`
  Returns the input constraint.
  `String`
  `getHint()`
  Returns the placeholder text.
  `int`
  `getRows()`
  Returns the number of visible rows.
  `protected boolean`
  `handleTypedText(String text)`
  Hook giving feature layers a chance to intercept typed text before the default insertion (used by the code editor for bracket / quote auto close, tab expansion and auto indent).
  `boolean`
  `isEditable()`
  Returns whether the field is editable.
  `boolean`
  `isSingleLineTextArea()`
  True for a single-line field (the default).
  `boolean`
  `isTextInputSupported()`
  True when the platform can bind a low level text input client (see `com.codename1.impl.CodenameOneImplementation#isTextInputSupported`).
  `void`
  `onEditorAction(int action)`
  Delivers the keyboard return key action (done / next / search / send) configured through `TextInputConfig`.
  `void`
  `paint(Graphics g)`
  This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.
  `void`
  `removeActionListener(ActionListener l)`
  Removes an action listener.
  `void`
  `removeDataChangedListener(DataChangedListener l)`
  Removes a data changed listener.
  `void`
  `setActionType(int actionType)`
  Sets the soft-keyboard action button for a single-line field (one of the `TextInputConfig#ACTION_DONE` family).
  `void`
  `setColumns(int columns)`
  Sets the number of visible columns used to compute the preferred width.
  `void`
  `setConstraint(int constraint)`
  Sets the input constraint (one of the `TextArea` constraint constants) that hints the platform keyboard (e.g. email, numeric, URL).
  `void`
  `setEditable(boolean editable)`
  Sets whether the field is editable.
  `EditField`
  `setHint(String hint)`
  Sets the placeholder text shown while the field is empty.
  `void`
  `setRows(int rows)`
  Sets the number of visible rows used to compute the preferred height (multi-line fields).
  `void`
  `setSingleLineTextArea(boolean singleLine)`
  Sets whether this is a single-line field.
  `Object`
  `startTextInput(TextInputClient client, TextInputConfig config)`
  Binds the client to the platform text input source and returns an opaque handle.
  `void`
  `stopTextInput(Object handle)`
  Unbinds a previously bound text input client.
  `void`
  `updateTextInputState(Object handle, TextInputState state)`
  Pushes the client's editing state down to the bound input source.

  ### Methods inherited from class EditorView

  `animate, baseFontSizePixels, blur, captureDocumentState, columnAtX, commitText, consumesRawTextInput, contentTotalHeight, contentWidth, copySelection, cutSelection, deinitialize, deleteBackward, deleteSurroundingText, documentEdited, documentReplaced, documentReset, finishComposing, firstVisibleLine, focusGained, focusLost, getCaretOffset, getCaretRect, getContentLeftInset, getDocument, getEditingState, getEditorFont, getHorizontalScroll, getLineHeight, getMaximumVerticalScroll, getSelectionEnd, getSelectionStart, getText, getTextColor, getTextLength, getTextRange, getUndoManager, getVerticalScroll, handleTab, hasSelection, host, inputFocusGained, inputFocusLost, insertText, invalidateLayout, isEditableState, isEditAllowed, keyPressed, keyReleased, keyRepeated, laidOut, lineAtContentY, lineContentOffsetX, lineHeightAt, lineTop, lineTopContent, lineVisualSegments, longPointerPress, measureColumnX, moveCaret, offsetAtPoint, onKeyCommand, paintBeforeContent, paintComposingUnderline, paintContent, paintLine, paintLineDecorations, pasteClipboard, pasteClipboardData, performRedo, performUndo, pointerDragged, pointerPressed, pointerReleased, rectForOffset, refreshUndoAfterState, replaceRange, replaceRange, restoreDocumentState, scrollByPixels, selectAll, selectionRects, setBackgroundColor, setComposingText, setEditableState, setEditorHost, setFontSizeDips, setSelectionColor, setSelectionRange, setText, setTextColor, uniformLineHeight`

  ### Methods inherited from class Component

  `accessibilityChanged, accessibilityChanged, addContextMenuListener, addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addMouseWheelListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, addStylusListener, announceForAccessibility, bindProperty, blocksSideSwipe, calcScrollSize, cancelRepaints, clearClientProperties, contains, containsOrOwns, createStyleAnimation, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, dragInitiated, drawDraggedImage, drop, fireClicked, getAbsoluteX, getAbsoluteY, getAccessibilityNode, getAccessibilityText, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBottomGap, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getGridPosX, getGridPosY, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSemantics, getSideGap, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUIManager, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initLaf, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditing, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isHScrollThumbGrabbed, isHScrollThumbHover, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSelectableInteraction, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, isVScrollThumbGrabbed, isVScrollThumbHover, longKeyPress, onScrollX, onScrollY, onSetFocusable, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, paramString, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, refreshTheme, remove, removeContextMenuListener, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removeMouseWheelListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, removeStylusListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, rotation, scrollRectToVisible, scrollRectToVisible, setAccessibilityText, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCellRenderer, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setHorizontalScrollBounds, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setPropertyValue, setPullToRefresh, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUIIDFinal, setUnselectedStyle, setVerticalScrollBounds, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface TextHolder

  `getText, setText`

- ## Constructor Details

  - ### EditField

    public EditField()
    Creates an empty single-line field.

  - ### EditField

    public EditField(int columns)

    Creates an empty single-line field with the given visible column count.

    ###### Parameters

    - `columns`: the number of visible columns used to compute the preferred width

  - ### EditField

    public EditField(String text)

    Creates a single-line field with the given initial text.

    ###### Parameters

    - `text`: the initial text

  - ### EditField

    public EditField(String text, int columns)

    Creates a single-line field with the given text and visible column count.

    ###### Parameters

    - `text`: the initial text

    - `columns`: the number of visible columns

  - ### EditField

    public EditField(String text, String hint)

    Creates a single-line field with the given text and hint.

    ###### Parameters

    - `text`: the initial text

    - `hint`: the placeholder shown while empty

  - ### EditField

    public EditField(String text, String hint, int constraint)

    Creates a single-line field with the given text, hint and constraint.

    ###### Parameters

    - `text`: the initial text

    - `hint`: the placeholder shown while empty

    - `constraint`: one of the `TextArea` constraint constants (e.g. `TextArea#EMAILADDR`)

  - ### EditField

    public EditField(String text, String hint, int columns, int constraint)

    Creates a single-line field with the given text, hint, visible column count and constraint.

    ###### Parameters

    - `text`: the initial text

    - `hint`: the placeholder shown while empty

    - `columns`: the number of visible columns

    - `constraint`: one of the `TextArea` constraint constants (e.g. `TextArea#EMAILADDR`)

  - ### EditField

    public EditField(int rows, int columns)

    Creates an empty multi-line field with the given visible row and column counts (the `TextArea` equivalent). Using this constructor sets the field to multi-line mode.

    ###### Parameters

    - `rows`: the number of visible rows used to compute the preferred height

    - `columns`: the number of visible columns

  - ### EditField

    public EditField(String text, int rows, int columns)

    Creates a multi-line field with the given text, visible row and column counts (the `TextArea` equivalent). Using this constructor sets the field to multi-line mode.

    ###### Parameters

    - `text`: the initial text

    - `rows`: the number of visible rows

    - `columns`: the number of visible columns

  - ### EditField

    public EditField(String text, int rows, int columns, int constraint)

    Creates a multi-line field with the given text, visible row and column counts and constraint (the `TextArea` equivalent). Using this constructor sets the field to multi-line mode.

    ###### Parameters

    - `text`: the initial text

    - `rows`: the number of visible rows

    - `columns`: the number of visible columns

    - `constraint`: one of the `TextArea` constraint constants

- ## Method Details

  - ### isTextInputSupported

    public boolean isTextInputSupported()
    Description copied from interface: `EditorHost`
    True when the platform can bind a low level text input client (see `com.codename1.impl.CodenameOneImplementation#isTextInputSupported`).
    Specified by:
      `isTextInputSupported` in interface `EditorHost`

  - ### startTextInput

    public Object startTextInput(TextInputClient client, TextInputConfig config)
    Description copied from interface: `EditorHost`
    Binds the client to the platform text input source and returns an opaque handle.
    Specified by:
      `startTextInput` in interface `EditorHost`

  - ### updateTextInputState

    public void updateTextInputState(Object handle, TextInputState state)
    Description copied from interface: `EditorHost`
    Pushes the client's editing state down to the bound input source.
    Specified by:
      `updateTextInputState` in interface `EditorHost`

  - ### stopTextInput

    public void stopTextInput(Object handle)
    Description copied from interface: `EditorHost`
    Unbinds a previously bound text input client.
    Specified by:
      `stopTextInput` in interface `EditorHost`

  - ### editorChanged

    public void editorChanged()
    Description copied from interface: `EditorHost`
    Notifies the owning editor that the document content changed so it can fire its change listeners.
    Specified by:
      `editorChanged` in interface `EditorHost`

  - ### fireEditorEvent

    public void fireEditorEvent(String type, String value)
    Description copied from interface: `EditorHost`
    Delivers a semantic editor event (e.g. a code completion request) back to the owning editor.
    Specified by:
      `fireEditorEvent` in interface `EditorHost`

  - ### getConfig

    public TextInputConfig getConfig()
    Description copied from interface: `TextInputClient`
    Returns the configuration describing the desired keyboard type and input behavior.
    Specified by:
      `getConfig` in interface `TextInputClient`
    Overrides:
      `getConfig` in class `EditorView`

  - ### onEditorAction

    public void onEditorAction(int action)
    Description copied from interface: `TextInputClient`

    Delivers the keyboard return key action (done / next / search / send) configured through `TextInputConfig`.

    ###### Parameters

    - `action`: one of the `TextInputConfig` `ACTION_*` constants
    Specified by:
      `onEditorAction` in interface `TextInputClient`
    Overrides:
      `onEditorAction` in class `EditorView`

  - ### handleTypedText

    protected boolean handleTypedText(String text)
    Description copied from class: `EditorView`

    Hook giving feature layers a chance to intercept typed text before the default insertion (used by the code editor for bracket / quote auto close, tab expansion and auto indent). Return true when the text was consumed. The default returns false.

    ###### Parameters

    - `text`: the text being typed / committed
    Overrides:
      `handleTypedText` in class `EditorView`

  - ### setHint

    public EditField setHint(String hint)

    Sets the placeholder text shown while the field is empty.

    ###### Parameters

    - `hint`: the placeholder, or null / empty for none

  - ### getHint

    public String getHint()
    Returns the placeholder text.

  - ### isSingleLineTextArea

    public boolean isSingleLineTextArea()
    True for a single-line field (the default). A single-line field fires its action listeners on the return key instead of inserting a line break.

  - ### setSingleLineTextArea

    public void setSingleLineTextArea(boolean singleLine)

    Sets whether this is a single-line field. Passing false makes it a multi-line editor.

    ###### Parameters

    - `singleLine`: true for a single line, false for multi-line

  - ### setConstraint

    public void setConstraint(int constraint)

    Sets the input constraint (one of the `TextArea` constraint constants) that hints the platform keyboard (e.g. email, numeric, URL).

    ###### Parameters

    - `constraint`: a `TextArea` constraint constant

  - ### getConstraint

    public int getConstraint()
    Returns the input constraint.

  - ### setActionType

    public void setActionType(int actionType)
    Sets the soft-keyboard action button for a single-line field (one of the `TextInputConfig#ACTION_DONE` family).

  - ### setRows

    public void setRows(int rows)
    Sets the number of visible rows used to compute the preferred height (multi-line fields).

  - ### getRows

    public int getRows()
    Returns the number of visible rows.

  - ### setColumns

    public void setColumns(int columns)
    Sets the number of visible columns used to compute the preferred width.

  - ### getColumns

    public int getColumns()
    Returns the number of visible columns.

  - ### setEditable

    public void setEditable(boolean editable)

    Sets whether the field is editable. A non-editable field still allows selection and copying.

    ###### Parameters

    - `editable`: true to allow editing

  - ### isEditable

    public boolean isEditable()
    Returns whether the field is editable.
    Specified by:
      `isEditable` in interface `Editable`
    Overrides:
      `isEditable` in class `Component`

  - ### addDataChangedListener

    public void addDataChangedListener(DataChangedListener l)
    Adds a listener notified whenever the text changes.

  - ### removeDataChangedListener

    public void removeDataChangedListener(DataChangedListener l)
    Removes a data changed listener.

  - ### addActionListener

    public void addActionListener(ActionListener l)
    Adds a listener notified when the action key (return on a single-line field) is pressed.
    Specified by:
      `addActionListener` in interface `ActionSource`

  - ### removeActionListener

    public void removeActionListener(ActionListener l)
    Removes an action listener.
    Specified by:
      `removeActionListener` in interface `ActionSource`

  - ### paint

    public void paint(Graphics g)
    Description copied from class: `Component`

    This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.

    ###### Parameters

    - `g`: the component graphics
    Specified by:
      `paint` in interface `Animation`
    Overrides:
      `paint` in class `EditorView`

  - ### calcPreferredSize

    protected Dimension calcPreferredSize()
    Description copied from class: `Component`

    Calculates the preferred size based on component content. This method is invoked lazily by getPreferred size.

    ###### Returns

    the calculated preferred size based on component content

    Overrides:
      `calcPreferredSize` in class `EditorView`