EchoPoint
2.1.0rc5

echopointng
Class RichTextArea

java.lang.Object
  extended by nextapp.echo2.app.Component
      extended by nextapp.echo2.app.text.TextComponent
          extended by echopointng.RichTextArea
All Implemented Interfaces:
Attributeable, Borderable, Delegateable, Heightable, Insetable, MouseCursorable, Sizeable, Widthable, Serializable, RenderIdSupport

public class RichTextArea
extends TextComponent
implements Sizeable, Insetable, MouseCursorable, Borderable, Attributeable

The RichTextArea component provides HTML rich text editing facilities.

The actual commands support be the RichTextArea are defined via the RichTextRenderer interface.

See Also:
RichTextRenderer, Serialized Form

Field Summary
static Style DEFAULT_STYLE
           
static Color DEFAULT_TOOLBAR_BACKGROUND
           
static String PROPERTY_EDITABLE
           
static String PROPERTY_EDITOR_BACKGROUND
           
static String PROPERTY_EDITOR_BORDER
           
static String PROPERTY_EDITOR_FONT
           
static String PROPERTY_EDITOR_FOREGROUND
           
static String PROPERTY_RENDERER
           
static String PROPERTY_SPELL_CHECK_IN_PROGRESS
           
static String PROPERTY_SPELL_CHECKER
           
static String PROPERTY_TOOLBAR_ALIGNMENT
           
static String PROPERTY_TOOLBAR_BACKGROUND
           
 
Fields inherited from class nextapp.echo2.app.text.TextComponent
ACTION_LISTENERS_CHANGED_PROPERTY, DOCUMENT_CHANGED_PROPERTY, INPUT_ACTION, PROPERTY_ACTION_COMMAND, PROPERTY_ALIGNMENT, PROPERTY_BACKGROUND_IMAGE, PROPERTY_BORDER, PROPERTY_DISABLED_BACKGROUND, PROPERTY_DISABLED_BACKGROUND_IMAGE, PROPERTY_DISABLED_BORDER, PROPERTY_DISABLED_FONT, PROPERTY_DISABLED_FOREGROUND, PROPERTY_HEIGHT, PROPERTY_HORIZONTAL_SCROLL, PROPERTY_INSETS, PROPERTY_MAXIMUM_LENGTH, PROPERTY_TOOL_TIP_TEXT, PROPERTY_VERTICAL_SCROLL, PROPERTY_WIDTH, TEXT_CHANGED_PROPERTY
 
Fields inherited from class nextapp.echo2.app.Component
CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface echopointng.able.Widthable
PROPERTY_WIDTH
 
Fields inherited from interface echopointng.able.Heightable
PROPERTY_HEIGHT
 
Fields inherited from interface echopointng.able.Insetable
DEFAULT_INSETS, DEFAULT_OUTSETS, PROPERTY_INSETS, PROPERTY_OUTSETS
 
Fields inherited from interface echopointng.able.MouseCursorable
CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, PROPERTY_MOUSE_CURSOR, PROPERTY_MOUSE_CURSOR_URI
 
Fields inherited from interface echopointng.able.Borderable
PROPERTY_BORDER
 
Constructor Summary
RichTextArea()
          Constructs a RichTextArea with the default size.
RichTextArea(Document document)
          Constructs a new RichTextArea with the given text and default size.
RichTextArea(Document document, String text, Extent width, Extent height)
          Creates a new RichTextArea with the given text and size.
RichTextArea(Extent width, Extent height)
          Creates a new RichTextArea of the given size.
RichTextArea(String text)
          Creates a new RichTextArea with the given text.
RichTextArea(String text, Extent width, Extent height)
          Creates a new RichTextArea with the given text and size.
 
Method Summary
 Object getAttribute(String attributeName)
          Returns a value for the given attribute name or null if one cannot be found.
 String[] getAttributeNames()
          Returns a String array with the names of the the attributes that have neen set.
 Color getEditorBackground()
           
 Border getEditorBorder()
           
 Font getEditorFont()
           
 Color getEditorForeground()
           
 int getMouseCursor()
          Returns the current mouse cursor in use.
 String getMouseCursorUri()
           
 Insets getOutsets()
           
 RichTextRenderer getRenderer()
          Returns the RichTextRenderer in use
 RichTextSpellChecker getSpellChecker()
           
 int getToolBarAlignment()
          Returns the toolbar alignment of the contents of this RichTextArea.
 Color getToolBarBackground()
          Returns the toolbar background color
 boolean isEditable()
           
 boolean isSpellCheckInProgress()
           
