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.
 
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(Direction direction)
           
 Bounds getCharacterBounds(int offset)
           
 Document getDocument()
           
 int getInsertionPoint(int x, int y)
           
 int getNextInsertionPoint(int x, int from, Direction 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<TextAreaCharacterListener> getTextAreaCharacterListeners()
           
 ListenerList<TextAreaListener> getTextAreaListeners()
           
 ListenerList<TextAreaSelectionListener> getTextAreaSelectionListeners()
           
 String getTextKey()
          Returns the text area's text key.
 void insertImage(Image image)
           
 void insertParagraph()
           
 void insertText(char character)
           
 void insertText(String text)
           
 boolean isEditable()
          Returns the text area's editable flag.
 void load(Dictionary<String,?> context)
          Copies bound values from the bind context to the component.
 void paste()
           
 void redo()
           
 void selectAll()
          Selects all text.
 void setDocument(Document document)
           
 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 setTextKey(String textKey)
          Sets the text area's text key.
 void store(Dictionary<String,?> context)
          Copies bound values from the component to the bind context.
 void undo()
           
 
Methods inherited from class org.apache.pivot.wtk.Component
clearFocus, getAttributes, 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, load, mapPointFromAncestor, mapPointToAncestor, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, paint, reenterMouse, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttributes, 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, store, 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()

setDocument

public void setDocument(Document document)

getText

public String getText()

setText

public void setText(String text)

setText

public void setText(URL text)

insertText

public void insertText(char character)

insertText

public void insertText(String text)

insertImage

public void insertImage(Image image)

insertParagraph

public void insertParagraph()

delete

public void delete(Direction direction)

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.

load

public void load(Dictionary<String,?> 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(Dictionary<String,?> 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,
                                 Direction 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()