com.sybase.uep.bobclient.controls
Class TextInput

java.lang.Object
  extended by net.rim.device.api.ui.Field
      extended by net.rim.device.api.ui.component.TextField
          extended by net.rim.device.api.ui.component.BasicEditField
              extended by net.rim.device.api.ui.component.EditField
                  extended by com.sybase.uep.bobclient.controls.TextInput
All Implemented Interfaces:
Control, ITextInput, PIMControl, net.rim.device.api.ui.FieldChangeListener, net.rim.device.internal.ui.Formatter.TextRenderer

public class TextInput
extends net.rim.device.api.ui.component.EditField
implements Control, PIMControl, net.rim.device.api.ui.FieldChangeListener, ITextInput

This is the text input control

Author:
tdang

Field Summary
 
Fields inherited from class net.rim.device.api.ui.component.BasicEditField
FILTER_DEFAULT, FILTER_EMAIL, FILTER_FILENAME, FILTER_HEXADECIMAL, FILTER_INTEGER, FILTER_LOWERCASE, FILTER_NUMERIC, FILTER_PHONE, FILTER_PIN_ADDRESS, FILTER_REAL_NUMERIC, FILTER_UPPERCASE, FILTER_URL
 
Fields inherited from class net.rim.device.api.ui.component.TextField
CONSUME_INPUT, DEFAULT_MAXCHARS, JUMP_FOCUS_AT_END, NO_COMPLEX_INPUT, NO_EDIT_MODE_INPUT, NO_LEARNING, NO_NEWLINE, NO_SWITCHING_INPUT
 
Fields inherited from class net.rim.device.api.ui.Field
ACTION_INVOKE, EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEADING, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, FIELD_TRAILING, FIELD_VALIGN_MASK, FIELD_VCENTER, FOCUSABLE, FOCUSABLE_MASK, HIGHLIGHT_FOCUS, HIGHLIGHT_SELECT, NON_FOCUSABLE, NON_SPELLCHECKABLE, READONLY, SPELLCHECKABLE, SPELLCHECKABLE_MASK, STATUS_MOVE_FOCUS_HORIZONTALLY, STATUS_MOVE_FOCUS_VERTICALLY, USE_ALL_HEIGHT, USE_ALL_WIDTH, VISUAL_STATE_ACTIVE, VISUAL_STATE_DISABLED, VISUAL_STATE_DISABLED_FOCUS, VISUAL_STATE_FOCUS, VISUAL_STATE_NORMAL
 
Fields inherited from interface net.rim.device.api.ui.FieldChangeListener
PROGRAMMATIC
 
Constructor Summary
TextInput(java.lang.String defaultValue, int maxNumChars, long style)
          Constructor to create the text input
 
Method Summary
protected  ImageScreen createImageScreen(byte[] imageData)
          Create an image screen
protected  void drawFocus(net.rim.device.api.ui.Graphics g, boolean on)
          (non-Javadoc)
 void fieldChanged(net.rim.device.api.ui.Field field, int context)
          (non-Javadoc)
 int getBorderColor()
           
 int getColSpan()
          (non-Javadoc)
 int getControlID()
          Returns the control's ID
 TextInputController getController()
          Get the text input controller
 ICustomEventsDelegate getCustomEventsDelegate()
          Returns the control's custom events delegate
 FontStyle getFontStyle()
          Get this control's font style
 long getHorizontalAlignment()
          (non-Javadoc)
 LogicalType getLogicalType()
          Retrieve the logical type assign to this control
 java.lang.String getName()
          (non-Javadoc)
 java.lang.Object getPIMValue()
          Retrieve the PIM value
 int getPreferredHeight()
          (non-Javadoc)
 int getPreferredWidth()
          (non-Javadoc)
 byte[] getRawBinaryData()
          Get byte array data
 int getRowSpan()
          (non-Javadoc)
 java.lang.String getSchemaType()
          Retrieve the schema type
 net.rim.device.api.ui.UiApplication getUiApplication()
          Gets the UiApplication instance that the TextInput object holds
 java.lang.Object getValue()
          (non-Javadoc)
 long getVerticalAlignment()
          (non-Javadoc)
 boolean isFocused()
          Returns if the text input holds focus behind the scene.
 boolean isShowBorder()
           
protected  void layout(int width, int height)
          (non-Javadoc)
protected  void makeContextMenu(net.rim.device.api.ui.ContextMenu menu)
          (non-Javadoc)
protected  int moveFocus(int amount, int status, int time)
          If the input is invalid, we want to bring up a dialog for the user indicating that and then prevent the focus from changing away from this field.
