Class WTextArea
- java.lang.Object
-
- Direct Known Subclasses:
WTextEdit
public class WTextArea extends WFormWidget
A widget that provides a multi-line edit.To act upon text changes, connect a slot to the
WFormWidget.changed()signal. This signal is emitted when the user changed the content, and subsequently removes the focus from the line edit.To act upon editing, connect a slot to the
WInteractWidget.keyWentUp()signal.At all times, the current content may be accessed with the
getText()method.WTextArea is an
inlinewidget.CSS
The widget corresponds to an HTML
<textarea>tag can be styled using inline or external CSS as appropriate. The emptyText style can be configured via .Wt-edit-emptyText.- See Also:
WLineEdit
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
-
Field Summary
-
Fields inherited from class eu.webtoolkit.jwt.WInteractWidget
dragTouchEndSlot_, dragTouchSlot_, noDefault
-
Fields inherited from class eu.webtoolkit.jwt.WWidget
WT_GETEXTRAMS_JS
-
-
Constructor Summary
Constructors Constructor Description WTextArea()Creates a text area with empty content and optional parent.WTextArea(WContainerWidget parentContainer)Creates a text area with empty content and optional parent.WTextArea(java.lang.String text)Creates a text area with given content and optional parent.WTextArea(java.lang.String text, WContainerWidget parentContainer)Creates a text area with given content and optional parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intboxBorder(Orientation orientation)Returns the widget's built-in border width.protected intboxPadding(Orientation orientation)Returns the widget's built-in padding.intgetColumns()Returns the number of columns.intgetCursorPosition()Returns the current cursor position.intgetRows()Returns the number of rows.java.lang.StringgetSelectedText()Returns the currently selected text.intgetSelectionStart()Returns the current selection start.java.lang.StringgetText()Returns the current content.java.lang.StringgetValueText()Returns the current value.booleanhasSelectedText()Returns whether there is selected text.voidsetColumns(int columns)Sets the number of columns.protected voidsetFormData(WObject.FormData formData)voidsetRows(int rows)Sets the number of rows.voidsetText(java.lang.String text)Sets the content of the text area.voidsetValueText(java.lang.String value)Sets the current value.EventSignaltextInput()Event signal emitted when the text in the input field changed.-
Methods inherited from class eu.webtoolkit.jwt.WFormWidget
changed, enableAjax, getLabel, getPlaceholderText, getRealValidator, getTabIndex, getValidator, hasValidatorChanged, isCanReceiveFocus, isReadOnly, propagateSetEnabled, refresh, remove, render, setEnabled, setHidden, setPlaceholderText, setReadOnly, setToolTip, setValidator, validate, validated, validatorChanged
-
Methods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, getMouseOverDelay, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, setDraggable, setDraggable, setDraggable, setDraggable, setMouseOverDelay, setPopup, touchEnded, touchMoved, touchStarted, unsetDraggable
-
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, beingDeleted, blurred, callJavaScriptMember, childrenChanged, createDomElement, doJavaScript, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getDomChanges, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, hideToolTip, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, iterateChildren, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, parentResized, propagateSetVisible, removeScript, removeStyleClass, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFlexBox, setFloatSide, setFocus, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setVerticalAlignment, showToolTip, showToolTipOnHover, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemoved
-
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, applyThemeStyles, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, render, resize, scheduleRender, scheduleRender, scheduleRender, scheduleThemeStyleApply, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
-
Methods inherited from class eu.webtoolkit.jwt.WObject
getObjectName
-
-
-
-
Constructor Detail
-
WTextArea
public WTextArea(WContainerWidget parentContainer)
Creates a text area with empty content and optional parent.
-
WTextArea
public WTextArea()
Creates a text area with empty content and optional parent.
-
WTextArea
public WTextArea(java.lang.String text, WContainerWidget parentContainer)Creates a text area with given content and optional parent.
-
WTextArea
public WTextArea(java.lang.String text)
Creates a text area with given content and optional parent.
-
-
Method Detail
-
setColumns
public void setColumns(int columns)
Sets the number of columns.The default value is 20.
-
setRows
public void setRows(int rows)
Sets the number of rows.The default value is 5.
-
getColumns
public int getColumns()
Returns the number of columns.- See Also:
setColumns(int columns)
-
getRows
public int getRows()
Returns the number of rows.- See Also:
setRows(int rows)
-
getText
public java.lang.String getText()
Returns the current content.
-
setText
public void setText(java.lang.String text)
Sets the content of the text area.The default text is "".
-
getSelectionStart
public int getSelectionStart()
Returns the current selection start.Returns -1 if there is no selected text.
- See Also:
hasSelectedText(),getSelectedText()
-
getSelectedText
public java.lang.String getSelectedText()
Returns the currently selected text.Returns an empty string if there is currently no selected text.
- See Also:
hasSelectedText()
-
hasSelectedText
public boolean hasSelectedText()
Returns whether there is selected text.
-
getCursorPosition
public int getCursorPosition()
Returns the current cursor position.Returns -1 if the widget does not have the focus.
-
getValueText
public java.lang.String getValueText()
Returns the current value.Returns
getText().- Specified by:
getValueTextin classWFormWidget
-
setValueText
public void setValueText(java.lang.String value)
Sets the current value.Calls
setText().- Specified by:
setValueTextin classWFormWidget
-
textInput
public EventSignal textInput()
Event signal emitted when the text in the input field changed.This signal is emitted whenever the text contents has changed. Unlike the
WFormWidget.changed()signal, the signal is fired on every change, not only when the focus is lost. Unlike theWInteractWidget.keyPressed()signal, this signal is fired also for other events that change the text, such as paste actions.
-
setFormData
protected void setFormData(WObject.FormData formData)
- Overrides:
setFormDatain classWObject
-
boxPadding
protected int boxPadding(Orientation orientation)
Description copied from class:WWidgetReturns the widget's built-in padding.This is used by the layout managers to correct for a built-in padding which interferes with setting a widget's width (or height) to 100%.
A layout manager needs to set the width to 100% only for form widgets (
WTextArea,WLineEdit,WComboBox, etc...). Therefore, only for those widgets this needs to return the padding (the default implementation returns 0).For form widgets, the padding depends on the specific browser/platform combination, unless an explicit padding is set for the widget.
When setting an explicit padding for the widget using a style class, you will want to reimplement this method to return this padding in case you want to set the widget inside a layout manager.
- Overrides:
boxPaddingin classWWidget- See Also:
WWidget.boxBorder(Orientation orientation)
-
boxBorder
protected int boxBorder(Orientation orientation)
Description copied from class:WWidgetReturns the widget's built-in border width.This is used by the layout managers to correct for a built-in border which interferes with setting a widget's width (or height) to 100%.
A layout manager needs to set the width to 100% only for form widgets (
WTextArea,WLineEdit,WComboBox, etc...). Therefore, only for those widgets this needs to return the border width (the default implementation returns 0).For form widgets, the border width depends on the specific browser/platform combination, unless an explicit border is set for the widget.
When setting an explicit border for the widget using a style class, you will want to reimplement this method to return this border width, in case you want to set the widget inside a layout manager.
- Overrides:
boxBorderin classWWidget- See Also:
WWidget.boxPadding(Orientation orientation)
-
-