danger.ui
Class EditText

java.lang.Object
  |
  +--danger.app.Listener
        |
        +--danger.ui.View
              |
              +--danger.ui.Container
                    |
                    +--danger.ui.Control
                          |
                          +--danger.ui.EditText
Direct Known Subclasses:
TextField

public class EditText
extends Control


Field Summary
protected  Rect mCursorRect
           
protected  Font mFont
           
 
Fields inherited from class danger.ui.Control
mValue
 
Fields inherited from class danger.ui.View
mOriginX, mOriginY, mStyle, STATE_CAN_FOCUS, STATE_DEBUG_BOUNDS, STATE_ENABLED, STATE_FOCUSED, STATE_TRANSPARENT, STATE_VISIBLE
 
Constructor Summary
EditText()
           
EditText(boolean autoText, boolean autoCap)
           
EditText(java.lang.String inLabel)
           
EditText(java.lang.String inLabel, boolean autoText, boolean autoCap)
           
 
Method Summary
 int addTextEditMenuItems(Menu m)
           
 void bringCursorIntoView()
           
 boolean canScrollDown()
           
 boolean canScrollUp()
           
 char charAt(int index)
           
 void clear()
           
 boolean copySelection()
           
 boolean cutSelection()
           
 void delete(int numChar)
           
 void deleteChar()
           
 void deleteLineAtPoint()
           
protected  void drawFrame(Pen p, Rect dim)
           
 boolean eventKeyDown(char c, Event event)
           
 boolean eventKeyRepeat(char c, Event event)
           
 boolean eventPeriodicPulse(int timestamp)
           
 boolean eventShortcut(char inKey)
           
 boolean eventWidgetDown(int inWhichWidget, Event event)
          Handles 'down' actions on the gizmo widgets.
 boolean eventWidgetHeld(int inWhichWidget, Event event)
           
 boolean eventWidgetUp(int inWhichWidget, Event event)
          Handle the release of a device widget
 void forwardDeleteChar()
           
 void forwardDeleteChar(int count)
           
 boolean getAcceptKeyRepeats()
           
static int getActiveMetaKey()
           
 boolean getAutoCap()
           
 boolean getAutoResize()
           
 boolean getAutoText()
           
 char[] getChars()
           
 char[] getChars(int inFirstChar, int inNumChars)
           
 int getCursorLine()
           
 int getInsertionPoint()
           
 Rect getInterestingRect()
           
 Rect getInterestingRect(Rect r)
           
 java.lang.String getLine(int inLineNum)
           
 java.lang.String getString()
           
 java.lang.String getStringCRLF()
           
 char[] grabSelection()
           
 void insert(char inChar)
           
 void insert(java.lang.String inText)
           
protected  void invalidateCursor()
           
 boolean isEditable()
           
protected static boolean isShortcutTrigger(char ch)
           
 void justifyCenter()
           
 void justifyLeft()
           
 void justifyRight()
           
protected  boolean loadCursorRect(Rect outRect)
           
 void loseFocus()
           
 int numChars()
           
 int numLines()
           
 void paint(Pen p)
          Draw the contents of this View.
 boolean paste()
           
 boolean receiveEvent(Event e)
          Entry point for event processing.
 void resetSelection()
           
 boolean scrollDown()
           
 boolean scrollUp()
           
 boolean selectAll()
           
protected  int selectionEnd()
           
 void setAcceptKeyRepeats(boolean inAccept)
           
static void setActiveMetaKey(int key)
           
protected  void setAllowCursorBlink(boolean allow)
           
 void setAutoCap(boolean inAutoCap)
           
 void setAutoResize(boolean inAutoResize)
           
 void setAutoText(boolean inAutoText)
           
 void setCursorLine(int line)
           
 void setEditable(boolean inEditable)
           
 void setFont(Font inFont)
           
 void setHasBorder(boolean inHasBorder)
           
 void setInputFilter(TextInputFilter inInputFilter)
           
 void setInsertionPoint(int inOffset)
           
 void setSelection(int inStart, int inEnd)
           
 void setSize(int width, int height)
          Resize the block of text.
 void setText(java.lang.String inText)
           
 void setWantQuoteHack(boolean opt)
           
 void takeFocus(boolean inFromAbove)
           
 boolean willFocusWithin(Rect r)
           
 
