jMobileCore toolkit

com.jmobilecore.ui
Class TextBlockComposer

java.lang.Object
  extended by com.jmobilecore.ui.core.TextFieldComposer
      extended by com.jmobilecore.ui.TextBlockComposer
All Implemented Interfaces:
AbstractComposer
Direct Known Subclasses:
DigitalBlockComposer

public class TextBlockComposer
extends TextFieldComposer

The TextBlockComposer defines set of methods that supports a custom text field handling and editing

Author:
Greg Gridin

Field Summary
 char fillChar
          Characted for filling out "empty" symbols
static byte FIXED_SIZE
          Fixed size style - Block size id predefined, user is scrolling though each symbol of the block
static byte STATIC_FOCUSABLE
          Static but focusable style - modification is possible for whole block only
protected  byte STYLE
          The current TextBlockComposer formatting style.
static byte VARIABLE_SIZE
          Variable size style - Max length of the block is defined only, user is scrolling though entered symbols only
 
Fields inherited from class com.jmobilecore.ui.core.TextFieldComposer
caretPosition, curLen, text
 
Constructor Summary
TextBlockComposer(byte style, int length)
          Constructs new instance of TextBlockComposer with specified style and length
TextBlockComposer(byte style, int length, char fillChar)
          Constructs new instance of TextBlockComposer with specified style, length and filling characted
TextBlockComposer(byte style, java.lang.String staticContent)
          Constructs new instance of TextBlockComposer with static style.
TextBlockComposer(java.lang.String staticContent)
          Constructs new instance of TextBlockComposer with static style.
 
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()
          Clear out the field
 boolean deleteChar()
          Deletes the current symbol for variable size field Replace the burrent symbol for fixed size field Do nothing for static field
 int getCaretPosition()
          Returns the caret position
 boolean isComplete()
          Tests if editing of the field is complete
 boolean setCaretPosition(int caretPosition)
          Sets the caret position
 void setText(java.lang.String newText)
          Sets the text that is presented by this text component to be the specified text.
 
Methods inherited from class com.jmobilecore.ui.core.TextFieldComposer
destructor, getChars, getCurrentLength, getCursorOffset, getMaxSize, getText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fillChar

public char fillChar
Characted for filling out "empty" symbols


FIXED_SIZE

public static final byte FIXED_SIZE
Fixed size style - Block size id predefined, user is scrolling though each symbol of the block

See Also:
Constant Field Values

STATIC_FOCUSABLE

public static final byte STATIC_FOCUSABLE
Static but focusable style - modification is possible for whole block only

See Also:
Constant Field Values

STYLE

protected final byte STYLE
The current TextBlockComposer formatting style.


VARIABLE_SIZE

public static final byte VARIABLE_SIZE
Variable size style - Max length of the block is defined only, user is scrolling though entered symbols only

See Also:
Constant Field Values
Constructor Detail

TextBlockComposer

public TextBlockComposer(byte style,
                         int length)
Constructs new instance of TextBlockComposer with specified style and length

Parameters:
style - TextBlockComposer style, cannot be STATIC
length - the length for fixed size style, the max length for variable size style
Throws:
java.lang.RuntimeException - if style is STATIC or STATIC_FOCUSABLE

TextBlockComposer

public TextBlockComposer(byte style,
                         int length,
                         char fillChar)
Constructs new instance of TextBlockComposer with specified style, length and filling characted

Parameters:
style - TextBlockComposer style, cannot be STATIC
length - the length for fixed size style, the max length for variable size style
fillChar - the characted for filling out "empty" symbols
Throws:
java.lang.RuntimeException - if style is STATIC or STATIC_FOCUSABLE

TextBlockComposer

public TextBlockComposer(byte style,
                         java.lang.String staticContent)
Constructs new instance of TextBlockComposer with static style.

Parameters:
style - TextBlockComposer style, can be STATIC or STATIC_FOCUSABLE only
staticContent - the static (non-editable) content

TextBlockComposer

public TextBlockComposer(java.lang.String staticContent)
Constructs new instance of TextBlockComposer with static style.

Parameters:
staticContent - the static (non-editable) content
Method Detail

addChar

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

Specified by:
addChar in interface AbstractComposer
Overrides:
addChar in class TextFieldComposer
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
Overrides:
backspace in class TextFieldComposer
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
Overrides:
caretLeft in class TextFieldComposer
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
Overrides:
caretRight in class TextFieldComposer
Returns:
true if the moving is possible/done, false otherwise

clear

public void clear()
Clear out the field


deleteChar

public boolean deleteChar()
Deletes the current symbol for variable size field Replace the burrent symbol for fixed size field Do nothing for static field

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

getCaretPosition

public int getCaretPosition()
Description copied from class: TextFieldComposer
Returns the caret position

Specified by:
getCaretPosition in interface AbstractComposer
Overrides:
getCaretPosition in class TextFieldComposer

isComplete

public boolean isComplete()
Tests if editing of the field is complete

Returns:
true if field is valid (complete and has correct value), false otherwise

setCaretPosition

public boolean setCaretPosition(int caretPosition)
Description copied from class: TextFieldComposer
Sets the caret position

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

setText

public void setText(java.lang.String newText)
Description copied from class: TextFieldComposer
Sets the text that is presented by this text component to be the specified text.

Specified by:
setText in interface AbstractComposer
Overrides:
setText in class TextFieldComposer
Parameters:
newText - the new text.

jMobileCore toolkit