protected  String makeValidXHTML(StringBuffer buffer)
          The client rich text support do necessarily provide back valid XHTML in the editied text.
 void processInput(String inputName, Object inputValue)
           
 void setAttribute(String attributeName, Object attributeValue)
          Sets a value for a given attribute name.
 void setEditable(boolean newValue)
          Controls whether the text in the RichTextArea can be edited or not.
 void setEditorBackground(Color editorBackground)
          Sets the background of the RichTextArea portion
 void setEditorBorder(Border editorBorder)
          Sets the border of the RichTextArea portion
 void setEditorFont(Font editorFont)
          Sets the font of the RichTextArea portion
 void setEditorForeground(Color editorForeground)
          Sets the foreground of the RichTextArea portion
 void setMouseCursor(int mouseCursor)
          Sets the mouse cursor to use.
 void setMouseCursorUri(String mouseCursorURI)
          Sets the URI to a custom platform mouse cursor.
 void setOutsets(Insets newValue)
          Sets the Outsets in play.
 void setRenderer(RichTextRenderer renderer)
          Sets the RichTextRenderer to be used
 void setSpellChecker(RichTextSpellChecker spellChecker)
          Sets the spell checker associated with the RichTextArea
 void setSpellCheckInProgress(boolean spellCheckInProgress)
          Sets whether a seplling check is in progress
 void setToolBarAlignment(int newValue)
          Sets the toolbar alignment of the contents of this RichTextArea.
 void setToolBarBackground(Color newValue)
          Sets the toolbar background color
 
Methods inherited from class nextapp.echo2.app.text.TextComponent
addActionListener, getActionCommand, getAlignment, getBackgroundImage, getBorder, getDisabledBackground, getDisabledBackgroundImage, getDisabledBorder, getDisabledFont, getDisabledForeground, getDocument, getHeight, getHorizontalScroll, getInsets, getMaximumLength, getText, getToolTipText, getVerticalScroll, getWidth, hasActionListeners, isValidChild, removeActionListener, setActionCommand, setAlignment, setBackgroundImage, setBorder, setDisabledBackground, setDisabledBackgroundImage, setDisabledBorder, setDisabledFont, setDisabledForeground, setDocument, setHeight, setHorizontalScroll, setInsets, setMaximumLength, setText, setToolTipText, setVerticalScroll, setWidth
 
Methods inherited from class nextapp.echo2.app.Component
add, add, addPropertyChangeListener, dispose, firePropertyChange, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndexedProperty, getLayoutData, getLayoutDirection, getLocale, getParent, getProperty, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLayoutDirection, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidParent, isVisible, remove, remove, removeAll, removePropertyChangeListener, setBackground, setEnabled, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndexedProperty, setLayoutData, setLayoutDirection, setLocale, setProperty, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface echopointng.able.Widthable
getWidth, setWidth
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 
Methods inherited from interface echopointng.able.Heightable
getHeight, setHeight
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 
Methods inherited from interface echopointng.able.Insetable
getInsets, setInsets
 
Methods inherited from interface echopointng.able.Borderable
getBorder, setBorder
 

Field Detail

DEFAULT_STYLE

public static final Style DEFAULT_STYLE

DEFAULT_TOOLBAR_BACKGROUND

public static final Color DEFAULT_TOOLBAR_BACKGROUND

PROPERTY_EDITABLE

public static final String PROPERTY_EDITABLE
See Also:
Constant Field Values

PROPERTY_EDITOR_BACKGROUND

public static final String PROPERTY_EDITOR_BACKGROUND
See Also:
Constant Field Values

PROPERTY_EDITOR_BORDER

public static final String PROPERTY_EDITOR_BORDER
See Also:
Constant Field Values

PROPERTY_EDITOR_FONT

public static final String PROPERTY_EDITOR_FONT
See Also:
Constant Field Values

