|
jMobileCore toolkit | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jmobilecore.ui.core.Component com.jmobilecore.ui.core.TextComponent com.jmobilecore.ui.core.TextField com.jmobilecore.ui.CurrencyField
public class CurrencyField
This class displays two fields, one for currency major and one for currency minor
(like dollars and cents) separated by a decimal point.
If alignment is Component.LEFT
or Component.CENTER
the currency major field is preceded by a currency symbol.
If alignment is Component.RIGHT
then the currency symbol follows
the currency minor field
Field Summary | |
---|---|
protected int |
decimals
The number of decimal digits in CurrencyField |
java.lang.String |
symbol
The currency symbol Examples: "$", "USD", "RUR" etc. |
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 | |
---|---|
CurrencyField()
Constructs a new CurrencyField field. |
|
CurrencyField(int major,
int minor)
Constructs a new CurrencyField object with the specified value. |
Method Summary | |
---|---|
void |
destructor()
Default destructor. |
java.lang.String |
getFormattedText()
Get formatted representation of CurrencyField value
or null if CurrencyField object value is set to null or incomplete |
protected char[] |
getFormattedText(boolean calcCursorOffset)
|
long |
getMajor()
Get the major part of CurrencyField value
or -1 if CurrencyField object value is set to null or incomplete |
int |
getMinor()
Get the minor part of CurrencyField value
or -1 if CurrencyField object value is set to null or incomplete |
protected CustomFieldComposer |
initComposer()
Initialize currency field composer |
boolean |
isValid()
Tests currency field value for correctness |
void |
setCurrency(long major,
long minor)
Sets CurrencyField object to the specified value. |
Methods inherited from class com.jmobilecore.ui.core.TextField |
---|
adjust, 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 |
---|
protected int decimals
CurrencyField
public java.lang.String symbol
Constructor Detail |
---|
public CurrencyField()
CurrencyField
field.
public CurrencyField(int major, int minor)
CurrencyField
object with the specified value.
major
- the major part of CurrencyField
valueminor
- the minor part of CurrencyField
valuesetCurrency(long, long)
Method Detail |
---|
public void destructor()
TextComponent
destructor
in class TextField
public java.lang.String getFormattedText()
CurrencyField
value
or null
if CurrencyField
object value is set to null or incomplete
String
representing bank card numberprotected char[] getFormattedText(boolean calcCursorOffset)
getFormattedText
in class TextField
public long getMajor()
CurrencyField
value
or -1
if CurrencyField
object value is set to null or incomplete
int
value representing the specified currency majorpublic int getMinor()
CurrencyField
value
or -1
if CurrencyField
object value is set to null or incomplete
int
value representing the specified currency minorprotected CustomFieldComposer initComposer()
CustomFieldComposer
for IPv4 fieldpublic boolean isValid()
true
if the currency field is valid
false
otherwisepublic void setCurrency(long major, long minor)
CurrencyField
object to the specified value.
The CurrencyField
major/minor values should be calcuated according to formulae:
CurrencyField.minor = minor % (10**digits);
CurrencyField.major = major + minor / (10**digits);
major
- the major part of CurrencyField
valueminor
- the minor part of CurrencyField
value
|
jMobileCore toolkit | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |