jMobileCore toolkit

com.jmobilecore.ui
Class CustomFieldComposer

java.lang.Object
  extended by com.jmobilecore.ui.CustomFieldComposer
All Implemented Interfaces:
AbstractComposer

public abstract class CustomFieldComposer
extends java.lang.Object
implements AbstractComposer


Field Summary
protected  int curBlock
           
protected  TextBlockComposer[] textBlocks
           
 
Constructor Summary
CustomFieldComposer(TextBlockComposer[] textBlocks)
           
 
Method Summary
 boolean addChar(char ch, boolean insertMode)
          Adds new symbol or replaces the current one
 boolean backspace()
          Deletes previous symbol, moves cursor one position left
 boolean caretLeft()
          Moves the caret one position left
 boolean caretRight()
          Moves the caret one position right
 void clear()
           
 boolean deleteChar()
          Deletes current symbol
 void destructor()
          Default destructor.
 int getCaretPosition()
          Returns the caret position
 char[] getChars()
          Returns the text that is presented by this text component.
 int getCurrentBlock()
           
 int getCurrentLength()
          Returns the current text length
 int getCursorOffset(javax.microedition.lcdui.Font font, char echoChar)
          Returns the cursor offset (in pixels) for the composed string
 int getMaxSize()
          Get maximum lenght of the text which can be entered in TextFieldComposer
 java.lang.String getText()
          Returns the text that is presented by this text component.
 boolean isComplete()
           
 boolean setCaretPosition(int caretPosition)
          Sets the caret position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jmobilecore.ui.core.AbstractComposer
setText
 

Field Detail

curBlock

protected int curBlock

textBlocks

protected TextBlockComposer[] textBlocks
Constructor Detail

CustomFieldComposer

public CustomFieldComposer(TextBlockComposer[] textBlocks)
Method Detail

addChar

public boolean addChar(char ch,
                       boolean insertMode)
Adds new symbol or replaces the current one

Specified by:
addChar in interface AbstractComposer
Parameters:
ch - new symbol
insertMode - if true then new symbol will be added, otherwise the current symbol will be replaced
Returns:
true if the add/replace is possible, false otherwise

backspace

public boolean backspace()
Deletes previous symbol, moves cursor one position left

Specified by:
backspace in interface AbstractComposer
Returns:
true if the delete and moving is possible/done, false otherwise

caretLeft

public boolean caretLeft()
Moves the caret one position left

Specified by:
caretLeft in interface AbstractComposer
Returns:
true if the moving is possible/done, false otherwise

caretRight

public boolean caretRight()
Moves the caret one position right

Specified by:
caretRight in interface AbstractComposer
Returns:
true if the moving is possible/done, false otherwise

clear

public void clear()

deleteChar

public boolean deleteChar()
Deletes current symbol

Specified by:
deleteChar in interface AbstractComposer
Returns:
true if the delete possible/done, false otherwise

destructor

public void destructor()
Default destructor. Helps VM to perform garbage collection

Specified by:
destructor in interface AbstractComposer

getCaretPosition

public int getCaretPosition()
Description copied from interface: AbstractComposer
Returns the caret position

Specified by:
getCaretPosition in interface AbstractComposer

getChars

public char[] getChars()
Returns the text that is presented by this text component.

Specified by:
getChars in interface AbstractComposer

getCurrentBlock

public int getCurrentBlock()

getCurrentLength

public int getCurrentLength()
Description copied from interface: AbstractComposer
Returns the current text length

Specified by:
getCurrentLength in interface AbstractComposer

getCursorOffset

public int getCursorOffset(javax.microedition.lcdui.Font font,
                           char echoChar)
Returns the cursor offset (in pixels) for the composed string

Parameters:
font - the current font.
echoChar - the echo character, not used if equal to 0

getMaxSize

public int getMaxSize()
Get maximum lenght of the text which can be entered in TextFieldComposer

Returns:
maxSize max length of the text

getText

public java.lang.String getText()
Returns the text that is presented by this text component.

Specified by:
getText in interface AbstractComposer

isComplete

public boolean isComplete()

setCaretPosition

public boolean setCaretPosition(int caretPosition)
Description copied from interface: AbstractComposer
Sets the caret position

Specified by:
setCaretPosition in interface AbstractComposer
Parameters:
caretPosition - new caret position
Returns:
true if operation is successful, false otherwise

jMobileCore toolkit