com.vaadin.ui
Class RichTextArea

java.lang.Object
  extended by com.vaadin.server.AbstractClientConnector
      extended by com.vaadin.ui.AbstractComponent
          extended by com.vaadin.ui.AbstractField<java.lang.String>
              extended by com.vaadin.ui.RichTextArea
All Implemented Interfaces:
Buffered, BufferedValidatable, Property<java.lang.String>, Property.Editor, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer, Validatable, Action.ShortcutNotifier, ConnectorEventListener, MethodEventSource, ClientConnector, Sizeable, VariableOwner, com.vaadin.shared.Connector, Component, Component.Focusable, Field<java.lang.String>, LegacyComponent, java.io.Serializable, java.util.EventListener

public class RichTextArea
extends AbstractField<java.lang.String>
implements LegacyComponent

A simple RichTextArea to edit HTML format text. Note, that using AbstractTextField.setMaxLength(int) method in RichTextArea may produce unexpected results as formatting is counted into length of field.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
 
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Field
Field.ValueChangeEvent
 
Nested classes/interfaces inherited from interface com.vaadin.data.Buffered
Buffered.SourceException
 
Nested classes/interfaces inherited from interface com.vaadin.data.Property
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer
 
Field Summary
 
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
 
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
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(java.lang.String caption)
          Constructs an empty RichTextArea with the given caption.
RichTextArea(java.lang.String caption, Property dataSource)
          Constructs a new RichTextArea that's bound to the specified Property and has the given caption.
RichTextArea(java.lang.String caption, java.lang.String value)
          Constructs a new RichTextArea with the given caption and initial text contents.
 
Method Summary
 void changeVariables(java.lang.Object source, java.util.Map<java.lang.String,java.lang.Object> variables)
          Called when one or more variables handled by the implementing class are changed.
 void clear()
          Clears the value of the field.
 java.lang.String getNullRepresentation()
          Gets the null-string representation.
 java.lang.Class<java.lang.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(java.lang.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.
 
Methods inherited from class com.vaadin.ui.AbstractField
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, 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, shouldHideErrors, toString, validate, validate, valueChange
 
Methods inherited from class com.vaadin.ui.AbstractComponent
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, 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
 
Methods inherited from class com.vaadin.server.AbstractClientConnector
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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.vaadin.ui.LegacyComponent
markAsDirty
 
Methods inherited from interface com.vaadin.server.VariableOwner
isEnabled, isImmediate
 
Methods inherited from interface com.vaadin.ui.Component
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
 
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
 
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
 
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
 
Methods inherited from interface com.vaadin.event.Action.ShortcutNotifier
addShortcutListener, removeShortcutListener
 

Constructor Detail

RichTextArea

public RichTextArea()
Constructs an empty RichTextArea with no caption.


RichTextArea

public RichTextArea(java.lang.String caption)
Constructs an empty RichTextArea with the given caption.

Parameters:
caption - the caption for the editor.

RichTextArea

public RichTextArea(Property dataSource)
Constructs a new RichTextArea that's bound to the specified Property and has no caption.

Parameters:
dataSource - the data source for the editor value

RichTextArea

public RichTextArea(java.lang.String caption,
                    Property dataSource)
Constructs a new RichTextArea that's bound to the specified Property and has the given caption.

Parameters:
caption - the caption for the editor.
dataSource - the data source for the editor value

RichTextArea

public RichTextArea(java.lang.String caption,
                    java.lang.String value)
Constructs a new RichTextArea with the given caption and initial text contents.

Parameters:
caption - the caption for the editor.
value - the initial text content of the editor.
Method Detail

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Description copied from interface: 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.

Specified by:
paintContent in interface LegacyComponent
Parameters:
target - the target UIDL stream where the component should paint itself to.
Throws:
PaintException - if the paint operation failed.

setReadOnly

public void setReadOnly(boolean readOnly)
Description copied from class: AbstractField
Changes the readonly state and throw read-only status change events.

Specified by:
setReadOnly in interface Property<java.lang.String>
Specified by:
setReadOnly in interface Component
Overrides:
setReadOnly in class AbstractField<java.lang.String>
Parameters:
readOnly - a boolean value specifying whether the component is put read-only mode or not
See Also:
Component.setReadOnly(boolean)

selectAll

public void selectAll()
Selects all text in the rich text area. As a side effect, focuses the rich text area.

Since:
6.5

changeVariables

public void changeVariables(java.lang.Object source,
                            java.util.Map<java.lang.String,java.lang.Object> variables)
Description copied from interface: VariableOwner
Called when one or more variables handled by the implementing class are changed.

Specified by:
changeVariables in interface VariableOwner
Parameters:
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.

getType

public java.lang.Class<java.lang.String> getType()
Description copied from class: AbstractField
Returns the type of the Field. The methods 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.

Specified by:
getType in interface Property<java.lang.String>
Specified by:
getType in class AbstractField<java.lang.String>
Returns:
the type of the Field

getNullRepresentation

public java.lang.String getNullRepresentation()
Gets the null-string representation.

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'.

Returns:
the String Textual representation for null strings.
See Also:
AbstractTextField.isNullSettingAllowed()

isNullSettingAllowed

public boolean isNullSettingAllowed()
Is setting nulls with null-string representation allowed.

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

Returns:
boolean Should the null-string represenation be always converted to null-values.
See Also:
AbstractTextField.getNullRepresentation()

setNullRepresentation

public void setNullRepresentation(java.lang.String nullRepresentation)
Sets the null-string representation.

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'

Parameters:
nullRepresentation - Textual representation for null strings.
See Also:
AbstractTextField.setNullSettingAllowed(boolean)

setNullSettingAllowed

public void setNullSettingAllowed(boolean nullSettingAllowed)
Sets the null conversion mode.

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.

Parameters:
nullSettingAllowed - Should the null-string represenation be always converted to null-values.
See Also:
AbstractTextField.getNullRepresentation()

isEmpty

public boolean isEmpty()
Description copied from interface: Field
Is the field empty? In general, "empty" state is same as null. As an exception, TextField also treats empty string as "empty".

Specified by:
isEmpty in interface Field<java.lang.String>
Overrides:
isEmpty in class AbstractField<java.lang.String>
Returns:
true if the field is empty, false otherwise

clear

public void clear()
Description copied from interface: Field
Clears the value of the 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.

Specified by:
clear in interface Field<java.lang.String>
Overrides:
clear in class AbstractField<java.lang.String>

readDesign

public void readDesign(org.jsoup.nodes.Element design,
                       DesignContext designContext)
Description copied from interface: Component
Reads the component state from the given design.

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.

Specified by:
readDesign in interface Component
Overrides:
readDesign in class AbstractField<java.lang.String>
Parameters:
design - The element to obtain the state from
designContext - The DesignContext instance used for parsing the design

writeDesign

public void writeDesign(org.jsoup.nodes.Element design,
                        DesignContext designContext)
Description copied from interface: Component
Writes the component state to the given design.

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.

Specified by:
writeDesign in interface Component
Overrides:
writeDesign in class AbstractField<java.lang.String>
Parameters:
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 design


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.