public class RichTextArea extends AbstractField<String> implements LegacyComponent
AbstractTextField.setMaxLength(int)
method in
RichTextArea
may produce unexpected results as formatting is counted
into length of field.AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Sizeable.Unit
Field.ValueChangeEvent
Buffered.SourceException
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer
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(Property dataSource)
Constructs a new
RichTextArea that's bound to the specified
Property and has no caption. |
RichTextArea(String caption)
Constructs an empty
RichTextArea with the given caption. |
RichTextArea(String caption,
Property dataSource)
Constructs a new
RichTextArea that's bound to the specified
Property and has the given caption. |
RichTextArea(String caption,
String value)
Constructs a new
RichTextArea with the given caption and
initial text contents. |
Modifier and Type | Method and Description |
---|---|
void |
changeVariables(Object source,
Map<String,Object> variables)
Called when one or more variables handled by the implementing class are
changed.
|
void |
clear()
Clears the value of the field.
|
String |
getNullRepresentation()
Gets the null-string representation.
|
protected RichTextAreaState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
Class<String> |
getType()
Returns the type of the Field.
|
boolean |
isEmpty()
Is the field empty?
In general, "empty" state is same as null.
|
boolean |
isNullSettingAllowed()
Is setting nulls with null-string representation allowed.
|
void |
paintContent(PaintTarget target)
Paints the Paintable into a UIDL stream.
|
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 |
setNullRepresentation(String nullRepresentation)
Sets the null-string representation.
|
void |
setNullSettingAllowed(boolean nullSettingAllowed)
Sets the null conversion mode.
|
void |
setReadOnly(boolean readOnly)
Changes the readonly state and throw read-only status change events.
|
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Writes the component state to the given design.
|
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, attach, beforeClientResponse, commit, detach, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getCustomAttributes, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getState, getTabIndex, getValidators, getValue, isBuffered, isImmediate, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, setValue, setValue, shouldHideErrors, toString, validate, validate, valueChange
addContextClickListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getExplicitImmediateValue, 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, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidth, 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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
markAsDirty
isEnabled, isImmediate
addListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setVisible
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
addShortcutListener, removeShortcutListener
public RichTextArea()
RichTextArea
with no caption.public RichTextArea(String caption)
RichTextArea
with the given caption.caption
- the caption for the editor.public RichTextArea(Property dataSource)
RichTextArea
that's bound to the specified
Property
and has no caption.dataSource
- the data source for the editor valuepublic RichTextArea(String caption, Property dataSource)
RichTextArea
that's bound to the specified
Property
and has the given caption.caption
- the caption for the editor.dataSource
- the data source for the editor valuepublic void paintContent(PaintTarget target) throws PaintException
LegacyComponent
Paints the Paintable into a UIDL stream. This method creates the UIDL sequence describing it and outputs it to the given UIDL stream.
It is called when the contents of the component should be painted in response to the component first being shown or having been altered so that its visual representation is changed.
paintContent
in interface LegacyComponent
target
- the target UIDL stream where the component should paint itself
to.PaintException
- if the paint operation failed.public void setReadOnly(boolean readOnly)
AbstractField
setReadOnly
in interface Property<String>
setReadOnly
in interface Component
setReadOnly
in class AbstractField<String>
readOnly
- a boolean value specifying whether the component is put
read-only mode or notComponent.setReadOnly(boolean)
public void selectAll()
public void changeVariables(Object source, Map<String,Object> variables)
VariableOwner
changeVariables
in interface VariableOwner
source
- the Source of the variable change. This is the origin of the
event. For example in Web Adapter this is the request.variables
- the Mapping from variable names to new variable values.public Class<String> getType()
AbstractField
getValue
and
setValue
must be compatible with this type: one must be able
to safely cast the value returned from getValue
to the given
type and pass any variable assignable to this type as an argument to
setValue
.public String getNullRepresentation()
The null-valued strings are represented on the user interface by replacing the null value with this string. If the null representation is set null (not 'null' string), painting null value throws exception.
The default value is string 'null'.
AbstractTextField.isNullSettingAllowed()
public boolean isNullSettingAllowed()
If this property is true, writing null-representation string to text field always sets the field value to real null. If this property is false, null setting is not made, but the null values are maintained. Maintenance of null-values is made by only converting the textfield contents to real null, if the text field matches the null-string representation and the current value of the field is null.
By default this setting is false
AbstractTextField.getNullRepresentation()
public void setNullRepresentation(String nullRepresentation)
The null-valued strings are represented on the user interface by replacing the null value with this string. If the null representation is set null (not 'null' string), painting null value throws exception.
The default value is string 'null'
nullRepresentation
- Textual representation for null strings.AbstractTextField.setNullSettingAllowed(boolean)
public void setNullSettingAllowed(boolean nullSettingAllowed)
If this property is true, writing null-representation string to text field always sets the field value to real null. If this property is false, null setting is not made, but the null values are maintained. Maintenance of null-values is made by only converting the textfield contents to real null, if the text field matches the null-string representation and the current value of the field is null.
By default this setting is false.
nullSettingAllowed
- Should the null-string represenation be always converted to
null-values.AbstractTextField.getNullRepresentation()
public boolean isEmpty()
Field
public void clear()
Field
The field value is typically reset to the initial value of the field.
Calling Field.isEmpty()
on a cleared field must always returns true.
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>
Copyright © 2019 Vaadin Ltd. All rights reserved.