|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Completion
A class implement the Completion
interface to provide
completion services to T9
class instances.
A completion is a two-part word: a prefix read from user inputs, and a
completion suffix provided by the completion service itself. Any user
input fires
events to a T9
object which invoke methods to the completion
service. In a T9
object, a completion can be viewed as a word
(the prefix) and a possible completion word (the suffix). A basic navigation
service in provided through completionPrecedente()
and
completionSuivante()
methods. When the user effectively choose
to complete the word, the T9
object fires
the complete()
method.
A minimal completion service could be:
class BasicCompletion implements Completion { private StringBuffer prefix = new StringBuffer(); public void termine() { } public void complete() { } public void setMotCourant(String mot) { if (mot==null) throw new NullPointerException(); prefix = new StringBuffer(mot); } public String getMotCourant() { return prefix.toString(); } public String getCompletionCourante() { return ""; } public void completionPrecedente() { } public void completionSuivante() { } public void ajouteCaractere(char c) { prefixe.append(c); } public void enleveDernierCaractere() { if (prefix.length()>0) { prefix.setLength(prefix.length()-1); } } }
T9
Method Summary | |
---|---|
void |
ajouteCaractere(char caractere)
Add a character to the prefix. |
void |
complete()
Complete the prefix with the curreent suffix. |
void |
completionPrecedente()
Compute the previous possible completion of the current prefix. |
void |
completionSuivante()
Compute the next possible completion of the current prefix. |
void |
enleveDernierCaractere()
Remove the last character of the prefix. |
String |
getCompletionCourante()
Get the value of the suffix. |
String |
getMotCourant()
Get the value of the prefix. |
void |
setMotCourant(String motCourant)
Set the value of the completion prefix. |
void |
termine()
This method is called before the T9 object terminates. |
Method Detail |
---|
void termine()
T9
object terminates. This
slot is primarily provided to clean internal data structures.
The
general contract is that it is invoked when T9
object has
decided to terminate with your current completion
object.
Important note: this method is not devised to terminate the JVM, you are not supposed to call any termination function.
void setMotCourant(String motCourant)
T9
object needs to reset the current completion.
A completion protocol conform method must update the completion
suffix according
to the new value.
motCourant
- the new value to use as the prefix.
NullPointerException
- if a null
value
is usedString getMotCourant()
String getCompletionCourante()
void complete()
void ajouteCaractere(char caractere)
caractere
- the input character.void enleveDernierCaractere()
String
returned
by getMotCourant()
is 0.
void completionPrecedente()
T9
want to navigate back through
the list of possible completion words. The preceding word must be
provided through getCompletionCourante()
method.
void completionSuivante()
T9
want to navigate forward through
the list of possible completion words. The next word must be
available through getCompletionCourante()
method.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |