ewe.ui
Class EditControl

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
          extended byewe.ui.EditControl
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, ImageRefresher, Selectable, TimerProc, UIConstants
Direct Known Subclasses:
Console, mInput, mTextArea, mTextPad

public abstract class EditControl
extends Control
implements Selectable

This is a base class for mInput and mTextPad.


Field Summary
protected  int blinkId
           
static int CASE_LOWER
           
static int CASE_NORMAL
           
static int CASE_NUMBERS
           
static int CASE_SENTENCE
           
static int CASE_UPPER
           
protected  Color[] colors
           
protected  char conditionalChar
           
protected  int conditionalCharIndex
           
protected  boolean doingLocalInput
           
protected  boolean doingNativeInput
           
static int FLAG_INPUT_ON_FOCUS
          Use this in combination with FLAG_PASSIVE.
static int FLAG_KEEP_FOCUS_AFTER_INPUT
          Use this in combination with FLAG_PASSIVE.
static int FLAG_PASSIVE
          This tells the system that the EditControl should be "passive", i.e.
static int FLAG_USE_NATIVE
          This tells the system to use a native input method.
protected  boolean inFocus
          If native input is used, this will normally start automatically when the input gets focus.
 int inputFlags
          This value is -1 as default - which tells the VM to pick the best input flags for the current system.
 InputMethod inputMethod
          You can set this to be a valid InputMethod object.
 boolean justGotFocus
           
protected  String oldText
           
 Color pageColor
           
protected  boolean startNativeOnPaint
           
 int textCase
          This is CASE_NORMAL by default.
 InputValidator validator
           
 
Fields inherited from class ewe.ui.Control
_debug, backGround, beforeRemoved, borderColor, borderStyle, borderWidth, children, columns, constraints, DoPaintMethod, dragging, dragResolution, dragTime, exitKeys, fieldTransfer, font, foreGround, haveNativePaint, height, holdDownPause, holdTick, hotKey, image, lastSelected, listeners, maxHeight, maxWidth, menuState, minHeight, minWidth, modifiers, MyClass, name, next, np, parent, penStatus, popupSound, popupSoundClip, preferredHeight, preferredWidth, prev, prompt, promptControl, rows, ss, standardBorder, standardEdge, startDragResolution, tags, tail, text, toolTip, width, x, y
 
Fields inherited from class ewe.ui.ControlBase
clipItems, clipObject, clipOwner, curPoint, currentPenEvent, debugControl, debugFlag, DidHoldDown, doubleBuffer, doubleClickTime, firstPress, globalDrawFlat, globalEditable, globalEnabled, globalPalmStyle, globalSmallControls, GotPenDown, PenIsOn, pressPoint, TAG_LAST_USER_DATA, TAG_USER_DATA, TAKE_FIRST_PRESS, unnamed, useNativeTextInput
 
Fields inherited from interface ewe.ui.UIConstants
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, BF_BOTTOM, BF_BOTTOMLEFT, BF_BOTTOMRIGHT, BF_BUTTON, BF_DIAGONAL, BF_DIAGONAL_ENDBOTTOMLEFT, BF_DIAGONAL_ENDBOTTOMRIGHT, BF_DIAGONAL_ENDTOPLEFT, BF_DIAGONAL_ENDTOPRIGHT, BF_EXACT, BF_FLAT, BF_LEFT, BF_MIDDLE, BF_MONO, BF_PALM, BF_RECT, BF_RIGHT, BF_SOFT, BF_SQUARE, BF_TOP, BF_TOPLEFT, BF_TOPRIGHT, EDGE_BUMP, EDGE_ETCHED, EDGE_RAISED, EDGE_SUNKEN
 
Fields inherited from interface ewe.ui.CellConstants
BORDER, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, FIXEDSIZE, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST
 
Fields inherited from interface ewe.ui.ControlConstants
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, Disabled, DisablePopupMenu, DisplayOnly, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpKeyEvents, SendUpPenEvents, ShowSIP, ShrinkToNothing, SmallControl, SpecialBackground, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown
 
Fields inherited from interface ewe.fx.ImageRefresher
KEEP_VISIBLE
 
Constructor Summary
EditControl()
           
 
Method Summary
 boolean acceptsData(Object data, DragContext how)
          This should indicate whether this control will accept the data either via a drag and drop or via a paste operation.
protected  KeyEvent checkInputMethod(KeyEvent receivedKeyEvent)
           
 boolean checkSipCoverage()
           
protected  void dataBeingRemoved(Object data, DragContext dc)
          This tells the control that data is being removed from it either via a cut operation or by a drag operation that is not explicitly a copy operation.
protected  void dataTransferCancelled(Object data)
          This gets called either when that was cut from this control was not placed into another control (either it was rejected by a paste or a subsequent copy/cut into the clipboard occured before the data was pasted) or a drag and drop was initiated but not completed.
 String fixCase(String text)
          This converts the case of the incoming text to the one associated with the edit control.
 int getBestPassiveFlags()
          Passive mode is normally selected on SmartPhone devices.
