Class SJTextArea
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.textfield.TextArea, String>
com.vaadin.flow.component.AbstractSinglePropertyField<com.vaadin.flow.component.textfield.TextArea, String>
com.vaadin.flow.component.textfield.TextFieldBase<com.vaadin.flow.component.textfield.TextArea, String>
com.vaadin.flow.component.textfield.TextArea
com.vaadin.swingbridge.surrogates.SJTextArea
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.textfield.TextArea>, com.vaadin.flow.component.CompositionNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.textfield.TextArea>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.textfield.TextArea>, com.vaadin.flow.component.HasAriaDescription, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasPlaceholder, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextArea, String>, String>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextArea, String>, String>, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.KeyNotifier, com.vaadin.flow.component.shared.HasAllowedCharPattern, com.vaadin.flow.component.shared.HasClearButton, com.vaadin.flow.component.shared.HasPrefix, com.vaadin.flow.component.shared.HasSuffix, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.textfield.TextAreaVariant>, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextArea, String>, String>, com.vaadin.flow.component.textfield.HasAutocapitalize, com.vaadin.flow.component.textfield.HasAutocomplete, com.vaadin.flow.component.textfield.HasAutocorrect, com.vaadin.flow.data.binder.HasValidator<String>, com.vaadin.flow.data.value.HasValueChangeMode, ComponentMixin, ContainerMixin, EnterClaims.Claimant, JComponentMixin, JTextComponentMixin, Serializable
public class SJTextArea
extends com.vaadin.flow.component.textfield.TextArea
implements JTextComponentMixin, EnterClaims.Claimant
Surrogate for Override surface against
JTextArea, a consumer of SD_sjtextfield's
JTextComponentMixin. Extends Vaadin
TextArea directly (is-a). Reaches the migrator either through
:emulators.JTextArea as peer, or as a richer-than-stock Vaadin
component in its own right.
Why TextArea as peer (not TextField)
VaadinTextArea renders <vaadin-text-area> backed by an
HTML <textarea>, giving multi-line editing with native browser
wrapping — what JTextArea exists to provide. TextArea extends
TextFieldBase (sibling to
TextField /
PasswordField), so the
mixin's R_swing_is_truth sync activates uniformly.
Override surface against JTextComponentMixin
validate()— visibility-widening override required byComponentMixin's publicvalidate()contract. VaadinTextAreadeclares inheritedvalidate()asprotected(input validation, not Swing's layout cycle). Same shape SJTextField / SJPasswordField take per SD_sjtextfield / SD_sjpasswordfield.
JTextArea-specific surface
rows/columns— ctor + setters store the sizing hint and writepeer.setMinRows(N)+peer.setWidthof aCssConvert.columnsToCssWidth(int)character-column hint per R_layouts_close_enough close-enough; negative throws IAE per R_match_swing_errors. JDK fires no PCE for either; we match.tabSize/lineWrap/wrapStyleWord— field-only round-trip with PCE per JDK, no Vaadin counterpart. Vaadin TextArea wraps by default (browser textarea behaviour); there is no toggle to disable wrap without custom CSS, solineWrap=falseis observably ignored — accepted divergence (R_best_effort_behaviour best-effort, same call the emulator made). LikewisetabSizerenders at the browser default.append(String)/insert(String, int)/replaceRange(String, int, int)— Document mutation helpers, all three a bounds check in front of one privatespliceDocumentcall: an append is a splice of the empty span at the end, an insert a splice of the empty span atpos. Each goes through the mixin's Document, so the R_swing_is_truth sync mirrors changes into the peer transparently (the peer never sees a half-updated state). Bad bounds throw IAE per R_match_swing_errors / JDK, each with its own message; nullstris a documented no-op forappend/insertand means "delete only" forreplaceRange.getLineCount()/getLineOfOffset(int)/getLineStartOffset(int)/getLineEndOffset(int)— PlainDocument's default root element holds one child per line, which is exactly Swing's line model for a JTextArea. BadLocationException on out-of-range matches JDK.getUIClassID() == "TextAreaUI".
What is NOT here (vs SJTextField / SJPasswordField)
- No ActionListener wiring on Enter. JDK JTextArea's Enter inserts a newline — that's the whole point of a multi-line editor. The Enter-as-submit shape lives on JTextField only.
- No
setAction(Action). JDK JTextArea doesn't have it (inherited surface stops at JTextComponent, not JTextField). - No
horizontalAlignment. Same — JTextArea doesn't expose it; multi-line text follows ComponentOrientation only.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.textfield.TextArea
com.vaadin.flow.component.textfield.TextArea.TextAreaI18nNested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C,V> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E>Nested classes/interfaces inherited from interface JComponentMixin
JComponentMixin.ActionStandin -
Field Summary
Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocapitalize
AUTOCAPITALIZE_ATTRIBUTEFields inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete
AUTOCOMPLETE_ATTRIBUTEFields inherited from interface com.vaadin.flow.component.textfield.HasAutocorrect
AUTOCORRECT_ATTRIBUTEFields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode
DEFAULT_CHANGE_TIMEOUTFields inherited from interface JComponentMixin
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW -
Constructor Summary
ConstructorsConstructorDescriptionSJTextArea(int rows, int columns) SJTextArea(String text) SJTextArea(String text, int rows, int columns) SJTextArea(Document doc) SJTextArea(Document doc, String text, int rows, int columns) -
Method Summary
Modifier and TypeMethodDescriptionvoidAppendsstrto the Document, a splice of the empty span at the end.booleanEnter inserts a newline while editable — Swing'sinsert-breakbinding.intintNumber of lines in the Document.intgetLineEndOffset(int line) End offset ofline.intgetLineOfOffset(int offset) Index of the line containingoffset.intgetLineStartOffset(int line) Start offset ofline.booleanintgetRows()intDeliberate no-op — L&F key.booleanvoidInsertsstrat offsetpos, a splice of the empty span there.protected StringJDK JTextArea.paramString chains JTextComponent's tail and appends the JTextArea-specific state.voidreplaceRange(String str, int start, int end) Replaces the Document's[start, end)span withstr.voidsetColumns(int columns) voidsetLineWrap(boolean wrap) voidsetRows(int rows) voidsetTabSize(int size) voidsetWrapStyleWord(boolean word) voidvalidate()Visibility-widening override ofTextArea.validate()to satisfyComponentMixin's publicvalidate()contract.Methods inherited from class com.vaadin.flow.component.textfield.TextArea
getDefaultValidator, getEmptyValue, getI18n, getMaxLength, getMaxRows, getMinLength, getMinRows, getPattern, getValue, scrollToEnd, scrollToStart, setErrorMessage, setI18n, setManualValidation, setMaxLength, setMaxRows, setMinLength, setMinRows, setPattern, setRequiredIndicatorVisible, setValueMethods inherited from class com.vaadin.flow.component.textfield.TextFieldBase
addToInput, addToPrefix, addToSuffix, getAriaDescribedBy, getAriaLabel, getAriaLabelledBy, getTitle, getValueChangeMode, getValueChangeTimeout, isAutofocus, isAutoselect, isRequired, isRequiredIndicatorVisible, setAriaDescribedBy, setAriaLabel, setAriaLabelledBy, setAutofocus, setAutoselect, setLabel, setRequired, setTitle, setValueChangeMode, setValueChangeTimeoutMethods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, bindValue, isEmpty, setModelValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttachedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface ComponentMixin
_installSwingClass, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, dispatchEvent, doLayout, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getComponentListeners, getCursor, getFocusListeners, getFont, getForeground, getGraphics, getHierarchyBoundsListeners, getHierarchyListeners, getKeyListeners, getLocation, getMaximumSize, getMinimumSize, getMouseListeners, getName, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolTipText, getX, getY, grabFocus, hasFocus, invalidate, isDisplayable, isFocusable, isFocusOwner, isShowing, paint, paintAll, print, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, revalidate, setBackground, setBounds, setBounds, setCursor, setFocusable, setFont, setForeground, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, transferFocus, transferFocusBackward, transferFocusUpCycle, updateMethods inherited from interface com.vaadin.flow.component.CompositionNotifier
addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListenerMethods inherited from interface ContainerMixin
addContainerListener, getContainerListeners, getLayout, paintComponents, printComponents, removeContainerListener, setLayoutMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.shared.HasAllowedCharPattern
getAllowedCharPattern, setAllowedCharPatternMethods inherited from interface com.vaadin.flow.component.HasAriaDescription
setAriaDescribedByMethods inherited from interface com.vaadin.flow.component.HasAriaLabel
setAriaLabelledByMethods inherited from interface com.vaadin.flow.component.textfield.HasAutocapitalize
getAutocapitalize, setAutocapitalizeMethods inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete
getAutocomplete, setAutocompleteMethods inherited from interface com.vaadin.flow.component.textfield.HasAutocorrect
isAutocorrect, setAutocorrectMethods inherited from interface com.vaadin.flow.component.shared.HasClearButton
bindClearButtonVisible, isClearButtonVisible, setClearButtonVisibleMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
bindHelperText, getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasLabel
getLabelMethods inherited from interface com.vaadin.flow.component.HasPlaceholder
bindPlaceholder, getPlaceholder, setPlaceholderMethods inherited from interface com.vaadin.flow.component.shared.HasPrefix
getPrefixComponent, setPrefixComponentMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.shared.HasSuffix
getSuffixComponent, setSuffixComponentMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, bindThemeVariant, bindThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariantsMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipMarkdown, setTooltipTextMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setInvalidMethods inherited from interface com.vaadin.flow.data.binder.HasValidator
addValidationStatusChangeListenerMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, bindValue, clear, getOptionalValue, isEmptyMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, setReadOnlyMethods inherited from interface com.vaadin.flow.component.InputNotifier
addInputListenerMethods inherited from interface JComponentMixin
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, requestDefaultFocus, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardActionMethods inherited from interface JTextComponentMixin
addCaretChangeListener, addCaretListener, addSelectionReportListener, copy, createDefaultDocument, cut, getActions, getCaret, getCaretColor, getCaretListeners, getCaretMark, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropMode, getFocusAccelerator, getHighlighter, getKeymap, getMargin, getNavigationFilter, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, installSelectionBridge, installTextComponentBindings, isEditable, modelToView, modelToView2D, moveCaretPosition, paste, print, read, removeCaretChangeListener, removeCaretListener, renderSelection, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setDisabledTextColor, setDocument, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, viewToModel2D, writeMethods inherited from interface com.vaadin.flow.component.KeyNotifier
addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
-
Constructor Details
-
SJTextArea
public SJTextArea() -
SJTextArea
-
SJTextArea
public SJTextArea(int rows, int columns) -
SJTextArea
-
SJTextArea
-
SJTextArea
-
-
Method Details
-
validate
public void validate()Visibility-widening override ofTextArea.validate()to satisfyComponentMixin's publicvalidate()contract. Delegates to super so Vaadin's input-validation behaviour is preserved. Same SJTextField / SJPasswordField pattern per SD_sjtextfield / SD_sjpasswordfield (method-name clash between Swing's "validate the layout" and Vaadin's "validate the input value" — same name, different concerns).- Specified by:
validatein interfaceComponentMixin- Overrides:
validatein classcom.vaadin.flow.component.textfield.TextArea
-
getRows
public int getRows() -
setRows
public void setRows(int rows) -
getColumns
public int getColumns() -
setColumns
public void setColumns(int columns) -
getTabSize
public int getTabSize() -
setTabSize
public void setTabSize(int size) -
getLineWrap
public boolean getLineWrap() -
setLineWrap
public void setLineWrap(boolean wrap) -
getWrapStyleWord
public boolean getWrapStyleWord() -
setWrapStyleWord
public void setWrapStyleWord(boolean word) -
append
Appendsstrto the Document, a splice of the empty span at the end. Null is a documented no-op per JDK. -
insert
Insertsstrat offsetpos, a splice of the empty span there. Nullstris a documented no-op per JDK.- Throws:
IllegalArgumentException- ifposis outside the Document, per R_match_swing_errors — and checked here rather than inspliceDocumentso the message stays the JDK's, which names the position rather than a range
-
replaceRange
Replaces the Document's[start, end)span withstr.- Parameters:
str- the replacement, ornullto delete the span and put nothing back — the JDK's "just delete" contract- Throws:
IllegalArgumentException- on a span the Document does not hold, per R_match_swing_errors
-
getLineCount
public int getLineCount()Number of lines in the Document. PlainDocument's default root element has one child per line — that's exactly Swing's line count. Non-line-structured Documents return 0. -
getLineOfOffset
Index of the line containingoffset. JDK throws BadLocationException when offset is out of range; we match.- Throws:
BadLocationException
-
getLineStartOffset
Start offset ofline. JDK throws BadLocationException for out-of-range line; we match.- Throws:
BadLocationException
-
getLineEndOffset
End offset ofline. Includes the trailing newline (or EOF for the last line) per PlainDocument's element spec.- Throws:
BadLocationException
-
claimsEnter
public boolean claimsEnter()Enter inserts a newline while editable — Swing'sinsert-breakbinding.- Specified by:
claimsEnterin interfaceEnterClaims.Claimant
-
getUIClassID
Description copied from interface:JComponentMixinDeliberate no-op — L&F key.- Specified by:
getUIClassIDin interfaceJComponentMixin
-
paramString
JDK JTextArea.paramString chains JTextComponent's tail and appends the JTextArea-specific state. We follow the same shape; underlying VaadinComponent.toStringis the honest host-side equivalent. -
getAccessibleContext
-