PROPERTY_EDITOR_FOREGROUND

public static final String PROPERTY_EDITOR_FOREGROUND
See Also:
Constant Field Values

PROPERTY_RENDERER

public static final String PROPERTY_RENDERER
See Also:
Constant Field Values

PROPERTY_SPELL_CHECK_IN_PROGRESS

public static final String PROPERTY_SPELL_CHECK_IN_PROGRESS
See Also:
Constant Field Values

PROPERTY_SPELL_CHECKER

public static final String PROPERTY_SPELL_CHECKER
See Also:
Constant Field Values

PROPERTY_TOOLBAR_ALIGNMENT

public static final String PROPERTY_TOOLBAR_ALIGNMENT
See Also:
Constant Field Values

PROPERTY_TOOLBAR_BACKGROUND

public static final String PROPERTY_TOOLBAR_BACKGROUND
See Also:
Constant Field Values
Constructor Detail

RichTextArea

public RichTextArea()
Constructs a RichTextArea with the default size.


RichTextArea

public RichTextArea(Document document)
Constructs a new RichTextArea with the given text and default size.

Parameters:
document - The model for this text field.

RichTextArea

public RichTextArea(Document document,
                    String text,
                    Extent width,
                    Extent height)
Creates a new RichTextArea with the given text and size.

Parameters:
document - The model for this text field.
text - The initial text in the text field.
width - The width to display.
height - The height to display.

RichTextArea

public RichTextArea(Extent width,
                    Extent height)
Creates a new RichTextArea of the given size.

Parameters:
width - The width to display.
height - The height to display.

RichTextArea

public RichTextArea(String text)
Creates a new RichTextArea with the given text.

Parameters:
text - The initial text in the text field.

RichTextArea

public RichTextArea(String text,
                    Extent width,
                    Extent height)
Creates a new RichTextArea with the given text and size.

Parameters:
text - The initial text in the text field.
width - The width to display.
height - The height to display.
Method Detail

getAttribute

public Object getAttribute(String attributeName)
Description copied from interface: Attributeable
Returns a value for the given attribute name or null if one cannot be found.

Specified by:
getAttribute in interface Attributeable
Parameters:
attributeName - - the name of the attribute to return
Returns:
a value for the given attribute name or null if one cannot be found.
See Also:
Attributeable.getAttribute(java.lang.String)

getAttributeNames

public String[] getAttributeNames()
Description copied from interface: Attributeable
Returns a String array with the names of the the attributes that have neen set.

Specified by:
getAttributeNames in interface Attributeable
Returns:
a String array with the names of the the attributes that have neen set.
See Also:
Attributeable.getAttributeNames()

getEditorBackground

public Color getEditorBackground()
Returns:
the background of the RichTextArea portion

getEditorBorder

public Border getEditorBorder()
Returns:
the border of the RichTextArea portion

getEditorFont

public Font getEditorFont()
Returns:
the font of the RichTextArea portion

getEditorForeground

public Color getEditorForeground()
Returns:
the foreground of the RichTextArea portion

getMouseCursor

public int getMouseCursor()
Description copied from interface: MouseCursorable
Returns the current mouse cursor in use. This will be one of the following values.

Specified by:
getMouseCursor in interface MouseCursorable
Returns:
The current mouse cursor in use.
See Also:
MouseCursorable.getMouseCursor()

getMouseCursorUri

public String getMouseCursorUri()
Specified by:
getMouseCursorUri in interface MouseCursorable
Returns:
The custom URI for the mouse cursor or null
See Also:
MouseCursorable.getMouseCursorUri()

getOutsets

public Insets getOutsets()
Specified by:
getOutsets in interface Insetable
Returns:
the Outsets in use or null if here are none
See Also:
Insetable.getOutsets()

getRenderer

public RichTextRenderer getRenderer()
Returns the RichTextRenderer in use

Returns:
the RichTextRenderer in use

getSpellChecker

public RichTextSpellChecker getSpellChecker()
Returns:
the spell checker associated with the RichTextArea

getToolBarAlignment

public int getToolBarAlignment()
Returns the toolbar alignment of the contents of this RichTextArea.

