ewe.ui
Class NumberEntry

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
          extended byewe.ui.ButtonControl
              extended byewe.ui.mButton
                  extended byewe.ui.TextDisplayButton
                      extended byewe.ui.NumberEntry
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, ImageRefresher, TimerProc, UIConstants

public class NumberEntry
extends TextDisplayButton


Field Summary
static int ALLOW_BLANK
           
static int ALLOW_LEADING_ZEROS
           
static int ENTER_AS_TEXT
           
 int myOptions
          The options selected for the NumberEntry.
 
Fields inherited from class ewe.ui.TextDisplayButton
isPassword, passwordCharacter
 
Fields inherited from class ewe.ui.mButton
action, buttonObject, insideColor, textPosition
 
Fields inherited from class ewe.ui.ButtonControl
actionOnPress, alignment, anchor, arrowDirection, flatInside, imageAnchor, inPress, pressState, shouldRepeat, state
 
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
NumberEntry()
           
NumberEntry(int options)
           
NumberEntry(int options, String extraChars)
           
 
Method Summary
protected  boolean canExitWithValue(String text, InputKeyPad kp)
          Override this to validate the final text.
protected  String fixValue(String text, String oldText)
           
static Control getBestEntryForNumericText(String extraChars, char passwordCharacter)
          This will return, on a device with a keyboard, an mInput that allows only numeric entry, while, on a device without a keyboard, a NumberEntry that allows entry as text.
protected  String validateFinalText(String newText, String oldText)
           
 
Methods inherited from class ewe.ui.TextDisplayButton
getDisplayText, getPasswordCharacter, setBorderStyle
 
Methods inherited from class ewe.ui.mButton
calculateSizes, doPaint, getImageColor, getImageColor, gotFocus, lostFocus, make
 
Methods inherited from class ewe.ui.ButtonControl
activate, deactivate, doAction, doPenHeld, doPenPress, dragged, fullAction, fullAction, penHeld, penPressed, penReleased, penRightReleased, startDragging, startDropMenu, stopDragging
 
Methods inherited from class ewe.ui.Control
acceptsData, addListener, addTimer, amOnTopFrame, calculateTextSize, cancelCut, cancelHoldDown, canEdit, chainDataChange, change, checkClipboardOperations, checkExitKey, checkMenu, checkMenuKey, checkModifiers, checkPenTransparent, clearTag, clipboardToString, clipboardTransfer, closeMenu, contains, contains, createGraphics, dataAccepted, dataBeingRemoved, dataDraggedOff, dataDraggedOver, dataDraggedOver, dataDroppedOn, dataTransferCancelled, defaultTo, doActionKey, doBackground, doBorder, doHotKey, doMenu, dontAcceptDrop, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, doPaintData, doShowMenu, exitEntry, fillBackground, formClosing, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getChildren, getChildrenBackwards, getClipboardMenu, getClipObject, getControlBuffer, getControlBuffer, getDataRect, getDataToCopy, getDataToDragAndDrop, getDim, getDragAndDropContext, getFont, getFontMetrics, getFontMetrics, getForeground, getFrame, getFrameOrContainer, getGraphics, getImage, getLastSelected, getLocation, getMaximumSize, getMenu, getMinimumSize, getModifiers, getNext, getNextKeyFocus, getParent, getPosInFrame, getPosInParent, getPreferredSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getSubControls, getTag, getText, getToolTip, getWindow, hasModifier, hasPopupFormAttached, hasTag, inheritModifiers, isChildOf, isModal, isOnMe, isSomeonesHotKey, makeFrameTopMost, makeHot, menuIsActive, modify, modifyAll, modifyAll, notifyAction, notifyDataChange, notifyDataChange, notNative_doPaintChildren, oldButWorksDoPaintChildren, oldPaintChildren, oldPostEvent, onControlEvent, onEvent, onKeyEvent, onLabelPenEvent, onPaint, onPenEvent, paintBackground, paintChildren, penClicked, penDoubleClicked, 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, takeData, takeFocus, takeFromClipboard, takePromptControl, testDim, ticked, toClipboard, toField, toField, toString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryNext, tryStartMenu, updateData, willAcceptDrop, willShowFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode
 

Field Detail

myOptions

public int myOptions
The options selected for the NumberEntry.


ALLOW_LEADING_ZEROS

public static final int ALLOW_LEADING_ZEROS
See Also:
Constant Field Values

ALLOW_BLANK

public static final int ALLOW_BLANK
See Also:
Constant Field Values

ENTER_AS_TEXT

public static final int ENTER_AS_TEXT
See Also:
Constant Field Values
Constructor Detail

NumberEntry

public NumberEntry()

NumberEntry

public NumberEntry(int options)

NumberEntry

public NumberEntry(int options,
                   String extraChars)
Method Detail

getBestEntryForNumericText

public static Control getBestEntryForNumericText(String extraChars,
                                                 char passwordCharacter)
This will return, on a device with a keyboard, an mInput that allows only numeric entry, while, on a device without a keyboard, a NumberEntry that allows entry as text.

Parameters:
extraChars - Extra input characters allowed in addition to '0' to '9'. If this is null only number keys will be allowed.
passwordCharacter - if this is 0 the no password hiding of the text will be done. If it is not 0, then the character provided will be used as the password character (use '*' as default).
Returns:
a Control that is the best one for use for numeric entry on the current device.

validateFinalText

protected String validateFinalText(String newText,
                                   String oldText)

fixValue

protected String fixValue(String text,
                          String oldText)

canExitWithValue

protected boolean canExitWithValue(String text,
                                   InputKeyPad kp)
Override this to validate the final text. Within this method you can call setValue() on the InputKeyPad to change its value. If this method returns false the InputKeyPad used will not exit.