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