protected  boolean navigationClick(int status, int time)
          (non-Javadoc)
protected  boolean navigationMovement(int dx, int dy, int status, int time)
          (non-Javadoc)
protected  boolean navigationUnclick(int status, int time)
          (non-Javadoc)
protected  void onDisplay()
           
protected  void onFocus(int direction)
          (non-Javadoc)
protected  void onUnfocus()
          (non-Javadoc)
protected  void paint(net.rim.device.api.ui.Graphics g)
          (non-Javadoc)
 void paintBackground(net.rim.device.api.ui.Graphics g)
          Paint this text input's background
 void refresh()
          (non-Javadoc)
 void setBackgroundColor(int bgcolor)
          (non-Javadoc)
 void setBorderColor(int borderColor)
          Set the border color
 void setColSpan(int colspan)
          (non-Javadoc)
 void setControlID(int controlID)
          Sets the control's ID
 void setController(TextInputController textInputCtrller)
          Set text input controller
 void setCustomEventsDelegate(ICustomEventsDelegate delegate, int eventsFlags)
          Sets the control's custom events delegate for the given events
 void setEmptyMeanNull(boolean emptyMeanNull)
          Set if any empty values in the text fields should return a null value for empty.
 void setFocusFontStyle(FontStyle focusFontStyle)
          Sets the focus font style
 void setFontStyle(FontStyle fontStyle)
          Set the font style for this control
 void setFooterField(FooterField field)
          Set the footer field
 void setInvalidValueMessage(int invalidValueMessageRID)
          Set invalid value message by localization resource id
 void setInvalidValueMessage(java.lang.String invalidValueMessage)
          Set invalid value message
 void setLayoutHeight(int height)
          (non-Javadoc)
 void setLayoutWidth(int width)
          (non-Javadoc)
 void setLogicalType(LogicalType logicalType)
          Set logical type
 void setName(java.lang.String name)
          Set a key name for this control
 void setNeedValidate(boolean needValidate)
          Specify need validate or not
 void setPIMValue(java.lang.Object value)
          Sets the PIM value
 void setProperty(int key, java.lang.String value)
          Set the property values for this text input
 void setRawBinaryData(byte[] data)
          Set the byte array data
 void setRowSpan(int rowspan)
          (non-Javadoc)
 void setSchemaType(java.lang.String schemaType)
          Set the schema type
 void setShowBackgroundColor(boolean isShowBackgroundColor)
          Sets if background color is drawing
 void setShowBorder(boolean bol)
          Set if to show the border
 void setValidators(java.util.Vector validators)
           
 void setVariableInput(ControlVariable variable)
          Set the variable for the input value
 boolean testDatatype()
           
protected  boolean touchEvent(net.rim.device.api.ui.TouchEvent message)
          (non-Javadoc)
 boolean validate()
          Validates the text input value
 
Methods inherited from class net.rim.device.api.ui.component.EditField
isEnteringRollerCharacter, keyDown, keyRepeat
 
Methods inherited from class net.rim.device.api.ui.component.BasicEditField
backspace, backspace, backspace, charAt, clear, displayFieldFullMessage, getCursorPosition, getFilter, getLabel, getLabelLength, getMaxSize, getText, getText, getText, getTextAbstractString, getTextLength, insert, insert, isSymbolScreenAllowed, keyChar, keyControl, moveFocus, paste, selectionDelete, setCursorPosition, setCursorPosition, setFilter, setFont, setLabel, setMaxSize, setText, setText, update, wipe
 
Methods inherited from class net.rim.device.api.ui.component.TextField
drawText, fieldChangeNotify, getAccessibleContext, getComposedTextEnd, getComposedTextStart, getDisplayLineCount, getFocusRect, getText, insert, insert, insert, insert, insert, isPasteable, isSelectable, isSelecting, isSelectionCopyable, isSelectionDeleteable, onUndisplay, select, selectionCopy, setPreLayoutInternal, setSelection, toString
 