Methods inherited from class danger.ui.Control
drawFocusBox, drawIdleBox, drawIdleBox, getEvent, getEventListener, getEventType, getHasBorder, getTitle, getValue, sendEvent, setEvent, setEvent, setEvent, setEvent, setEvent, setEventListener, setTitle, setValue
 
Methods inherited from class danger.ui.Container
addChild, addChild, addChildAt, advanceFocus, childCount, childIsOnScreen, disable, enable, eventKeyHeld, eventKeyUp, getBottomChild, getChildAt, getChildIndex, getChildWithID, getDescendantWithID, getFirstChild, getFirstFocusableChild, getFocusedChild, getLastChild, getLastFocusableChild, hideAllChildren, moveChildToIndex, paintChildren, reflowChildren, removeAllChildren, removeChild, reverseFocus, setFocusedChild, setFocusedChild, setWindow, showAllChildren, snapToChildren
 
Methods inherited from class danger.ui.View
clear, copyStyle, getAcceptFocus, getBackgroundColor, getBottom, getBounds, getBounds, getFrame, getFrame, getHeight, getLeft, getOrigin, getOrigin, getOriginX, getOriginY, getParent, getRight, getSibling, getStyle, getStyleColor, getStyleFont, getTop, getWidth, getWindow, globalToLocal, hide, invalidate, invalidate, invalidate, isEnabled, isFocusable, isFocused, isOnScreen, isTransparent, isVisible, keepRectInView, localToGlobal, localToGlobal, localToWindow, moveBy, offsetOrigin, offsetOrigin, onAddedToParent, onDecoded, onPeriodicPulse, onRemovedFromParent, onStyleChanged, onWindowPaint, receiveEventInternal, resetOrigin, sendEventToWindow, setAcceptFocus, setBackgroundColor, setBottom, setDebugBounds, setEnabled, setFrame, setHeight, setKeyedValue, setLeft, setOrigin, setOrigin, setPosition, setRight, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, setTransparent, setVisible, setWidth, shouldDropEvent, show, styleIsDefault, windowToLocal
 
Methods inherited from class danger.app.Listener
cancelEvents, sendEvent, sendEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mCursorRect

protected Rect mCursorRect

mFont

protected Font mFont
Constructor Detail

EditText

public EditText()

EditText

public EditText(java.lang.String inLabel)

EditText

public EditText(boolean autoText,
                boolean autoCap)

EditText

public EditText(java.lang.String inLabel,
                boolean autoText,
                boolean autoCap)
Method Detail

setInputFilter

public void setInputFilter(TextInputFilter inInputFilter)

getInterestingRect

public Rect getInterestingRect()
Overrides:
getInterestingRect in class View

getInterestingRect

public Rect getInterestingRect(Rect r)
Overrides:
getInterestingRect in class View

setSize

public void setSize(int width,
                    int height)
Resize the block of text. The parent will Invalidate() as a side-effect if the View is visible. The number of displayable lines will also be recalculated based on the new height.
Overrides:
setSize in class View

insert

public void insert(java.lang.String inText)

insert

public void insert(char inChar)

deleteChar

public void deleteChar()

delete

public void delete(int numChar)

forwardDeleteChar

public void forwardDeleteChar()

forwardDeleteChar

public void forwardDeleteChar(int count)

deleteLineAtPoint

public void deleteLineAtPoint()

setText

public void setText(java.lang.String inText)

setFont

public void setFont(Font inFont)

clear

public void clear()

setAcceptKeyRepeats

public void setAcceptKeyRepeats(boolean inAccept)

getAcceptKeyRepeats

public boolean getAcceptKeyRepeats()

selectionEnd

protected final int selectionEnd()

selectAll

public final boolean selectAll()

setSelection

public final void setSelection(int inStart,
                               int inEnd)

resetSelection

public final void resetSelection()

cutSelection

public final boolean cutSelection()

copySelection

public final boolean copySelection()

grabSelection

public final char[] grabSelection()

paste

public final boolean paste()

receiveEvent