protected  void getColors(boolean hasFocus, int flags)
          Provides the colors to be used for the text and background colors.
 boolean hasChanged()
           
protected  boolean keepConditionalChar()
           
 void onControlEvent(ControlEvent ev)
           
protected abstract  boolean paintConditionalChar(Graphics g, boolean highlight)
           
abstract  void selectAll()
           
protected  void setConditionalChar(char cc, int index)
           
protected  void setNativeInputFlags(TextInputParameters tip)
           
 boolean startActiveInput(boolean selectAll)
          This tells the Control to start active input IF it has the FLAG_PASSIVE value set.
protected  void startLocalInput(boolean selectAll)
           
protected  boolean startNativeInput(boolean selectAll)
           
 boolean takeData(Object data, DragContext how)
          This tells the Control to take the data which has either come from a clipboard operation or from a DragAndDrop.
 void update()
           
 void updateData()
          This tells the control to consider its current data to be unchanged.
 
Methods inherited from class ewe.ui.Control
activate, addListener, addTimer, amOnTopFrame, calculateSizes, calculateTextSize, cancelCut, cancelHoldDown, canEdit, chainDataChange, change, checkClipboardOperations, checkExitKey, checkMenu, checkMenuKey, checkModifiers, checkPenTransparent, clearTag, clipboardToString, clipboardTransfer, closeMenu, contains, contains, createGraphics, dataAccepted, dataDraggedOff, dataDraggedOver, dataDraggedOver, dataDroppedOn, deactivate, defaultTo, doAction, doActionKey, doBackground, doBorder, doHotKey, doMenu, dontAcceptDrop, doPaint, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, doPaintData, doShowMenu, dragged, exitEntry, fillBackground, formClosing, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getChildren, getChildrenBackwards, getClipboardMenu, getClipObject, getControlBuffer, getControlBuffer, getDataRect, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFont, getFontMetrics, getFontMetrics, getForeground, getFrame, getFrameOrContainer, getGraphics, getImage, getLastSelected, getLocation, getMaximumSize, getMenu, getMinimumSize, getModifiers, getNext, getNextKeyFocus, getParent, getPasswordCharacter, getPosInFrame, getPosInParent, getPreferredSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getSubControls, getTag, getText, getToolTip, getWindow, gotFocus, hasModifier, hasPopupFormAttached, hasTag, inheritModifiers, isChildOf, isModal, isOnMe, isSomeonesHotKey, lostFocus, make, makeFrameTopMost, makeHot, menuIsActive, modify, modifyAll, modifyAll, notifyAction, notifyDataChange, notifyDataChange, notNative_doPaintChildren, oldButWorksDoPaintChildren, oldPaintChildren, oldPostEvent, onEvent, onKeyEvent, onLabelPenEvent, onPaint, onPenEvent, paintBackground, paintChildren, penClicked, penDoubleClicked, penHeld, penPressed, penReleased, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, popupMenuEvent, postEvent, recalculatePreferredSize, redisplay, refresh, removeListener, removeTimer, repaint, repaintDataNow, repaintNow, repaintNow, repaintNow, requestPaint, requestResizeTo, resetRect, resizeTo, restore, scrollAndRepaint, sendToListeners, set, setBorder, setCell, setClipObject, setControl, setCursor, setFixedSize, setFont, setHotKey, setHotKey, setLocation, setMaximumSize, setMenu, setMinimumSize, setPreferredSize, setPromptControl, setRect, setRect, setServer, setTag, setTags, setText, setTextSize, setToolTip, show, shown, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, startDragging, stopDragging, takeFocus, takeFromClipboard, takePromptControl, testDim, ticked, toClipboard, toField, toField, toString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryNext, tryStartMenu, willAcceptDrop, willShowFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode
 
Methods inherited from interface ewe.ui.Selectable
deleteSelection, getSelection, hasSelection, noSelection, replaceSelection
 

Field Detail

justGotFocus

public boolean justGotFocus

oldText

protected String oldText

pageColor

public Color pageColor

doingLocalInput

protected boolean doingLocalInput

doingNativeInput

protected boolean doingNativeInput

textCase

public int textCase
This is CASE_NORMAL by default. You can change it to CASE_NUMBERS, CASE_UPPER, CASE_LOWER and CASE_SENTENCE


CASE_NORMAL

public static final int CASE_NORMAL
See Also:
Constant Field Values

CASE_UPPER

public static final int CASE_UPPER
See Also:
Constant Field Values

CASE_LOWER

public static final int CASE_LOWER
See Also:
Constant Field Values

CASE_SENTENCE

public static final int CASE_SENTENCE
See Also:
Constant Field Values

CASE_NUMBERS

public static final int CASE_NUMBERS
See Also:
Constant Field Values

colors

protected Color[] colors

inputFlags

public int inputFlags
This value is -1 as default - which tells the VM to pick the best input flags for the current system. This value is not picked until the control gets focus for the first time, so you can set this value before that point. For a SmartPhone system this will usually be FLAG_USE_NATIVE|FLAG_PASSIVE|FLAG_INPUT_ON_FOCUS


FLAG_USE_NATIVE