Methods inherited from class net.rim.device.api.ui.Field
drawHighlightRegion, focusAdd, focusChangeNotify, focusRemove, getBackground, getBackground, getBorder, getBorder, getBorder, getChangeListener, getContentHeight, getContentLeft, getContentRect, getContentRect, getContentTop, getContentWidth, getContextMenu, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFont, getHeight, getIndex, getLeafFieldWithFocus, getLeft, getManager, getMargin, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getOriginal, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getScreen, getState, getStyle, getTop, getVisualState, getWidth, invalidate, invalidate, invalidateAll, invokeAction, isDataValid, isDirty, isEditable, isFocus, isFocusable, isMuddy, isSelectionCutable, isSpellCheckable, isStyle, isVisible, keyStatus, keyUp, makeContextMenu, onExposed, onMenuDismissed, onMenuDismissed, onObscured, onVisibilityChange, selectionCut, setBackground, setBackground, setBorder, setBorder, setBorder, setBorder, setBorder, setChangeListener, setCookie, setDirty, setEditable, setExtent, setFocus, setFocusListener, setFont, setMargin, setMargin, setMuddy, setNonSpellCheckable, setPadding, setPadding, setPosition, setVisualState, trackwheelClick, trackwheelUnclick, updateLayout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sybase.uep.bobclient.controls.ITextInput
getText, setText
 
Methods inherited from interface net.rim.device.internal.ui.Formatter.TextRenderer
getFont
 

Constructor Detail

TextInput

public TextInput(java.lang.String defaultValue,
                 int maxNumChars,
                 long style)
Constructor to create the text input

Parameters:
defaultValue - String value for the default value
maxNumChars - int value for the max number of characters allow for user to enter
style - int value style of the input
Method Detail

getController

public TextInputController getController()
Description copied from interface: ITextInput
Get the text input controller

Specified by:
getController in interface ITextInput
Returns:

setController

public void setController(TextInputController textInputCtrller)
Description copied from interface: ITextInput
Set text input controller

Specified by:
setController in interface ITextInput

setBackgroundColor

public void setBackgroundColor(int bgcolor)
(non-Javadoc)

Specified by:
setBackgroundColor in interface Control
Parameters:
bgcolor - int value of the color in HEX. For example: 0x00000000, 0x00FF0000, 0x00FFFFFF
See Also:
Control.setBackgroundColor(int bgcolor)

setColSpan

public void setColSpan(int colspan)
(non-Javadoc)

Specified by:
setColSpan in interface Control
Parameters:
colspan - int value of the column span
See Also:
Control.setColSpan(int colspan)

getColSpan

public int getColSpan()
(non-Javadoc)

Specified by:
getColSpan in interface Control
Returns:
int value of the column span
See Also:
Control.getColSpan()

setRowSpan

public void setRowSpan(int rowspan)
(non-Javadoc)

Specified by:
setRowSpan in interface Control
Parameters:
rowspan - int value of the row span
See Also:
Control.setRowSpan(int rowspan)

getRowSpan

public int getRowSpan()
(non-Javadoc)

Specified by:
getRowSpan in interface Control
Returns:
int value of the row span
See Also:
Control.getRowSpan()

getHorizontalAlignment

public long getHorizontalAlignment()
(non-Javadoc)

Specified by:
getHorizontalAlignment in interface Control
Returns:
long value of the horizontal alignment. Possible values could be Field.FIELD_HCENTER, Field.FIELD_RIGHT, or Field.FIELD_LEFT
See Also:
Control.getHorizontalAlignment()

getVerticalAlignment

public long getVerticalAlignment()
(non-Javadoc)

Specified by:
getVerticalAlignment in interface Control
Returns:
long value of the vertical alignment Possible values could be Field.FIELD_TOP, Field.FIELD_BOTTOM, or Field.FIELD_VCENTER
See Also:
Control.getVerticalAlignment()

setBorderColor

public void setBorderColor(int borderColor)
Set the border color

Parameters:
color - int HEX value for the border color. Examples of colors are 0x00FFFFFF, 0x00FF0000, 0x00000000

getBorderColor

public int getBorderColor()

setShowBorder

public void setShowBorder(boolean bol)
Set if to show the border

Parameters:
bol - true to show border around text input, otherwise false

isShowBorder

public boolean isShowBorder()

setEmptyMeanNull

public void setEmptyMeanNull(boolean emptyMeanNull)
Set if any empty values in the text fields should return a null value for empty.

Parameters:
emptyMeanNull - true means empty text input means null, otherwise false

setValidators

public void setValidators(java.util.Vector validators)

setVariableInput

public void setVariableInput(ControlVariable variable)
Set the variable for the input value

Parameters:
variable - ControlVariable ControlVariable object
See Also:
ControlVariable

setRawBinaryData

public void setRawBinaryData(byte[] data)
Description copied from interface: ITextInput
Set the byte array data

Specified by:
setRawBinaryData in interface ITextInput
Parameters:
data -

getRawBinaryData

public byte[] getRawBinaryData()
Description copied from interface: ITextInput
Get byte array data

Specified by:
getRawBinaryData in interface ITextInput
Returns:

getFontStyle

public FontStyle getFontStyle()
Get this control's font style