public boolean receiveEvent(Event e)
Description copied from class: Listener
Entry point for event processing. Default behaviour is to do nothing and return false. Normally this method is called from a Dispatcher when it discovers an Event in its queue that is targetted at this Listener.
Overrides:
receiveEvent in class Container

eventWidgetUp

public boolean eventWidgetUp(int inWhichWidget,
                             Event event)
Description copied from class: Container
Handle the release of a device widget
Overrides:
eventWidgetUp in class Container
Following copied from class: danger.ui.Container
Parameters:
inWidget - the widget that went down
Returns:
whether or not the event was consumed

eventWidgetDown

public boolean eventWidgetDown(int inWhichWidget,
                               Event event)
Handles 'down' actions on the gizmo widgets. The wheel controls movement of the insertion point.
Overrides:
eventWidgetDown in class Container
Parameters:
inWhichWidget - indicates which of the controls on the device went 'down'

eventKeyDown

public boolean eventKeyDown(char c,
                            Event event)
Overrides:
eventKeyDown in class Container

eventKeyRepeat

public boolean eventKeyRepeat(char c,
                              Event event)
Overrides:
eventKeyRepeat in class Container

eventShortcut

public boolean eventShortcut(char inKey)
Overrides:
eventShortcut in class Container

eventPeriodicPulse

public boolean eventPeriodicPulse(int timestamp)
Overrides:
eventPeriodicPulse in class Container

setAllowCursorBlink

protected void setAllowCursorBlink(boolean allow)

invalidateCursor

protected void invalidateCursor()

canScrollUp

public boolean canScrollUp()

canScrollDown

public boolean canScrollDown()

scrollDown

public boolean scrollDown()

scrollUp

public boolean scrollUp()

getString

public java.lang.String getString()
Overrides:
getString in class Control

getStringCRLF

public java.lang.String getStringCRLF()

getLine

public java.lang.String getLine(int inLineNum)

numLines

public int numLines()

numChars

public int numChars()

charAt

public char charAt(int index)

getChars

public char[] getChars()

getChars

public char[] getChars(int inFirstChar,
                       int inNumChars)

drawFrame

protected void drawFrame(Pen p,
                         Rect dim)

paint

public void paint(Pen p)
Description copied from class: View
Draw the contents of this View. This method is called by the graphics system when the View needs to be repainted. A Pen will be provided which is appropriately clipped and translated for drawing on this View.
Overrides:
paint in class Container

getCursorLine

public int getCursorLine()

setCursorLine

public void setCursorLine(int line)

bringCursorIntoView

public void bringCursorIntoView()

takeFocus

public void takeFocus(boolean inFromAbove)
Overrides:
takeFocus in class Container

loseFocus

public void loseFocus()
Overrides:
loseFocus in class Container

loadCursorRect

protected boolean loadCursorRect(Rect outRect)

setHasBorder

public void setHasBorder(boolean inHasBorder)
Overrides:
setHasBorder in class Control

setAutoResize

public void setAutoResize(boolean inAutoResize)

getAutoResize

public boolean getAutoResize()

justifyLeft

public void justifyLeft()

justifyCenter

public void justifyCenter()

justifyRight

public void justifyRight()

setInsertionPoint

public void setInsertionPoint(int inOffset)

getInsertionPoint

public int getInsertionPoint()

willFocusWithin

public boolean willFocusWithin(Rect r)
Overrides:
willFocusWithin in class View

getAutoText

public boolean getAutoText()

setAutoText

public void setAutoText(boolean inAutoText)

getAutoCap

public boolean getAutoCap()

setAutoCap

public void setAutoCap(boolean inAutoCap)

setWantQuoteHack

public void setWantQuoteHack(boolean opt)

isEditable

public boolean isEditable()

setEditable

public void setEditable(boolean inEditable)

setActiveMetaKey

public static void setActiveMetaKey(int key)

getActiveMetaKey

public static int getActiveMetaKey()

isShortcutTrigger

protected static boolean isShortcutTrigger(char ch)

addTextEditMenuItems

public final int addTextEditMenuItems(Menu m)

eventWidgetHeld

public final boolean eventWidgetHeld(int inWhichWidget,
                                     Event event)
Overrides:
eventWidgetHeld in class Container


Danger Confidential. Copyright © 2000-2003, Danger Inc.