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

      Fields 
      Modifier and Type Field Description
      static short ADDTODICT
      Field indicating that the incorrect word should be added to the dictionary
      static short CANCEL
      Field indicating that the spell checking should be terminated
      static short IGNORE
      Field indicating that the incorrect word should be ignored
      static short IGNOREALL
      Field indicating that the incorrect word should be ignored forever
      static short INITIAL
      Initial case for the action
      static short REPLACE
      Field indicating that the incorrect word should be replaced
      static short REPLACEALL
      Field indicating that the incorrect word should be replaced always
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addToDictionary​(java.lang.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 getAction()
      Returns the action type the user has to handle
      java.lang.String getInvalidWord()
      Returns the currently misspelt word
      java.lang.String getReplaceWord()
      Returns the text to replace
      java.util.List getSuggestions()
      Returns the list of suggested Word objects
      java.lang.String getWordContext()
      Returns the context in which the misspelt word is used
      int getWordContextPosition()
      Returns the start position of the misspelt word in the context
      void ignoreWord​(boolean ignoreAll)
      Set the action it ignore the currently misspelt word.
      void replaceWord​(java.lang.String newWord, boolean replaceAll)
      Set the action to replace the currently misspelt word with the new word
    • Field Detail

      • IGNORE

        static final short IGNORE
        Field indicating that the incorrect word should be ignored
        See Also:
        Constant Field Values
      • IGNOREALL

        static final short IGNOREALL
        Field indicating that the incorrect word should be ignored forever
        See Also:
        Constant Field Values
      • REPLACE

        static final short REPLACE
        Field indicating that the incorrect word should be replaced
        See Also:
        Constant Field Values
      • REPLACEALL

        static final short REPLACEALL
        Field indicating that the incorrect word should be replaced always
        See Also:
        Constant Field Values
      • ADDTODICT

        static final short ADDTODICT
        Field indicating that the incorrect word should be added to the dictionary
        See Also:
        Constant Field Values
      • CANCEL

        static final short CANCEL
        Field indicating that the spell checking should be terminated
        See Also:
        Constant Field Values
    • Method Detail

      • getSuggestions

        java.util.List getSuggestions()
        Returns the list of suggested Word objects
        Returns:
        A list of words phonetically close to the misspelt word
      • getInvalidWord

        java.lang.String getInvalidWord()
        Returns the currently misspelt word
        Returns:
        The text misspelt
      • getWordContext

        java.lang.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

        java.lang.String getReplaceWord()
        Returns the text to replace
        Returns:
        the text of the word to replace
      • replaceWord

        void replaceWord​(java.lang.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.
      • 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

        void addToDictionary​(java.lang.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

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