Returns:
FontStyle font style object
See Also:
FontStyle

setFontStyle

public void setFontStyle(FontStyle fontStyle)
Set the font style for this control

Parameters:
fontStyle - FontStyle font style object
See Also:
FontStyle

setFocusFontStyle

public void setFocusFontStyle(FontStyle focusFontStyle)
Sets the focus font style

Parameters:
focusFontStyle - FontStyle font style object
See Also:
FontStyle

getName

public java.lang.String getName()
(non-Javadoc)

Specified by:
getName in interface Control
Returns:
String value of the key name
See Also:
Control.getName()

setLayoutWidth

public void setLayoutWidth(int width)
(non-Javadoc)

Specified by:
setLayoutWidth in interface Control
Parameters:
width - int value of the available layout width
See Also:
Control.setLayoutWidth(int width)

getPreferredWidth

public int getPreferredWidth()
(non-Javadoc)

Specified by:
getPreferredWidth in interface Control
Overrides:
getPreferredWidth in class net.rim.device.api.ui.component.BasicEditField
Returns:
int value of the available layout width
See Also:
Control.getPreferredWidth()

setLayoutHeight

public void setLayoutHeight(int height)
(non-Javadoc)

Specified by:
setLayoutHeight in interface Control
Parameters:
height - int value of the available layout height
See Also:
Control.setLayoutHeight(int height)

getPreferredHeight

public int getPreferredHeight()
(non-Javadoc)

Specified by:
getPreferredHeight in interface Control
Overrides:
getPreferredHeight in class net.rim.device.api.ui.component.BasicEditField
Returns:
int value of the available layout height
See Also:
Control.getPreferredHeight()

getValue

public java.lang.Object getValue()
(non-Javadoc)

Specified by:
getValue in interface Control
Returns:
Object of the value set for this control
See Also:
Control.getValue()

onFocus

protected void onFocus(int direction)
(non-Javadoc)

Overrides:
onFocus in class net.rim.device.api.ui.component.TextField
See Also:
Field.onFocus(int direction)

moveFocus

protected int moveFocus(int amount,
                        int status,
                        int time)
If the input is invalid, we want to bring up a dialog for the user indicating that and then prevent the focus from changing away from this field.

Overrides:
moveFocus in class net.rim.device.api.ui.component.EditField

onUnfocus

protected void onUnfocus()
(non-Javadoc)

Overrides:
onUnfocus in class net.rim.device.api.ui.component.BasicEditField
See Also:
Field.onUnfocus()

navigationClick

protected boolean navigationClick(int status,
                                  int time)
(non-Javadoc)

Overrides:
navigationClick in class net.rim.device.api.ui.component.TextField
See Also:
Field.navigationClick(int status, int time)

navigationUnclick

protected boolean navigationUnclick(int status,
                                    int time)
(non-Javadoc)

Overrides:
navigationUnclick in class net.rim.device.api.ui.component.TextField
See Also:
Field.navigationUnclick(int status, int time)

navigationMovement

protected boolean navigationMovement(int dx,
                                     int dy,
                                     int status,
                                     int time)
(non-Javadoc)

Overrides:
navigationMovement in class net.rim.device.api.ui.Field
See Also:
Field.navigationMovement(int dx, int dy, int status, int time)

fieldChanged

public void fieldChanged(net.rim.device.api.ui.Field field,
                         int context)
(non-Javadoc)

Specified by:
fieldChanged in interface net.rim.device.api.ui.FieldChangeListener
See Also:
FieldChangeListener.fieldChanged(Field field, int context)

touchEvent

protected boolean touchEvent(net.rim.device.api.ui.TouchEvent message)
(non-Javadoc)

Overrides:
touchEvent in class net.rim.device.api.ui.Field
See Also:
Field.touchEvent(TouchEvent message)

validate

public boolean validate()
Validates the text input value

Specified by:
validate in interface ITextInput
Returns:
true if the validation passes, otherwise false

setNeedValidate

public void setNeedValidate(boolean needValidate)
Specify need validate or not

Specified by:
setNeedValidate in interface ITextInput

testDatatype

public boolean testDatatype()

layout

protected void layout(int width,
                      int height)
(non-Javadoc)

Overrides:
layout in class net.rim.device.api.ui.component.BasicEditField
See Also:
Field.layout(int width, int height)

drawFocus

protected void drawFocus(net.rim.device.api.ui.Graphics g,
                         boolean on)
(non-Javadoc)

Overrides:
drawFocus in class net.rim.device.api.ui.component.BasicEditField
See Also:
Field.drawFocus(Graphics g, boolean on)

