com.vaadin.ui
Class RichTextArea

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

public class RichTextArea
extends AbstractField<String>
implements Vaadin6Component

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 class com.vaadin.ui.AbstractComponent
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.VariableOwner
VariableOwner.ErrorEvent
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.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 interface com.vaadin.terminal.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(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.
 
Method Summary
 void changeVariables(Object source, Map<String,Object> variables)
          Called when one or more variables handled by the implementing class are changed.
 Format getFormat()
          Deprecated. replaced by PropertyFormatter
protected  String getFormattedValue()
          Deprecated.  
 String getNullRepresentation()
          Gets the null-string representation.
 Class<String> getType()
          Returns the type of the Field.
 String getValue()
          Gets the current value of the field.
protected  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 selectAll()
          Selects all text in the rich text area.
 void setFormat(Format format)
          Deprecated. replaced by PropertyFormatter
 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.
 
Methods inherited from class com.vaadin.ui.AbstractField
addListener, addListener, addValidator, attach, commit, detach, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getErrorMessage, getInternalValue, getPropertyDataSource, getRequiredError, getState, getTabIndex, getValidators, isBuffered, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isReadThrough, isRequired, isValid, isValidationVisible, isWriteThrough, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeValidator, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setPropertyDataSource, setReadThrough, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, setValue, setWriteThrough, shouldHideErrors, toString, updateState, validate, validate, valueChange
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addListener, addListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, fireEvent, getActionManager, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getHeight, getHeightUnits, getIcon, getListeners, getLocale, getParent, getRoot, getStyle, getStyleName, getWidth, getWidthUnits, handleError, hasListeners, isConnectorEnabled, isEnabled, isImmediate, isVisible, removeListener, removeListener, removeListener, removeListener, removeListener, removeShortcutListener, removeStyleName, requestRepaint, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setHeight, setIcon, setImmediate, setLocale, setParent, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidth
 
Methods inherited from class com.vaadin.terminal.AbstractClientConnector
addExtension, addMethodInvocationToQueue, createState, getAllChildrenIterable, getConnectorId, getExtensions, getRpcManager, getRpcProxy, getStateType, registerRpc, registerRpc, removeExtension, requestRepaintAll, retrievePendingRpcCalls
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.vaadin.terminal.VariableOwner
isEnabled, isImmediate
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, attach, getApplication, getCaption, getDebugId, getIcon, getLocale, getParent, getRoot, getState, getStyleName, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setDebugId, setEnabled, setIcon, setStyleName, setVisible, updateState
 
Methods inherited from interface com.vaadin.terminal.gwt.server.ClientConnector
detach, getExtensions, getStateType, isConnectorEnabled, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setParent
 
Methods inherited from interface com.vaadin.terminal.gwt.client.Connector
getConnectorId
 
Methods inherited from interface com.vaadin.terminal.gwt.server.RpcTarget
getRpcManager
 
Methods inherited from interface com.vaadin.terminal.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth
 
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(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(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(String caption,
                    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: Vaadin6Component

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 Vaadin6Component
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<String>
Specified by:
setReadOnly in interface Component
Overrides:
setReadOnly in class AbstractField<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

getFormattedValue

@Deprecated
protected String getFormattedValue()
Deprecated. 

Gets the formatted string value. Sets the field value by using the assigned Format.

Returns:
the Formatted value.
See Also:
setFormat(Format), Format

getValue

public String getValue()
Description copied from class: AbstractField
Gets the current value of the field.

This is the visible, modified and possible invalid value the user have entered to the field.

Note that the object returned is compatible with getType(). For example, if the type is String, this returns Strings even when the underlying datasource is of some other type. In order to access the converted value, use AbstractField.getConvertedValue() and to access the value of the property data source, use Property.getValue() for the property data source.

Since Vaadin 7.0, no implicit conversions between other data types and String are performed, but a converter is used if set.

Specified by:
getValue in interface Property<String>
Overrides:
getValue in class AbstractField<String>
Returns:
the current value of the field.

changeVariables

public void changeVariables(Object source,
                            Map<String,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 Class<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<String>
Specified by:
getType in class AbstractField<String>
Returns:
the type of the Field

getNullRepresentation

public 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(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()

getFormat

@Deprecated
public Format getFormat()
Deprecated. replaced by PropertyFormatter

Gets the value formatter of TextField.

Returns:
the Format used to format the value.

setFormat

@Deprecated
public void setFormat(Format format)
Deprecated. replaced by PropertyFormatter

Gets the value formatter of TextField.

Parameters:
format - the Format used to format the value. Null disables the formatting.

isEmpty

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

Overrides:
isEmpty in class AbstractField<String>


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