pivot.wtk
Class TextArea

java.lang.Object
  extended by pivot.wtk.Component
      extended by pivot.wtk.TextArea
All Implemented Interfaces:
ConstrainedVisual, Visual

public class TextArea
extends Component

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

Author:
gbrown

Nested Class Summary
static interface TextArea.Skin
          Text area skin interface.
 
Nested classes/interfaces inherited from class pivot.wtk.Component
Component.Attributes, Component.ComponentDictionary, Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Constructor Summary
TextArea()
           
 
Method Summary
 void copy()
           
 void cut()
           
 void delete(Direction direction)
           
 int getCharacterAt(int x, int y)
           
 Bounds getCharacterBounds(int offset)
           
 Document getDocument()
           
 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 setDocument(Document document)
           
 void setEditable(boolean editable)
          Sets the text area's editable flag.
protected  void setParent(Container parent)
           
 void setSelection(int selectionStart, int selectionLength)
          Sets the selection.
protected  void setSkin(Skin skin)
          Sets the skin, replacing any previous skin.
 void setText(String 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 pivot.wtk.Component
clearFocus, clearFocus, finalize, getAttributes, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentDragDropListeners, getComponentKeyListeners, getComponentLayoutListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponents, getComponentStateListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getGraphics, getHandle, getHeight, getLocation, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getSize, getSkin, getStyles, getTooltipText, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWindow, getX, getY, installSkin, invalidate, isBlocked, isDisplayable, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, load, mapPointFromAncestor, mapPointToAncestor, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, paint, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttributes, setCursor, setCursor, setDisplayable, setDragSource, setDropTarget, setEnabled, setFocused, setHeight, setLocation, setLocation, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setStyles, setStyles, setStyles, setTooltipText, setVisible, setWidth, setX, setY, store, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, 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.

setParent

protected void setParent(Container parent)
Overrides:
setParent in class Component

getDocument

public Document getDocument()

setDocument

public void setDocument(Document document)

getText

public String getText()

setText

public void setText(String text)

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

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.

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.

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

getCharacterAt

public int getCharacterAt(int x,
                          int y)

getCharacterBounds

public Bounds getCharacterBounds(int offset)

getTextAreaListeners

public ListenerList<TextAreaListener> getTextAreaListeners()

getTextAreaCharacterListeners

public ListenerList<TextAreaCharacterListener> getTextAreaCharacterListeners()

getTextAreaSelectionListeners

public ListenerList<TextAreaSelectionListener> getTextAreaSelectionListeners()