paintBackground

public void paintBackground(net.rim.device.api.ui.Graphics g)
Paint this text input's background

Overrides:
paintBackground in class net.rim.device.api.ui.Field
Parameters:
g - Graphics object used for painting.
See Also:
Graphics

paint

protected void paint(net.rim.device.api.ui.Graphics g)
(non-Javadoc)

Overrides:
paint in class net.rim.device.api.ui.component.BasicEditField
See Also:
Field.paint(Graphics g)

onDisplay

protected void onDisplay()
Overrides:
onDisplay in class net.rim.device.api.ui.Field

makeContextMenu

protected void makeContextMenu(net.rim.device.api.ui.ContextMenu menu)
(non-Javadoc)

Overrides:
makeContextMenu in class net.rim.device.api.ui.component.BasicEditField
See Also:
Field.makeContextMenu(ContextMenu menu)

createImageScreen

protected ImageScreen createImageScreen(byte[] imageData)
Create an image screen

Parameters:
imageData - byte array of the image data
Returns:
ImageScreen screen object
See Also:
ImageScreen

refresh

public void refresh()
(non-Javadoc)

Specified by:
refresh in interface Control
See Also:
Control.refresh()

setProperty

public void setProperty(int key,
                        java.lang.String value)
Set the property values for this text input

Parameters:
key - int int value for the key of a specific attribute
value - String value for this attribute

setFooterField

public void setFooterField(FooterField field)
Set the footer field

Parameters:
{@link - FooterField} footer field to put the text of the textinput into. This is useful for long text, so it can be displayed in the footer. null value if there is no footer.
See Also:
FooterField

setInvalidValueMessage

public void setInvalidValueMessage(java.lang.String invalidValueMessage)
Set invalid value message

Parameters:
invalidValueMessage - String value for the error message that is displayed then the value doesn't match the datatype/logical type.

setInvalidValueMessage

public void setInvalidValueMessage(int invalidValueMessageRID)
Set invalid value message by localization resource id

Parameters:
invalidValueMessageRID - int value for the localization resource id of invalid value message

setName

public void setName(java.lang.String name)
Set a key name for this control

Parameters:
name - String value for the key name for this control

setLogicalType

public void setLogicalType(LogicalType logicalType)
Set logical type

Specified by:
setLogicalType in interface ITextInput
Parameters:
logicalType - LogicalType logical type object
See Also:
LogicalType

setSchemaType

public void setSchemaType(java.lang.String schemaType)
Set the schema type

Specified by:
setSchemaType in interface ITextInput
Parameters:
schemaType - String value for the schema type

getLogicalType

public LogicalType getLogicalType()
Retrieve the logical type assign to this control

Specified by:
getLogicalType in interface PIMControl
Returns:
LogicalType logical type object
See Also:
LogicalType

getPIMValue

public java.lang.Object getPIMValue()
Retrieve the PIM value

Specified by:
getPIMValue in interface PIMControl
Returns:
Object value for the PIM

getSchemaType

public java.lang.String getSchemaType()
Retrieve the schema type

Specified by:
getSchemaType in interface PIMControl
Returns:
String value for the schema type

setPIMValue

public void setPIMValue(java.lang.Object value)
Sets the PIM value

Specified by:
setPIMValue in interface PIMControl
Parameters:
value - Object PIM value

isFocused

public boolean isFocused()
Returns if the text input holds focus behind the scene. e.g. If the menu is activated from the text input, although the menu items hold the focus, the text input will regain the focus when the menu is dissmissed, the method returns true in this situation.

Returns:
true if the text input holds focus behind the scene, otherwise false

getUiApplication

public net.rim.device.api.ui.UiApplication getUiApplication()
Gets the UiApplication instance that the TextInput object holds

Returns:
UiApplication

getCustomEventsDelegate

public ICustomEventsDelegate getCustomEventsDelegate()
Returns the control's custom events delegate

Returns:
the control's custom events delegate

setCustomEventsDelegate

public void setCustomEventsDelegate(ICustomEventsDelegate delegate,
                                    int eventsFlags)
Sets the control's custom events delegate for the given events

Parameters:
delegate - custom events delegate
eventsFlags - the events to set delegate to

getControlID

public int getControlID()
Returns the control's ID

Returns:
the control's Id

setControlID

public void setControlID(int controlID)
Sets the control's ID

Parameters:
controlId - control ID

setShowBackgroundColor

public void setShowBackgroundColor(boolean isShowBackgroundColor)
Sets if background color is drawing

Parameters:
isShowBackgroundColor -