1 | package com.swabunga.spell.event; |
---|
2 | |
---|
3 | import java.util.List; |
---|
4 | |
---|
5 | /** |
---|
6 | * This event is fired off by the SpellChecker and is passed to the |
---|
7 | * registered SpellCheckListeners |
---|
8 | * <p/> |
---|
9 | * AFAIK we will only require one implementation of the SpellCheckEvent |
---|
10 | * (BasicSpellCheckEvent) but I have defnied this interface just in case. The |
---|
11 | * BasicSpellCheckEvent implementation is currently package private. |
---|
12 | * <p/> |
---|
13 | * |
---|
14 | * @author Jason Height (jheight@chariot.net.au) |
---|
15 | */ |
---|
16 | public interface SpellCheckEvent { |
---|
17 | /** Field indicating that the incorrect word should be ignored*/ |
---|
18 | public static final short IGNORE = 0; |
---|
19 | /** Field indicating that the incorrect word should be ignored forever*/ |
---|
20 | public static final short IGNOREALL = 1; |
---|
21 | /** Field indicating that the incorrect word should be replaced*/ |
---|
22 | public static final short REPLACE = 2; |
---|
23 | /** Field indicating that the incorrect word should be replaced always*/ |
---|
24 | public static final short REPLACEALL = 3; |
---|
25 | /** Field indicating that the incorrect word should be added to the dictionary*/ |
---|
26 | public static final short ADDTODICT = 4; |
---|
27 | /** Field indicating that the spell checking should be terminated*/ |
---|
28 | public static final short CANCEL = 5; |
---|
29 | /** Initial case for the action */ |
---|
30 | public static final short INITIAL = -1; |
---|
31 | |
---|
32 | /** Returns the list of suggested Word objects*/ |
---|
33 | public List getSuggestions(); |
---|
34 | |
---|
35 | /** Returns the currently misspelt word*/ |
---|
36 | public String getInvalidWord(); |
---|
37 | |
---|
38 | /** Returns the context in which the misspelt word is used*/ |
---|
39 | public String getWordContext(); |
---|
40 | |
---|
41 | /** Returns the start position of the misspelt word in the context*/ |
---|
42 | public int getWordContextPosition(); |
---|
43 | |
---|
44 | public short getAction(); |
---|
45 | |
---|
46 | public String getReplaceWord(); |
---|
47 | |
---|
48 | /** Set the action to replace the currently misspelt word with the new word |
---|
49 | * @param newWord The word to replace the currently misspelt word |
---|
50 | * @param replaceAll If set to true, the SpellChecker will replace all |
---|
51 | * further occurances of the misspelt word without firing a SpellCheckEvent. |
---|
52 | */ |
---|
53 | public void replaceWord(String newWord, boolean replaceAll); |
---|
54 | |
---|
55 | /** Set the action it ignore the currently misspelt word. |
---|
56 | * @param ignoreAll If set to true, the SpellChecker will replace all |
---|
57 | * further occurances of the misspelt word without firing a SpellCheckEvent. |
---|
58 | */ |
---|
59 | public void ignoreWord(boolean ignoreAll); |
---|
60 | |
---|
61 | /** Set the action to add a new word into the dictionary. This will also replace the |
---|
62 | * currently misspelt word. |
---|
63 | */ |
---|
64 | public void addToDictionary(String newWord); |
---|
65 | |
---|
66 | /** Set the action to terminate processing of the spellchecker. |
---|
67 | */ |
---|
68 | public void cancel(); |
---|
69 | } |
---|