org.apache.pivot.wtk
Class TextArea

java.lang.Object
  extended by org.apache.pivot.wtk.Component
      extended by org.apache.pivot.wtk.TextArea
All Implemented Interfaces:
ConstrainedVisual, Visual
Direct Known Subclasses:
TableViewTextAreaCellRenderer

public class TextArea
extends Component

Component that allows a user to enter and edit multiple lines of (optionally formatted) text.


Nested Class Summary
static interface TextArea.Skin
          Text area skin interface.
static interface TextArea.TextBindMapping
          Translates between text and context data during data binding.
 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Constructor Summary
TextArea()
           
 
Method Summary
 void clear()
          Clears any bound values in the component.
 void clearSelection()
          Clears the selection.
 void copy()
           
 void cut()
           
 void delete(boolean backspace)
           
 Bounds getCharacterBounds(int offset)
           
 int getCharacterCount()
          Returns character count of the document.
 Document getDocument()
          Returns the document that backs the text area.
 int getInsertionPoint(int x, int y)
           
 int getNextInsertionPoint(int x, int from, FocusTraversalDirection direction)
           
 int getRowCount()
           
 int getRowIndex(int offset)
           
 String getSelectedText()
          Returns the currently selected text.
 Span getSelection()
          Returns a span representing the current selection.
 int getSelectionLength()
          Returns the length of the selection.
 int getSelectionStart()
          Returns the starting index of the selection.
 String getText()
           
 ListenerList<TextAreaBindingListener> getTextAreaBindingListeners()
           
 ListenerList<TextAreaCharacterListener> getTextAreaCharacterListeners()
           
 ListenerList<TextAreaListener> getTextAreaListeners()
           
 ListenerList<TextAreaSelectionListener> getTextAreaSelectionListeners()
           
 TextArea.TextBindMapping getTextBindMapping()
           
 BindType getTextBindType()
           
 String getTextKey()
          Returns the text area's text key.
 void insert(char character)
           
 void insert(String text)
           
 void insertImage(Image image)
           
 void insertParagraph()
           
 boolean isEditable()
          Returns the text area's editable flag.
 void load(Object context)
          Copies bound values from the bind context to the component.
 void paste()
           
 void redo()
           
 void selectAll()
          Selects all text.
 void setDocument(Document document)
          Sets the document that backs the text area.
 void setEditable(boolean editable)
          Sets the text area's editable flag.
 void setSelection(int selectionStart, int selectionLength)
          Sets the selection.
 void setSelection(Span selection)
          Sets the selection.
protected  void setSkin(Skin skin)
          Sets the skin, replacing any previous skin.
 void setText(String text)
           
 void setText(URL text)
           
 void setTextBindMapping(TextArea.TextBindMapping textBindMapping)
           
 void setTextBindType(BindType textBindType)
           
 void setTextBindType(String textBindType)
           
 void setTextKey(String textKey)
          Sets the text area's text key.
 void store(Object context)
          Copies bound values from the component to the bind context.
 void undo()
           
 
Methods inherited from class org.apache.pivot.wtk.Component
clearFocus, getAncestor, getAttribute, getAutomationID, getBaseline, getBaseline, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponentStateListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getGraphics, getHeight, getLocation, getMaximumPreferredHeight, getMaximumPreferredWidth, getMenuHandler, getMinimumPreferredHeight, getMinimumPreferredWidth, getParent, getPreferredHeight, getPreferredHeight, getPreferredHeightLimits, getPreferredSize, getPreferredWidth, getPreferredWidth, getPreferredWidthLimits, getSize, getSkin, getStyles, getTooltipText, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWindow, getX, getY, installThemeSkin, invalidate, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, layout, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, paint, reenterMouse, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setCursor, setCursor, setDragSource, setDropTarget, setEnabled, setHeight, setLocation, setLocation, setMaximumPreferredHeight, setMaximumPreferredWidth, setMenuHandler, setMinimumPreferredHeight, setMinimumPreferredWidth, setParent, setPreferredHeight, setPreferredHeightLimits, setPreferredHeightLimits, setPreferredSize, setPreferredSize, setPreferredWidth, setPreferredWidthLimits, setPreferredWidthLimits, setSize, setSize, setStyles, setStyles, setStyles, setTooltipText, setVisible, setWidth, setX, setY, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextArea

