jMobileCore toolkit

com.jmobilecore.ui
Class TimeField

java.lang.Object
  extended by com.jmobilecore.ui.core.Component
      extended by com.jmobilecore.ui.core.TextComponent
          extended by com.jmobilecore.ui.core.TextField
              extended by com.jmobilecore.ui.TimeField

public class TimeField
extends TextField

This class displays formatted textfield for entering time information Format of the time is specified by user. Blocks of digits are separated by divider.

Author:
Igor Shevlyakov - initial implementation, Greg Gridin - redesign

Field Summary
protected static java.lang.String AM
           
 char divider
          The divider for date formatting
static byte HH_mm
          Time format, example: 09:00.
static byte HH_mm_ss
          Time format, example: 19:03:24.
static byte hh_mm_ssX
          Time format, example: 09:07:32PM.
static byte hh_mmX
          Time format, example: 11:07AM.
protected  int hour
           
protected  int min
           
protected  boolean pm
           
protected static java.lang.String PM
           
protected  int sec
           
protected  byte STYLE
          The current TimeField formatting style.
 
Fields inherited from class com.jmobilecore.ui.core.TextField
adjustment, calculatedCaretPosition, calculatedCursorOffset, composer, currentLength, DEFAULT_SIZE, echoChar, HOFFSET, SCROLLABLE, VOFFSET
 
Fields inherited from class com.jmobilecore.ui.core.TextComponent
ALL_SPEC_CHARS, BORDER_GAP, BORDER_WIDTH, C_ALL_SPEC_CHARS, C_ALPHA, C_ALPHA_NUMERIC, C_ANY, C_EMAIL, C_EMAIL_SPEC_CHARS, C_LOWER_CASE, C_NO_CHARS, C_NUMERIC, C_SPACE, C_UPPER_CASE, cHandler, CHAR_OPTIONS, charOptionCounter, constraint, CURSOR_DELAY, CURSOR_TYPE_LINE, CURSOR_TYPE_SYMBOL, editable, EMAIL_SPEC_CHARS, insertMode, KEY_OPTIONS, lastKeyCode, LC_CHARS, NUMERIC_CHARS, SPACE_CHARS, UC_CHARS, validChars
 
Fields inherited from class com.jmobilecore.ui.core.Component
alignment, background, CENTER, focusable, focusedBackground, focusedForeground, font, foreground, height, isCompletelyVisible, isFocused, isVisible, LEFT, parentScreen, RIGHT, screenY, valid, width
 
Constructor Summary
TimeField()
          Constructs a new TimeField field.
TimeField(byte style)
          Constructs a new TimeField field of specified format
TimeField(byte style, char divider)
          Constructs a new TimeField field of specified format
TimeField(byte style, char divider, java.util.Date time)
          Constructs a new TimeField object with the specified value.
 
Method Summary
protected  boolean getBlocks()
          Sets sec, min, hour, pm variables If the field contains invalid value, the method sets variable hour to -1
 java.lang.String getFormattedText()
          Get formatted representation of Ipv4Field value or null if IPv4Field object value is set to null or incomplete
protected  char[] getFormattedText(boolean calcCursorOffset)
           
 byte getStyle()
           
 java.util.Date getTime()
          Returns the time value that is presented by this component.
protected  CustomFieldComposer initComposer()
          Initialize time field composer
 boolean isValid()
          Tests time field value for correctness
 void setStyle(byte newStyle)
           
 void setStyle(byte newStyle, char divider)
           
 void setStyle(byte newStyle, char divider, java.util.Date newTime)
           
 void setTime(java.util.Date time)
          Sets time that is presented by this time component to be the specified value.
 
Methods inherited from class com.jmobilecore.ui.core.TextField
adjust, destructor, getComposer, getCursorOffset, getText, init, keyPressed, paint, paintCursor, setHeight, setText
 
Methods inherited from class com.jmobilecore.ui.core.TextComponent
addValidChars, getCaretPosition, getKeyOption, initCursor, isCharValid, preProcessKeyCode, processKeyCode, resetCursor, resetCursorHandler, setCaretPosition
 
Methods inherited from class com.jmobilecore.ui.core.Component
getBackground, getFont, getForeground, getHeight, getWidth, invalidate, isFocusOwner, keyReleased, keyRepeated, paintBackground, pointerDragged, pointerPressed, pointerReleased, prepareForeground, releaseFocus, requestFocus, setFont
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AM

protected static final java.lang.String AM
See Also:
Constant Field Values

divider

public char divider
The divider for date formatting


HH_mm

public static final byte HH_mm
Time format, example: 09:00.

See Also:
Constant Field Values

HH_mm_ss

public static final byte HH_mm_ss
Time format, example: 19:03:24.

See Also:
Constant Field Values

hh_mm_ssX

public static final byte hh_mm_ssX
Time format, example: 09:07:32PM.

See Also:
Constant Field Values

hh_mmX

public static final byte hh_mmX
Time format, example: 11:07AM.

See Also:
Constant Field Values

hour

protected int hour

min

protected int min

pm

protected boolean pm

PM

protected static final java.lang.String PM
See Also:
Constant Field Values

sec

protected int sec

STYLE

protected byte STYLE
The current TimeField formatting style.

Constructor Detail

TimeField

public TimeField()
Constructs a new TimeField field.


TimeField

public TimeField(byte style)
Constructs a new TimeField field of specified format

Parameters:
style - the time format

TimeField

public TimeField(byte style,
                 char divider)
Constructs a new TimeField field of specified format

Parameters:
style - the time format
divider - the divider for the time field

TimeField

public TimeField(byte style,
                 char divider,
                 java.util.Date time)
Constructs a new TimeField object with the specified value.

Parameters:
time - the date value
See Also:
setStyle(byte)
Method Detail

getBlocks

protected boolean getBlocks()
Sets sec, min, hour, pm variables If the field contains invalid value, the method sets variable hour to -1


getFormattedText

public java.lang.String getFormattedText()
Get formatted representation of Ipv4Field value or null if IPv4Field object value is set to null or incomplete

Returns:
the String representing bank card number

getFormattedText

protected char[] getFormattedText(boolean calcCursorOffset)
Overrides:
getFormattedText in class TextField

getStyle

public byte getStyle()

getTime

public java.util.Date getTime()
Returns the time value that is presented by this component. Date portion of returned Date value is set to 0 (year, month, day)


initComposer

protected CustomFieldComposer initComposer()
Initialize time field composer

Returns:
CustomFieldComposer for time field

isValid

public boolean isValid()
Tests time field value for correctness

Returns:
true if the time field is valid false otherwise

setStyle

public void setStyle(byte newStyle)

setStyle

public void setStyle(byte newStyle,
                     char divider)

setStyle

public void setStyle(byte newStyle,
                     char divider,
                     java.util.Date newTime)

setTime

public void setTime(java.util.Date time)
Sets time that is presented by this time component to be the specified value. Date portion of time argument is ignored

Parameters:
time - the date value

jMobileCore toolkit