Returns:
The toolbar alignment of the contents of this RichTextArea, one of the following values:
  • Alignment.TOP (the default)
  • Alignment.BOTTOM

getToolBarBackground

public Color getToolBarBackground()
Returns the toolbar background color

Returns:
the toolbar background color

isEditable

public boolean isEditable()
Returns:
whether the text in the RichTextArea can be edited or not.

isSpellCheckInProgress

public boolean isSpellCheckInProgress()
Returns:
whether a spell check is currently in progress

processInput

public void processInput(String inputName,
                         Object inputValue)
Overrides:
processInput in class TextComponent
See Also:
TextComponent.processInput(java.lang.String, java.lang.Object)

makeValidXHTML

protected String makeValidXHTML(StringBuffer buffer)
The client rich text support do necessarily provide back valid XHTML in the editied text. This method provides a mechanism to process the input HTML text and convert it to XHTML before it is stored in the backing Document.

This default implementation simply checks for missing end tags in <br/> tags and <img/> tags and puts them in.

You can derive your own implementation to get more complex behaviour

Parameters:
buffer - the buffer containing the HTML text
Returns:
the String document to be stored in the Document

setAttribute

public void setAttribute(String attributeName,
                         Object attributeValue)
Description copied from interface: Attributeable
Sets a value for a given attribute name.

Specified by:
setAttribute in interface Attributeable
Parameters:
attributeName - - the name of the attribute to set
attributeValue - - the value for the attribute
See Also:
Attributeable.setAttribute(java.lang.String, java.lang.Object)

setEditable

public void setEditable(boolean newValue)
Controls whether the text in the RichTextArea can be edited or not.

Parameters:
newValue - - thew new edtiable flag

setEditorBackground

public void setEditorBackground(Color editorBackground)
Sets the background of the RichTextArea portion


setEditorBorder

public void setEditorBorder(Border editorBorder)
Sets the border of the RichTextArea portion


setEditorFont

public void setEditorFont(Font editorFont)
Sets the font of the RichTextArea portion


setEditorForeground

public void setEditorForeground(Color editorForeground)
Sets the foreground of the RichTextArea portion


setMouseCursor

public void setMouseCursor(int mouseCursor)
Description copied from interface: MouseCursorable
Sets the mouse cursor to use. This will be one of the following values.

Specified by:
setMouseCursor in interface MouseCursorable
Parameters:
mouseCursor - - the mouse cursor to use
See Also:
MouseCursorable.setMouseCursor(int)

setMouseCursorUri

public void setMouseCursorUri(String mouseCursorURI)
Description copied from interface: MouseCursorable
Sets the URI to a custom platform mouse cursor. This will only be used if the mosue cusor is set to CURSOR_CUSTOM.

Specified by:
setMouseCursorUri in interface MouseCursorable
Parameters:
mouseCursorURI - the URI to a custom platform mouse cursor.
See Also:
MouseCursorable.setMouseCursorUri(java.lang.String)

setOutsets

public void setOutsets(Insets newValue)
Description copied from interface: Insetable
Sets the Outsets in play. The Outsets control the extra space around the outside of a container.

Specified by:
setOutsets in interface Insetable
Parameters:
newValue - - the Ousets to use
See Also:
Insetable.setOutsets(nextapp.echo2.app.Insets)

setRenderer

public void setRenderer(RichTextRenderer renderer)
Sets the RichTextRenderer to be used

Parameters:
renderer - - the new RichTextRenderer to be used

setSpellChecker

public void setSpellChecker(RichTextSpellChecker spellChecker)
Sets the spell checker associated with the RichTextArea


setSpellCheckInProgress

public void setSpellCheckInProgress(boolean spellCheckInProgress)
Sets whether a seplling check is in progress


setToolBarAlignment

public void setToolBarAlignment(int newValue)
Sets the toolbar alignment of the contents of this RichTextArea.

Parameters:
newValue - The toolbar alignment of the contents of this RichTextArea, one of the following values.
  • Alignment.TOP (the default)
  • Alignment.BOTTOM

setToolBarBackground

public void setToolBarBackground(Color newValue)
Sets the toolbar background color

Parameters:
newValue - - the new toolbar background color

EchoPoint
2.1.0rc5