public TextArea()
Method Detail

setSkin

protected void setSkin(Skin skin)
Description copied from class: Component
Sets the skin, replacing any previous skin.

Overrides:
setSkin in class Component
Parameters:
skin - The new skin.

getDocument

public Document getDocument()
Returns the document that backs the text area.


setDocument

public void setDocument(Document document)
Sets the document that backs the text area.

Parameters:
document -

getText

public String getText()

setText

public void setText(String text)

setText

public void setText(URL text)

insert

public void insert(char character)

insert

public void insert(String text)

insertImage

public void insertImage(Image image)

insertParagraph

public void insertParagraph()

getCharacterCount

public int getCharacterCount()
Returns character count of the document.

Returns:
The document's character count, or 0 if the document is null.

delete

public void delete(boolean backspace)

cut

public void cut()

copy

public void copy()

paste

public void paste()

undo

public void undo()

redo

public void redo()

getSelectionStart

public int getSelectionStart()
Returns the starting index of the selection.

Returns:
The starting index of the selection.

getSelectionLength

public int getSelectionLength()
Returns the length of the selection.

Returns:
The length of the selection; may be 0.

getSelection

public Span getSelection()
Returns a span representing the current selection.

Returns:
A span containing the current selection. Both start and end points are inclusive. Returns null if the selection is empty.

setSelection

public void setSelection(int selectionStart,
                         int selectionLength)
Sets the selection. The sum of the selection start and length must be less than the length of the text input's content.

Parameters:
selectionStart - The starting index of the selection.
selectionLength - The length of the selection.

setSelection

public final void setSelection(Span selection)
Sets the selection.

Parameters:
selection -
See Also:
setSelection(int, int)

selectAll

public void selectAll()
Selects all text.


clearSelection

public void clearSelection()
Clears the selection.


getSelectedText

public String getSelectedText()
Returns the currently selected text.

Returns:
A new string containing a copy of the text in the selected range, or null if nothing is selected.

isEditable

public boolean isEditable()
Returns the text area's editable flag.


setEditable

public void setEditable(boolean editable)
Sets the text area's editable flag.

Parameters:
editable -

getTextKey

public String getTextKey()
Returns the text area's text key.

Returns:
The text key, or null if no text key is set.

setTextKey

public void setTextKey(String textKey)
Sets the text area's text key.

Parameters:
textKey - The text key, or null to clear the binding.

getTextBindType

public BindType getTextBindType()

setTextBindType

public void setTextBindType(BindType textBindType)

setTextBindType

public final void setTextBindType(String textBindType)

getTextBindMapping

public TextArea.TextBindMapping getTextBindMapping()

setTextBindMapping

public void setTextBindMapping(TextArea.TextBindMapping textBindMapping)

load

public void load(Object context)
Description copied from class: Component
Copies bound values from the bind context to the component. This functionality must be provided by the subclass; the base implementation is a no-op.

Overrides:
load in class Component

store

public void store(Object context)
Description copied from class: Component
Copies bound values from the component to the bind context. This functionality must be provided by the subclass; the base implementation is a no-op.

Overrides:
store in class Component

clear

public void clear()
Description copied from class: Component
Clears any bound values in the component.

Overrides:
clear in class Component

getInsertionPoint

public int getInsertionPoint(int x,
                             int y)

getNextInsertionPoint

public int getNextInsertionPoint(int x,
                                 int from,
                                 FocusTraversalDirection direction)

getRowIndex

public int getRowIndex(int offset)

getRowCount

public int getRowCount()

getCharacterBounds

public Bounds getCharacterBounds(int offset)

getTextAreaListeners

public ListenerList<TextAreaListener> getTextAreaListeners()

getTextAreaCharacterListeners

public ListenerList<TextAreaCharacterListener> getTextAreaCharacterListeners()

getTextAreaSelectionListeners

public ListenerList<TextAreaSelectionListener> getTextAreaSelectionListeners()

getTextAreaBindingListeners

public ListenerList<TextAreaBindingListener> getTextAreaBindingListeners()