Package com.swabunga.spell.event
Interface SpellCheckEvent
public interface SpellCheckEvent
This event is fired off by the SpellChecker and is passed to the
registered SpellCheckListeners
As far as I know, we will only require one implementation of the SpellCheckEvent
(BasicSpellCheckEvent) but I have defined this interface just in case. The
BasicSpellCheckEvent implementation is currently package private.
- Author:
- Jason Height (jheight@chariot.net.au)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final short
Field indicating that the incorrect word should be added to the dictionarystatic final short
Field indicating that the spell checking should be terminatedstatic final short
Field indicating that the incorrect word should be ignoredstatic final short
Field indicating that the incorrect word should be ignored foreverstatic final short
Initial case for the actionstatic final short
Field indicating that the incorrect word should be replacedstatic final short
Field indicating that the incorrect word should be replaced always -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToDictionary
(String newWord) Set the action to add a new word into the dictionary.void
cancel()
Set the action to terminate processing of the spell checker.short
Returns the action type the user has to handleReturns the currently misspelt wordReturns the text to replaceReturns the list of suggested Word objectsReturns the context in which the misspelt word is usedint
Returns the start position of the misspelt word in the contextvoid
ignoreWord
(boolean ignoreAll) Set the action it ignore the currently misspelt word.void
replaceWord
(String newWord, boolean replaceAll) Set the action to replace the currently misspelt word with the new word
-
Field Details
-
IGNORE
static final short IGNOREField indicating that the incorrect word should be ignored- See Also:
-
IGNOREALL
static final short IGNOREALLField indicating that the incorrect word should be ignored forever- See Also:
-
REPLACE
static final short REPLACEField indicating that the incorrect word should be replaced- See Also:
-
REPLACEALL
static final short REPLACEALLField indicating that the incorrect word should be replaced always- See Also:
-
ADDTODICT
static final short ADDTODICTField indicating that the incorrect word should be added to the dictionary- See Also:
-
CANCEL
static final short CANCELField indicating that the spell checking should be terminated- See Also:
-
INITIAL
static final short INITIALInitial case for the action- See Also:
-
-
Method Details
-
getSuggestions
List getSuggestions()Returns the list of suggested Word objects- Returns:
- A list of words phonetically close to the misspelt word
-
getInvalidWord
String getInvalidWord()Returns the currently misspelt word- Returns:
- The text misspelt
-
getWordContext
String getWordContext()Returns the context in which the misspelt word is used- Returns:
- The text containing the context
-
getWordContextPosition
int getWordContextPosition()Returns the start position of the misspelt word in the context- Returns:
- The position of the word
-
getAction
short getAction()Returns the action type the user has to handle- Returns:
- The type of action the event is carrying
-
getReplaceWord
String getReplaceWord()Returns the text to replace- Returns:
- the text of the word to replace
-
replaceWord
Set the action to replace the currently misspelt word with the new word- Parameters:
newWord
- The word to replace the currently misspelt wordreplaceAll
- If set to true, the SpellChecker will replace all further occurrences of the misspelt word without firing a SpellCheckEvent.
-
ignoreWord
void ignoreWord(boolean ignoreAll) Set the action it ignore the currently misspelt word.- Parameters:
ignoreAll
- If set to true, the SpellChecker will replace all further occurrences of the misspelt word without firing a SpellCheckEvent.
-
addToDictionary
Set the action to add a new word into the dictionary. This will also replace the currently misspelt word.- Parameters:
newWord
- The new word to add
-
cancel
void cancel()Set the action to terminate processing of the spell checker.
-