|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SpellCheckUIListener
A listener for events on a SpellCheckUI
. The listener can be used
for as little as determining when each field is spell checked and as much
as determining corrections to misspelled words.
Note that all method invocations will be made on the event thread of the
calling application.
Getting Text From a Field
Several methods in this interface will be specified a Field
,
offset, and length
indicating the substring of the field's text to which the method is
referring. The way that
the offset and length are used varies depending on the type of field.
The table below shows the various types of fields and the method to use to get the substring referred to by the offset and length. Fields not present in the list below will not be spell checked by this API.
Field Type | Method to Get Text |
---|---|
TextField |
getText(int, int) |
Field Summary | ||
---|---|---|
static int |
ACTION_ADD_TO_DICTIONARY
An action code to indicate that the current misspelled word should be treated as correctly spelled and added to the list of correctly spelled words. |
|
static int |
ACTION_CANCEL
An action code to indicate that the spell checking session should be cancelled. |
|
static int |
ACTION_CHANGED
An action code to indicate that the current misspelled word has been fixed. |
|
static int |
ACTION_IGNORE_ALL
An action code to indicate that the current misspelled word should be be skipped. |
|
static int |
ACTION_IGNORE_ONCE
An action code to indicate that the current misspelled word should be be skipped. |
|
static int |
ACTION_OPEN_UI
An action code to indicate that a screen should be presented to the user with a list of suggested corrections to the given misspelled word. |
|
static int |
LEARNING_ACCEPT
A code to indicate that the given word learning should be accepted |
|
static int |
LEARNING_REJECT
A code to indicate that the given word learning should be rejected |
|
static int |
REASON_HOLSTERED
The user holstered the device during spell checking, cancelling the spell checking of a field. |
|
static int |
REASON_LOCKED
The device entered Security Lock during spell checking, cancelling the spell checking of a field. |
|
static int |
REASON_UNKNOWN
Used to indicate that the reason for the cancellation of the spell checking is unknown. |
|
static int |
REASON_USER_CANCELLED
The user cancelled the spell checking. |
Method Summary | ||
---|---|---|
boolean |
generatedSpellingCandidates(SpellCheckUI ui,
Field field,
int offset,
int len,
StringBuffer suggestions)
Invoked after candidates for a misspelling have been generated. |
|
boolean |
generatingSpellingCandidates(SpellCheckUI ui,
Field field,
int offset,
int len,
StringBuffer suggestions)
Invoked when candidates for a misspelling are about to be generated. |
|
int |
misspelledWordFound(SpellCheckUI ui,
Field field,
int offset,
int len)
Invoked when a misspelled word has been found. |
|
int |
repeatedWordsFound(SpellCheckUI ui,
Field field,
int offset,
int len)
Invoked when a pair of consecutive identical words has been found. |
|
void |
spellCheckCompleted(SpellCheckUI ui,
Field field,
int status,
int reason)
Invoked when the spell checking for a Field has completed. |
|
boolean |
spellCheckStarted(SpellCheckUI ui,
Field field)
Invoked just before spell checking a Field . |
|
int |
wordCorrectionLearned(SpellCheckUI ui,
StringBuffer word,
StringBuffer correction)
Invoked when a correction to a word has been learned via the UI. |
|
int |
wordIgnored(SpellCheckUI ui,
StringBuffer word,
boolean ignoreAll)
Invoked when a word has been ignored via the UI. |
|
int |
wordLearned(SpellCheckUI ui,
StringBuffer word)
Invoked when a word has been learned via the UI. |
Field Detail |
---|
static final int REASON_UNKNOWN
SpellCheckUIListener.spellCheckCompleted(net.rim.blackberry.api.spellcheck.SpellCheckUI, net.rim.device.api.ui.Field, int, int)
,
Constant Field Valuesstatic final int REASON_USER_CANCELLED
SpellCheckUIListener.spellCheckCompleted(net.rim.blackberry.api.spellcheck.SpellCheckUI, net.rim.device.api.ui.Field, int, int)
,
Constant Field Valuesstatic final int REASON_HOLSTERED
SpellCheckUIListener.spellCheckCompleted(net.rim.blackberry.api.spellcheck.SpellCheckUI, net.rim.device.api.ui.Field, int, int)
,
Constant Field Valuesstatic final int REASON_LOCKED
SpellCheckUIListener.spellCheckCompleted(net.rim.blackberry.api.spellcheck.SpellCheckUI, net.rim.device.api.ui.Field, int, int)
,
Constant Field Valuesstatic final int ACTION_OPEN_UI
SpellCheckUIListener.misspelledWordFound(net.rim.blackberry.api.spellcheck.SpellCheckUI, net.rim.device.api.ui.Field, int, int)
,
Constant Field Valuesstatic final int ACTION_ADD_TO_DICTIONARY
SpellCheckUIListener.misspelledWordFound(net.rim.blackberry.api.spellcheck.SpellCheckUI, net.rim.device.api.ui.Field, int, int)
,
Constant Field Valuesstatic final int ACTION_IGNORE_ONCE
SpellCheckUIListener.misspelledWordFound(net.rim.blackberry.api.spellcheck.SpellCheckUI, net.rim.device.api.ui.Field, int, int)
,
Constant Field Valuesstatic final int ACTION_IGNORE_ALL
SpellCheckUIListener.misspelledWordFound(net.rim.blackberry.api.spellcheck.SpellCheckUI, net.rim.device.api.ui.Field, int, int)
,
Constant Field Valuesstatic final int ACTION_CHANGED
SpellCheckUIListener.misspelledWordFound(net.rim.blackberry.api.spellcheck.SpellCheckUI, net.rim.device.api.ui.Field, int, int)
,
Constant Field Valuesstatic final int ACTION_CANCEL
SpellCheckUIListener.misspelledWordFound(net.rim.blackberry.api.spellcheck.SpellCheckUI, net.rim.device.api.ui.Field, int, int)
,
Constant Field Valuesstatic final int LEARNING_ACCEPT
SpellCheckUIListener.wordLearned(net.rim.blackberry.api.spellcheck.SpellCheckUI, java.lang.StringBuffer)
,
SpellCheckUIListener.wordCorrectionLearned(net.rim.blackberry.api.spellcheck.SpellCheckUI, java.lang.StringBuffer, java.lang.StringBuffer)
,
Constant Field Valuesstatic final int LEARNING_REJECT
SpellCheckUIListener.wordLearned(net.rim.blackberry.api.spellcheck.SpellCheckUI, java.lang.StringBuffer)
,
SpellCheckUIListener.wordCorrectionLearned(net.rim.blackberry.api.spellcheck.SpellCheckUI, java.lang.StringBuffer, java.lang.StringBuffer)
,
Constant Field ValuesMethod Detail |
---|
boolean spellCheckStarted(SpellCheckUI ui, Field field)
Field
.
This can be used to skip spell checking of a particular field by
returning false
.
ui
- the SpellCheckUI
that caused this method
invocation.field
- the field about to be spell checked.
true
to proceed with spell checking of the
field; otherwise
false
to skip spell checking of the field.void spellCheckCompleted(SpellCheckUI ui, Field field, int status, int reason)
Field
has completed.
The status
parameter will contain information about how the
completion occurred.
A value of SpellCheckUI.SPELL_CHECK_COMPLETE
indicates that spell
checking of the
field completed normally. A value of
SpellCheckUI.SPELL_CHECK_CANCELLED
indicates
that spell checking did not complete normally; the reason for the
abnormal termination will
be specified in the reason
parameter.
The reason
parameter contains additional information about
an abnormal spellcheck
termination. Therefore, if status==SPELL_CHECK_COMPLETE
then the value of this parameter
is undefined. However, if status==SPELL_CHECK_CANCELLED
then the value of this
parameter will be one of the REASON_
constants defined in
this interface that
identifies the reason that the spell checking of the specified field
terminated abnormally.
ui
- the SpellCheckUI
that caused this method
invocation.field
- the field that was spell checked.status
- the result of the spell checking of the field.reason
- the reason for abnormal completion when spell checking the
field.SpellCheckUIListener.REASON_UNKNOWN
,
SpellCheckUIListener.REASON_USER_CANCELLED
,
SpellCheckUIListener.REASON_HOLSTERED
,
SpellCheckUIListener.REASON_LOCKED
int misspelledWordFound(SpellCheckUI ui, Field field, int offset, int len)
The returned action can be one of
SpellCheckUIListener.ACTION_OPEN_UI
SpellCheckUIListener.ACTION_ADD_TO_DICTIONARY
SpellCheckUIListener.ACTION_IGNORE_ONCE
SpellCheckUIListener.ACTION_IGNORE_ALL
SpellCheckUIListener.ACTION_CHANGED
SpellCheckUIListener.ACTION_CANCEL
To get the misspelled word from the field see Getting Text From a Field.
ui
- the SpellCheckUI
that caused this method
invocation.field
- the field whose text contains the the misspelled word.offset
- the offset of the misspelled word in the field.len
- the length of the misspelled word.
int repeatedWordsFound(SpellCheckUI ui, Field field, int offset, int len)
The returned action can be one of
SpellCheckUIListener.ACTION_OPEN_UI
SpellCheckUIListener.ACTION_IGNORE_ONCE
SpellCheckUIListener.ACTION_CHANGED
SpellCheckUIListener.ACTION_CANCEL
To get the text containing the repeated words from the field see Getting Text From a Field.
ui
- the SpellCheckUI
that caused this method
invocation.field
- the field whose text contains the the repeated word.offset
- the offset of the first character of the first of the two
repeated words
in the field.len
- the length of the text containing the two repeated words.
boolean generatingSpellingCandidates(SpellCheckUI ui, Field field, int offset, int len, StringBuffer suggestions)
If true
is returned the spelling candidates added to
the suggestions
parameter will be the spelling candidates.
Candidates must be separated by the null character '\000'
.
To get the text from the field that is being spell checked see Getting Text From a Field. Note: The StringBuffer instance passed as an argument to this method may be re-used for other purposes after this method returns.
ui
- the SpellCheckUI
that caused this method
invocation.field
- the field whose text contains the the misspelled word.offset
- the offset of the misspelled word in the field.len
- the length of the misspelled word.suggestions
- container for storing spelling suggestions provided
by this method;
the first suggestion must be appended without prepending the null
character but subsequent spelling suggestions
must be separated from the previous suggestions with the null character.
true
if suggestions generated by this method are to
be used as the
list of suggestions; false
otherwise.boolean generatedSpellingCandidates(SpellCheckUI ui, Field field, int offset, int len, StringBuffer suggestions)
If true
is returned the modified list of spelling
suggestions
will be presented to the user. Candidates must be separated by the null
character
'\000'
.
To get the text from the field that is being spell checked see Getting Text From a Field. Note: The StringBuffer instance passed as an argument to this method may be re-used for other purposes after this method returns.
ui
- the SpellCheckUI
that caused this method
invocation.field
- the field whose text contains the the misspelled word.offset
- the offset of the misspelled word in the field.len
- the length of the misspelled word.suggestions
- the list of suggestions about to be presented to the
user, separated by the null character.
true
if the modified list of suggestions is to be
used as the list of
suggestions; false
to discard any changes made by this
method to the list of suggestions.int wordIgnored(SpellCheckUI ui, StringBuffer word, boolean ignoreAll)
ui
- the SpellCheckUI
that caused this method
invocation.word
- the misspelled word
int wordLearned(SpellCheckUI ui, StringBuffer word)
ui
- the SpellCheckUI
that caused this method
invocation.word
- the learned word
SpellCheckUIListener.LEARNING_ACCEPT
to accept the learning and add the word
to the custom
word list or SpellCheckUIListener.LEARNING_REJECT
to reject the learning and not add
the word to the
custom word list; returning any other value will cause undefined
behaviour in the spellcheck engine.int wordCorrectionLearned(SpellCheckUI ui, StringBuffer word, StringBuffer correction)
ui
- the SpellCheckUI
that caused this method
invocation.word
- the misspelled wordcorrection
- the learned correction to the misspelled word
SpellCheckUIListener.LEARNING_ACCEPT
to accept the learned word correction or
SpellCheckUIListener.LEARNING_REJECT
to reject the learned correction; returning any
other value will
cause undefined behaviour in the spellcheck engine.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.