com.vaadin.ui.
Class RichTextArea
java.lang.Object
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractField
com.vaadin.ui.RichTextArea
All Implemented Interfaces:
Buffered, BufferedValidatable, Property, Property.Editor, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer, Validatable, Action.ShortcutNotifier, MethodEventSource, Paintable, Sizeable, VariableOwner, Component, Component.Focusable, Field, Serializable, EventListener
- extends AbstractField
public class RichTextArea
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:
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.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.ConversionException, Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer |
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 |
getType()
Returns the type of the Property. |
Object |
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 any needed component-specific things to the given 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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.vaadin.ui.Field |
---|
getDescription, setCaption, setDescription |
Constructor Detail |
---|
RichTextArea
public RichTextArea()
Constructs an empty RichTextArea
with no caption.
RichTextArea
public RichTextArea(String caption)
- Parameters:
caption
- the caption for the editor.
Constructs an empty RichTextArea
with the given caption.
RichTextArea
public RichTextArea(Property dataSource)
- Parameters:
dataSource
- the data source for the editor value
Constructs a new RichTextArea
that's bound to the specified
Property
and has no caption.
RichTextArea
public RichTextArea(String caption,
Property dataSource)
- Parameters:
caption
- the caption for the editor.dataSource
- the data source for the editor value
Constructs a new RichTextArea
that's bound to the specified
Property
and has the given caption.
RichTextArea
public RichTextArea(String caption,
String value)
- Parameters:
caption
- the caption for the editor.value
- the initial text content of the editor.
Constructs a new RichTextArea
with the given caption and
initial text contents.
Method Detail |
---|
paintContent
public void paintContent(PaintTarget target)
throws PaintException
- Overrides:
paintContent
in classAbstractField
- Parameters:
target
- the target UIDL stream where the component should paint itself to- Throws:
PaintException
- if the paint operation failed.
Description copied from class: AbstractComponent
Paints any needed component-specific things to the given UIDL stream. The
more general AbstractComponent.paint(PaintTarget)
method handles all general
attributes common to all components, and it calls this method to paint
any component-specific attributes to the UIDL stream.
setReadOnly
public void setReadOnly(boolean readOnly)
- Specified by:
setReadOnly
in interfaceProperty
- Specified by:
setReadOnly
in interfaceComponent
- Overrides:
setReadOnly
in classAbstractField
- Parameters:
readOnly
- a boolean value specifying whether the component is put read-only mode or not- See Also:
Component.setReadOnly(boolean)
Description copied from class: AbstractField
Changes the readonly state and throw read-only status change events.
selectAll
public void selectAll()
- Since:
- 6.5
Selects all text in the rich text area. As a side effect, focuses the rich text area.
getFormattedValue
@Deprecated
protected String getFormattedValue()
- Returns:
- the Formatted value.
- See Also:
setFormat(Format)
,Format
Deprecated.
Gets the formatted string value. Sets the field value by using the assigned Format.
getValue
public Object getValue()
- Specified by:
getValue
in interfaceProperty
- Overrides:
getValue
in classAbstractField
- Returns:
- the current value of the field.
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. In the read-through mode, the abstract buffer is also updated and validation is performed.
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 datasources native type, use getPropertyDatasource().getValue() instead.
Note that when you extend AbstractField, you must reimplement this method if datasource.getValue() is not assignable to class returned by getType() AND getType() is not String. In case of Strings, getValue() calls datasource.toString() instead of datasource.getValue().
changeVariables
public void changeVariables(Object source,
Map<String,Object> variables)
- Specified by:
changeVariables
in interfaceVariableOwner
- Overrides:
changeVariables
in classAbstractField
- 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.
Description copied from interface: VariableOwner
Called when one or more variables handled by the implementing class are changed.
getType
public Class getType()
- Specified by:
getType
in interfaceProperty
- Specified by:
getType
in classAbstractField
- Returns:
- type of the Property
Description copied from interface: Property
Returns the type of the Property. 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
.
getNullRepresentation
public String getNullRepresentation()
- Returns:
- the String Textual representation for null strings.
- See Also:
AbstractTextField.isNullSettingAllowed()
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'.
isNullSettingAllowed
public boolean isNullSettingAllowed()
- Returns:
- boolean Should the null-string represenation be always converted to null-values.
- See Also:
AbstractTextField.getNullRepresentation()
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
setNullRepresentation
public void setNullRepresentation(String nullRepresentation)
- Parameters:
nullRepresentation
- Textual representation for null strings.- See Also:
AbstractTextField.setNullSettingAllowed(boolean)
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'
setNullSettingAllowed
public void setNullSettingAllowed(boolean nullSettingAllowed)
- Parameters:
nullSettingAllowed
- Should the null-string represenation be always converted to null-values.- See Also:
AbstractTextField.getNullRepresentation()
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.
getFormat
@Deprecated
public Format getFormat()
- Returns:
- the Format used to format the value.
Deprecated. replaced by PropertyFormatter
Gets the value formatter of TextField.
setFormat
@Deprecated
public void setFormat(Format format)
- Parameters:
format
- the Format used to format the value. Null disables the formatting.
Deprecated. replaced by PropertyFormatter
Gets the value formatter of TextField.
isEmpty
protected boolean isEmpty()
- Overrides:
isEmpty
in classAbstractField
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".