|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.predictive.TextBuilder
public abstract class TextBuilder
| Field Summary | |
|---|---|
protected int |
align
|
static int |
ALIGN_FOCUS
Indicates that the caret should be shown to the right of current element and that results should be shown. |
static int |
ALIGN_LEFT
Indicates that the caret should be shown to the left of current element |
static int |
ALIGN_RIGHT
Indicates that the caret should be shown to the right of current element. |
protected int |
caret
|
protected int |
element
|
static int |
JUMP_NEXT
Indicates that the user pressed the UP button and wishes to jump to the previous line. |
static int |
JUMP_PREV
Indicates that the user pressed the DOWN button and wishes to jump to the next line. |
protected int |
mode
|
protected StringBuffer |
text
|
protected ArrayList |
textElements
|
| Constructor Summary | |
|---|---|
TextBuilder(int textSize)
Initializes the TextElement array, set the current element
to -1, the align for the current element to ALIGN_LEFT and
the current input mode to MODE_FIRST_UPPERCASE. |
|
| Method Summary | |
|---|---|
protected void |
addElement(TextElement textElement)
Adds an instance of TextElement to
textElements in compliance with the current align. |
abstract void |
addReader(PredictiveReader reader)
Creates a new TextElement carrying reader |
abstract void |
addString(String string)
Creates a new TextElement carrying string |
void |
addWord(String string)
|
void |
decreaseCaret()
Decreases the caret position to set in getCaretPosition()
by setting the corresponding align and element index |
boolean |
decreaseString()
|
abstract boolean |
deleteCurrent()
Deletes the current element |
int |
getAlign()
Returns the align of the current TextElement. |
int |
getCaret()
Returns the current caret position |
int |
getCaretPosition()
Retrieves the field caret position by adding the string length of the elements preceding the current element. |
int |
getElementLine(String[] textLines)
Retrieves the line the caret is positioned. |
int |
getElementLine(WrappedText textLines)
Retrieves the line the caret is positioned. |
int |
getJumpPosition(int jumpDirection,
String[] textLines)
Retrieves the caret position if a the caret should be positioned in the previous or the next line |
int |
getJumpPosition(int jumpDirection,
WrappedText textLines)
Retrieves the caret position if a the caret should be positioned in the previous or the next line |
int |
getMode()
Returns the current input mode |
PredictiveReader |
getReader()
Returns the TrieReader carried in the current
TextElement. |
String |
getString()
|
StringBuffer |
getText()
Constructs a string to display in the field by concating the string of the elements in textElements |
char |
getTextChar(int index)
Returns the character at the given index |
TextElement |
getTextElement()
Returns the current TextElement |
boolean |
hasText()
|
void |
increaseCaret()
Increases the caret position to set in getCaretPosition()
by setting the corresponding align and element index |
boolean |
isString(int offset)
Returns true, if the element at offset from the current
element index is a character or a TrieReader |
abstract boolean |
keyClear()
|
void |
keyNum(int keyCode,
PredictiveReader reader)
|
void |
keySpace()
|
void |
setAlign(int currentAlign)
Sets the align of the current TextElement |
void |
setCurrentElementNear(int position)
Set the element next to caret position offset as the
current element. |
void |
setMode(int mode)
Sets the current input mode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ALIGN_LEFT
public static final int ALIGN_FOCUS
public static final int ALIGN_RIGHT
public static final int JUMP_PREV
public static final int JUMP_NEXT
protected ArrayList textElements
protected int element
protected int align
protected int mode
protected int caret
protected StringBuffer text
| Constructor Detail |
|---|
public TextBuilder(int textSize)
TextElement array, set the current element
to -1, the align for the current element to ALIGN_LEFT and
the current input mode to MODE_FIRST_UPPERCASE.
| Method Detail |
|---|
public void keyNum(int keyCode,
PredictiveReader reader)
throws RecordStoreException
RecordStoreExceptionpublic void keySpace()
public boolean hasText()
public abstract boolean keyClear()
throws RecordStoreException
RecordStoreExceptionpublic void addWord(String string)
public PredictiveReader getReader()
TrieReader carried in the current
TextElement. It must be checked previously via
isChar() if the current element is a
TrieReader
TrieReader carried in the current
TextElementpublic String getString()
public TextElement getTextElement()
TextElement
TextElementpublic int getAlign()
TextElement.
TextElementpublic void setAlign(int currentAlign)
TextElement
currentAlign - the align of the current TextElementpublic int getCaret()
protected void addElement(TextElement textElement)
TextElement to
textElements in compliance with the current align.
If the align is ALIGN_LEFT, the element is inserted at
the current element position
If the align is ALIGN_FOCUS, the element is inserted
behind the current element position
If the align is ALIGN_RIGHT, the element is inserted
behind the current element position
textElement - the TextElement to addpublic int getElementLine(WrappedText textLines)
textLines - the text lines of the field
public int getJumpPosition(int jumpDirection,
WrappedText textLines)
jumpDirection - the direction of the caret jump
public int getElementLine(String[] textLines)
textLines - the text lines of the field
public int getJumpPosition(int jumpDirection,
String[] textLines)
jumpDirection - the direction of the caret jump
public void setCurrentElementNear(int position)
offset as the
current element. If the position is closer to the start of the element
the align for the current element is set to ALIGN_LEFT,
otherwise to ALIGN_RIGHT
position - the caret positionpublic abstract void addString(String string)
TextElement carrying string
string - the string the TextElement should carrypublic abstract void addReader(PredictiveReader reader)
TextElement carrying reader
reader - the instance of TrieReader the
TextElement should carrypublic abstract boolean deleteCurrent()
public boolean decreaseString()
public void increaseCaret()
getCaretPosition()
by setting the corresponding align and element index
If the current align is ALIGN_LEFT, the align is set to
ALIGN_FOCUS (for TrieReader elements) or
ALIGN_RIGHT (for characters)
If the current align is ALIGN_FOCUS or
ALIGN_RIGHT and the element is not the last element in
textElements, the align is set to ALIGN_LEFT
and the current element index is incremented by 1.
public void decreaseCaret()
getCaretPosition()
by setting the corresponding align and element index
If the current align is ALIGN_LEFT and the current element
is not the first element in textElements, the align is
set to ALIGN_FOCUS (for TrieReader
elements) or ALIGN_LEFT (for characters) and the current
index gets decremented by 1.
If the current align is ALIGN_FOCUS, the align is set to
ALIGN_LEFT.
If the current align is ALIGN_RIGHT or
ALIGN_RIGHT and the element is not the last element in
textElements, the align is set to
ALIGN_FOCUS (for TrieReader elements) or
ALIGN_LEFT (for characters)
public boolean isString(int offset)
offset from the current
element index is a character or a TrieReader
offset - the offset for the element
public int getCaretPosition()
ALIGN_FOCUS or ALIGN_RIGHT, the caret
position is incremented by the string length of the current element
public StringBuffer getText()
textElements
public char getTextChar(int index)
index - the index of the character to return
public int getMode()
public void setMode(int mode)
mode - the input mode to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||