|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.PredictiveAccess
public class PredictiveAccess
| Field Summary | |
|---|---|
static javax.microedition.lcdui.Command |
ADD_WORD_CMD
The command to start the dialog to add a custom word to the predictive dictionary |
static int |
ARRAY
|
static javax.microedition.lcdui.Command |
DISABLE_PREDICTIVE_CMD
The command for disabling the predictive input and returning to the standard input method |
static javax.microedition.lcdui.Command |
ENABLE_PREDICTIVE_CMD
The command for enabling the predictive input |
static java.lang.String |
INDICATOR
The indicator which is shown in the info box of a textfield indication the predictive mode is activated |
static javax.microedition.lcdui.Command |
INSTALL_PREDICTIVE_CMD
The command for starting the setup dialog of the predictive input |
static int |
ORIENTATION_BOTTOM
|
static int |
ORIENTATION_TOP
|
static TrieProvider |
PROVIDER
The provider for retrieving rms records, implemented as a static variable for use of a single provider in multiple textfields |
static int |
TRIE
|
| Constructor Summary | |
|---|---|
PredictiveAccess()
|
|
| Method Summary | |
|---|---|
void |
addWord(java.lang.String word)
|
void |
animateChoices(long currentTime,
ClippingRegion region)
|
boolean |
commandAction(javax.microedition.lcdui.Command cmd,
javax.microedition.lcdui.Displayable box)
|
boolean |
commandAction(javax.microedition.lcdui.Command cmd,
Item item)
|
void |
disablePredictiveInput()
|
void |
enablePredictiveInput()
|
TextBuilder |
getBuilder()
|
Container |
getChoicesContainer()
|
protected int |
getChoicesX(int leftBorder,
int rightBorder,
int itemWidth)
Returns the x offset for the choices list based on the currently active TextElement. |
protected int |
getChoicesY(int paddingVertical,
int borderWidth)
Retrieves the y offset for the choices list based on the currently active TextElement. |
java.lang.String |
getInfo()
|
TextField |
getParent()
|
int |
getPredictiveType()
|
ArrayList |
getResults()
|
static int |
getSpaceKey()
Returns the key code for the space key of the model running the application |
boolean |
handleKeyReleased(int keyCode,
int gameAction)
Handles the key-released event. |
void |
init(TextField parent)
Initializes the predictive input for a textfield by creating objects for the choices container and setting the input mode |
void |
initPredictiveInput(java.lang.String[] allowedWords)
Initializes the predictive input. |
boolean |
isOpen()
|
boolean |
isPredictiveEnabled()
|
protected boolean |
keyClear(int keyCode,
int gameAction)
|
protected boolean |
keyInsert(int keyCode,
int gameAction)
|
protected boolean |
keyMode(int keyCode,
int gameAction)
|
protected boolean |
keyNavigation(int keyCode,
int gameAction)
|
void |
paintChoices(int x,
int y,
int caretX,
int caretY,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints the choices |
void |
setAlert(Alert alert)
|
void |
setBuilder(TextBuilder builder)
|
void |
setChoicesContainer(Container choicesContainer)
|
void |
setInfo(java.lang.String info)
|
void |
setParent(TextField parent)
|
void |
setPredictiveType(int predictiveType)
|
void |
setupFinished(boolean finishedGraceful)
|
protected void |
showWordNotFound()
|
void |
synchronize()
Synchronizes the TextBuilder object used for the predictive input
by deleting all current entries of the builder, splitting the current text at
spaces, inserting the resulting chunks as objects of TextElement
to the builder and finally setting the caret position |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ORIENTATION_BOTTOM
public static final int ORIENTATION_TOP
public static final int TRIE
public static final int ARRAY
public static TrieProvider PROVIDER
public static javax.microedition.lcdui.Command INSTALL_PREDICTIVE_CMD
public static javax.microedition.lcdui.Command ENABLE_PREDICTIVE_CMD
public static javax.microedition.lcdui.Command DISABLE_PREDICTIVE_CMD
public static javax.microedition.lcdui.Command ADD_WORD_CMD
public static java.lang.String INDICATOR
| Constructor Detail |
|---|
public PredictiveAccess()
| Method Detail |
|---|
public void init(TextField parent)
parent - the textfield which likes to use the predictive inputpublic void initPredictiveInput(java.lang.String[] allowedWords)
words is not null,
the predictive type ARRAY is set and the dictionary
for this type is words. Otherwise, the method tries
to read from the dictionary located in the RMS by calling
PROVIDER.init(). Based on the outcome of this operation,
commands are set for the parent textfield like
INSTALL_PREDICTIVE_CMD if the dictionary is not installed.
If the dictionary is already installed, the predictive input is activated and
the commands DISABLE_PREDICTIVE_CMD and
ADD_WORD_CMD is added to the textfield.
allowedWords - the words arraypublic static int getSpaceKey()
public void disablePredictiveInput()
public void enablePredictiveInput()
public void synchronize()
TextBuilder object used for the predictive input
by deleting all current entries of the builder, splitting the current text at
spaces, inserting the resulting chunks as objects of TextElement
to the builder and finally setting the caret position
protected int getChoicesY(int paddingVertical,
int borderWidth)
TextElement.
paddingVertical - the vertical padding between the textfield linesborderWidth - the width of the border of the textfield
protected int getChoicesX(int leftBorder,
int rightBorder,
int itemWidth)
TextElement.
leftBorder - the width of the left borderrightBorder - the width of the right borderitemWidth - the width of the textfield
protected void showWordNotFound()
protected boolean keyInsert(int keyCode,
int gameAction)
protected boolean keyClear(int keyCode,
int gameAction)
protected boolean keyMode(int keyCode,
int gameAction)
protected boolean keyNavigation(int keyCode,
int gameAction)
public void paintChoices(int x,
int y,
int caretX,
int caretY,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
x - horizontal content start position of the textfieldy - vertical content start position of the textcaretX - the relative horizontal offset of the caretcaretY - the relative vertical offset of the caretleftBorder - left borderrightBorder - right borderg - graphics context
public void animateChoices(long currentTime,
ClippingRegion region)
public boolean commandAction(javax.microedition.lcdui.Command cmd,
javax.microedition.lcdui.Displayable box)
public void addWord(java.lang.String word)
public boolean commandAction(javax.microedition.lcdui.Command cmd,
Item item)
public TextBuilder getBuilder()
public void setBuilder(TextBuilder builder)
public int getPredictiveType()
public void setPredictiveType(int predictiveType)
public Container getChoicesContainer()
public void setChoicesContainer(Container choicesContainer)
public ArrayList getResults()
public boolean handleKeyReleased(int keyCode,
int gameAction)
keyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
public void setAlert(Alert alert)
public void setInfo(java.lang.String info)
public java.lang.String getInfo()
public void setupFinished(boolean finishedGraceful)
setupFinished in interface TrieSetupCallbackpublic TextField getParent()
public void setParent(TextField parent)
public boolean isOpen()
public boolean isPredictiveEnabled()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||