Initial revision
[old-projects.git] / ekit / com / swabunga / spell / event / SpellCheckEvent.java
diff --git a/ekit/com/swabunga/spell/event/SpellCheckEvent.java b/ekit/com/swabunga/spell/event/SpellCheckEvent.java
new file mode 100644 (file)
index 0000000..9a1e99f
--- /dev/null
@@ -0,0 +1,67 @@
+package com.swabunga.spell.event;\r\r
+\r\r
+import java.util.*;\r\r
+\r\r
+/** This event is fired off by the SpellChecker and is passed to the\r\r
+ *  registered SpellCheckListeners\r\r
+ *  <p>AFAIK we will only require one implementation of the SpellCheckEvent\r\r
+ *  (BasicSpellCheckEvent) but I have defnied this interface just in case. The\r\r
+ *  BasicSpellCheckEvent implementation is currently package private.\r\r
+ *  </p>\r\r
+ *\r\r
+ * @author Jason Height (jheight@chariot.net.au)\r\r
+ */\r\r
+public interface SpellCheckEvent {\r\r
+  /** Field indicating that the incorrect word should be ignored*/\r\r
+  public static final short IGNORE = 0;\r\r
+  /** Field indicating that the incorrect word should be ignored forever*/\r\r
+  public static final short IGNOREALL = 1;\r\r
+  /** Field indicating that the incorrect word should be replaced*/\r\r
+  public static final short REPLACE = 2;\r\r
+  /** Field indicating that the incorrect word should be replaced always*/\r\r
+  public static final short REPLACEALL = 3;\r\r
+  /** Field indicating that the incorrect word should be added to the dictionary*/\r\r
+  public static final short ADDTODICT  = 4;\r\r
+  /** Field indicating that the spell checking should be terminated*/\r\r
+  public static final short CANCEL = 5;\r\r
+  /** Initial case for the action */\r\r
+  public static final short INITIAL = -1;\r\r
+\r\r
+  /** Returns the list of suggested Word objects*/\r\r
+  public List getSuggestions();\r\r
+\r\r
+  /** Returns the currently misspelt word*/\r\r
+  public String getInvalidWord();\r\r
+\r\r
+ /** Returns the context in which the misspelt word is used*/\r\r
+  public String getWordContext();\r\r
+\r\r
+  /** Returns the start position of the misspelt word in the context*/\r\r
+  public int getWordContextPosition();\r\r
+\r\r
+  public short getAction();\r\r
+\r\r
+  public String getReplaceWord();\r\r
+\r\r
+  /** Set the action to replace the currently misspelt word with the new word\r\r
+   *  @param String newWord The word to replace the currently misspelt word\r\r
+   *  @param boolean replaceAll If set to true, the SpellChecker will replace all\r\r
+   *  further occurances of the misspelt word without firing a SpellCheckEvent.\r\r
+   */\r\r
+  public void replaceWord(String newWord, boolean replaceAll);\r\r
+\r\r
+  /** Set the action it ignore the currently misspelt word.\r\r
+   *  @param boolean ignoreAll If set to true, the SpellChecker will replace all\r\r
+   *  further occurances of the misspelt word without firing a SpellCheckEvent.\r\r
+   */\r\r
+  public void ignoreWord(boolean ignoreAll);\r\r
+\r\r
+  /** Set the action to add a new word into the dictionary. This will also replace the\r\r
+   *  currently misspelt word.\r\r
+   */\r\r
+  public void addToDictionary(String newWord);\r\r
+\r\r
+  /** Set the action to terminate processing of the spellchecker.\r\r
+   */\r\r
+  public void cancel();\r\r
+}
\ No newline at end of file