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
static shortADDTODICT
Field indicating that the incorrect word should be added to the dictionary
static shortCANCEL
Field indicating that the spell checking should be terminated
static shortIGNORE
Field indicating that the incorrect word should be ignored
static shortIGNOREALL
Field indicating that the incorrect word should be ignored forever
static shortINITIAL
Initial case for the action
static shortREPLACE
Field indicating that the incorrect word should be replaced
static shortREPLACEALL
Field indicating that the incorrect word should be replaced always
Method Summary
voidaddToDictionary(String newWord)
Set the action to add a new word into the dictionary.
voidcancel()
Set the action to terminate processing of the spell checker.
shortgetAction()
Returns the action type the user has to handle
StringgetInvalidWord()
Returns the currently misspelt word
StringgetReplaceWord()
Returns the text to replace
ListgetSuggestions()
Returns the list of suggested Word objects
StringgetWordContext()
Returns the context in which the misspelt word is used
intgetWordContextPosition()
Returns the start position of the misspelt word in the context
voidignoreWord(boolean ignoreAll)
Set the action it ignore the currently misspelt word.
voidreplaceWord(String newWord, boolean replaceAll)
Set the action to replace the currently misspelt word with the new word

Field Detail

ADDTODICT

public static final short ADDTODICT
Field indicating that the incorrect word should be added to the dictionary

CANCEL

public static final short CANCEL
Field indicating that the spell checking should be terminated

IGNORE

public static final short IGNORE
Field indicating that the incorrect word should be ignored

IGNOREALL

public static final short IGNOREALL
Field indicating that the incorrect word should be ignored forever

INITIAL

public static final short INITIAL
Initial case for the action

REPLACE

public static final short REPLACE
Field indicating that the incorrect word should be replaced

REPLACEALL

public static final short REPLACEALL
Field indicating that the incorrect word should be replaced always

Method Detail

addToDictionary

public void addToDictionary(String newWord)
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

public void cancel()
Set the action to terminate processing of the spell checker.

getAction

public short getAction()
Returns the action type the user has to handle

Returns: The type of action the event is carrying

getInvalidWord

public String getInvalidWord()
Returns the currently misspelt word

Returns: The text misspelt

getReplaceWord

public String getReplaceWord()
Returns the text to replace

Returns: the text of the word to replace

getSuggestions

public List getSuggestions()
Returns the list of suggested Word objects

Returns: A list of words phonetically close to the misspelt word

getWordContext

public String getWordContext()
Returns the context in which the misspelt word is used

Returns: The text containing the context

getWordContextPosition

public int getWordContextPosition()
Returns the start position of the misspelt word in the context

Returns: The position of the word

ignoreWord

public 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.

replaceWord

public void replaceWord(String newWord, boolean replaceAll)
Set the action to replace the currently misspelt word with the new word

Parameters: newWord The word to replace the currently misspelt word replaceAll If set to true, the SpellChecker will replace all further occurrences of the misspelt word without firing a SpellCheckEvent.