public static int FLAG_USE_NATIVE
This tells the system to use a native input method. This is only available on some systems. When using this you should also use FLAG_PASSIVE.


FLAG_PASSIVE

public static int FLAG_PASSIVE
This tells the system that the EditControl should be "passive", i.e. no input is allowed until the input is activated by the action key or pen press.


FLAG_INPUT_ON_FOCUS

public static int FLAG_INPUT_ON_FOCUS
Use this in combination with FLAG_PASSIVE. This tells the Control to automatically start active input when the EditControl gets the focus.


FLAG_KEEP_FOCUS_AFTER_INPUT

public static int FLAG_KEEP_FOCUS_AFTER_INPUT
Use this in combination with FLAG_PASSIVE. This tells the Control to keep the focus after input is complete (e.g. if Enter is pressed).


inputMethod

public InputMethod inputMethod
You can set this to be a valid InputMethod object.


validator

public InputValidator validator

inFocus

protected boolean inFocus
If native input is used, this will normally start automatically when the input gets focus. If this is set true, then that will not happen.


startNativeOnPaint

protected boolean startNativeOnPaint

blinkId

protected int blinkId

conditionalCharIndex

protected int conditionalCharIndex

conditionalChar

protected char conditionalChar
Constructor Detail

EditControl

public EditControl()
Method Detail

getColors

protected void getColors(boolean hasFocus,
                         int flags)
Provides the colors to be used for the text and background colors. The colors are placed in the colors variable. This is an array of Colors of length 4 which is to receive the colors to be used as follows:
colors[0] = Text color, colors[1] = Background color, colors[2] = Selected text color, colors[3] = Selected text background color.

Parameters:
hasFocus - True if the control currently has the focus.
flags - This is the result of a call to getFlags(true) - which provides an OR'ing of all the flags of this control and all its parents.

getBestPassiveFlags

public int getBestPassiveFlags()
Passive mode is normally selected on SmartPhone devices. This method returns the most appropriate set of flags for a particular EditControl on the current system.


selectAll

public abstract void selectAll()

hasChanged

public boolean hasChanged()

updateData

public void updateData()
Description copied from class: Control
This tells the control to consider its current data to be unchanged.

Overrides:
updateData in class Control

onControlEvent

public void onControlEvent(ControlEvent ev)
Overrides:
onControlEvent in class Control

checkSipCoverage

public boolean checkSipCoverage()

takeData

public boolean takeData(Object data,
                        DragContext how)
Description copied from class: Control
This tells the Control to take the data which has either come from a clipboard operation or from a DragAndDrop.

Overrides:
takeData in class Control
Parameters:
data - The data to accept.
how - if the transfer is via DragAndDrop this will be a DragContext object, otherwise it will be null to indicate a clipboard operation.
Returns:
true if the data was successfully accepted.

acceptsData

public boolean acceptsData(Object data,
                           DragContext how)
Description copied from class: Control
This should indicate whether this control will accept the data either via a drag and drop or via a paste operation.

Overrides:
acceptsData in class Control
Parameters:
data - The data to be transferred.
how - if the transfer is via DragAndDrop this will be a DragContext object, otherwise it will be null to indicate a clipboard operation.
Returns:
true if the data will be accepted by this control.

dataBeingRemoved

protected void dataBeingRemoved(Object data,
                                DragContext dc)
Description copied from class: Control
This tells the control that data is being removed from it either via a cut operation or by a drag operation that is not explicitly a copy operation. If the object is a Selectable object, then by default this will call delete selection. If you want more advanced operations (e.g. graying out the selection) you need to override this. If DragContext is null, it implies that it is via a "cut" operation, otherwise it is via a drag.

Overrides:
dataBeingRemoved in class Control

dataTransferCancelled

protected void dataTransferCancelled(Object data)
Description copied from class: Control
This gets called either when that was cut from this control was not placed into another control (either it was rejected by a paste or a subsequent copy/cut into the clipboard occured before the data was pasted) or a drag and drop was initiated but not completed.

Overrides:
dataTransferCancelled in class Control
Parameters:
data - The data that was being transferred. If it is null it indicates that this Control was a destination for a Drag and Drop operation, but the operation was cancelled by the user.

update

public void update()

startNativeInput

protected boolean startNativeInput(boolean selectAll)

startLocalInput

protected void startLocalInput(boolean selectAll)

startActiveInput

public boolean startActiveInput(boolean selectAll)
This tells the Control to start active input IF it has the FLAG_PASSIVE value set. This will start either native or local input depending on the value of FLAG_USE_NATIVE.


setNativeInputFlags

protected void setNativeInputFlags(TextInputParameters tip)

fixCase

public String fixCase(String text)
This converts the case of the incoming text to the one associated with the edit control.


checkInputMethod

protected KeyEvent checkInputMethod(KeyEvent receivedKeyEvent)

paintConditionalChar

protected abstract boolean paintConditionalChar(Graphics g,
                                                boolean highlight)

keepConditionalChar

protected boolean keepConditionalChar()

setConditionalChar

protected void setConditionalChar(char cc,
                                  int index)