public class RichTextArea extends AbstractField<String> implements HasValueChangeMode
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Sizeable.Unit
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<V>
DESIGN_ATTR_PLAIN_TEXT
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
Constructor and Description |
---|
RichTextArea()
Constructs an empty
RichTextArea with no caption. |
RichTextArea(HasValue.ValueChangeListener<String> valueChangeListener)
Constructs a new
RichTextArea with a value change listener. |
RichTextArea(String caption)
Constructs an empty
RichTextArea with the given caption. |
RichTextArea(String caption,
HasValue.ValueChangeListener<String> valueChangeListener)
Constructs a new
RichTextArea with the given caption and a value
change listener. |
RichTextArea(String caption,
String value)
Constructs a new
RichTextArea with the given caption and
initial text contents. |
RichTextArea(String caption,
String value,
HasValue.ValueChangeListener<String> valueChangeListener)
Constructs a new
RichTextArea with the given caption, initial
text contents and a value change listener. |
Modifier and Type | Method and Description |
---|---|
protected void |
doSetValue(String value)
Sets the value of this field.
|
String |
getEmptyValue()
Returns the value that represents an empty value.
|
protected RichTextAreaState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
protected RichTextAreaState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
String |
getValue()
Returns the current value of this object.
|
ValueChangeMode |
getValueChangeMode()
Returns the currently set
ValueChangeMode . |
int |
getValueChangeTimeout()
Returns the currently set timeout, in milliseconds, for how often
HasValue.ValueChangeEvent s are triggered if the current
ValueChangeMode is set to either ValueChangeMode.LAZY or
ValueChangeMode.TIMEOUT . |
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Reads the component state from the given design.
|
void |
selectAll()
Selects all text in the rich text area.
|
void |
setValue(String value)
Sets the value of this object.
|
void |
setValueChangeMode(ValueChangeMode mode)
Sets the mode how the TextField triggers
HasValue.ValueChangeEvent s. |
void |
setValueChangeTimeout(int timeout)
Sets how often
HasValue.ValueChangeEvent s are triggered when the
ValueChangeMode is set to either ValueChangeMode.LAZY or
ValueChangeMode.TIMEOUT . |
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Writes the component state to the given design.
|
addValueChangeListener, createValueChange, focus, getCustomAttributes, getTabIndex, isDifferentValue, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible, setTabIndex, setValue
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidth, setWidthFull, setWidthUndefined
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, setWidthUndefined
clear, getDefaultValidator, getOptionalValue, isEmpty
public RichTextArea()
RichTextArea
with no caption.public RichTextArea(String caption)
RichTextArea
with the given caption.caption
- the caption for the editor.public RichTextArea(String caption, String value)
RichTextArea
with the given caption and
initial text contents.caption
- the caption for the editor.value
- the initial text content of the editor, not null
public RichTextArea(HasValue.ValueChangeListener<String> valueChangeListener)
RichTextArea
with a value change listener.
The listener is called when the value of this TextField
is
changed either by the user or programmatically.
valueChangeListener
- the value change listener, not null
public RichTextArea(String caption, HasValue.ValueChangeListener<String> valueChangeListener)
RichTextArea
with the given caption and a value
change listener.
The listener is called when the value of this TextField
is
changed either by the user or programmatically.
caption
- the caption for the fieldvalueChangeListener
- the value change listener, not null
public RichTextArea(String caption, String value, HasValue.ValueChangeListener<String> valueChangeListener)
RichTextArea
with the given caption, initial
text contents and a value change listener.
The listener is called when the value of this RichTextArea
is
changed either by the user or programmatically.
caption
- the caption for the fieldvalue
- the value for the field, not null
valueChangeListener
- the value change listener, not null
public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Component
The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
readDesign
in interface Component
readDesign
in class AbstractField<String>
design
- The element to obtain the state fromdesignContext
- The DesignContext instance used for parsing the designpublic void writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Component
The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
writeDesign
in interface Component
writeDesign
in class AbstractField<String>
design
- The element to write the component state to. Any previous
attributes or child nodes are not cleared.designContext
- The DesignContext instance used for writing the designprotected RichTextAreaState getState()
AbstractComponent
getState
in class AbstractField<String>
protected RichTextAreaState getState(boolean markAsDirty)
AbstractClientConnector
getState
in class AbstractField<String>
markAsDirty
- true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()
public void setValue(String value)
getValue()
, fires a ValueChangeEvent
. Throws
NullPointerException
if the value is null.setValue
in interface HasValue<String>
setValue
in class AbstractField<String>
value
- the new value, not null
NullPointerException
- if value
is null
public String getValue()
HasValue
Implementation note: the implementing class should document whether null values may be returned or not.
public String getEmptyValue()
HasValue
By default HasValue
is expected to support null
as empty
values. Specific implementations might not support this.
getEmptyValue
in interface HasValue<String>
Binder#bind(HasValue, ValueProvider, Setter)
protected void doSetValue(String value)
AbstractField
IllegalArgumentException
if the value is invalid. Typically saves
the value to shared state.doSetValue
in class AbstractField<String>
value
- the new value of the fieldpublic void selectAll()
public void setValueChangeMode(ValueChangeMode mode)
HasValueChangeMode
HasValue.ValueChangeEvent
s.setValueChangeMode
in interface HasValueChangeMode
mode
- the new modeValueChangeMode
public ValueChangeMode getValueChangeMode()
HasValueChangeMode
ValueChangeMode
.getValueChangeMode
in interface HasValueChangeMode
HasValue.ValueChangeEvent
s.ValueChangeMode
public void setValueChangeTimeout(int timeout)
HasValueChangeMode
HasValue.ValueChangeEvent
s are triggered when the
ValueChangeMode
is set to either ValueChangeMode.LAZY
or
ValueChangeMode.TIMEOUT
.setValueChangeTimeout
in interface HasValueChangeMode
timeout
- timeout in milliseconds, must be greater or equal to 0ValueChangeMode
public int getValueChangeTimeout()
HasValueChangeMode
HasValue.ValueChangeEvent
s are triggered if the current
ValueChangeMode
is set to either ValueChangeMode.LAZY
or
ValueChangeMode.TIMEOUT
.getValueChangeTimeout
in interface HasValueChangeMode
HasValue.ValueChangeEvent
s are triggered.Copyright © 2020 Vaadin Ltd. All rights reserved.