Interface WebappSpellchecker
-
@API(type=NOT_EXTENDABLE, src=PUBLIC) public interface WebappSpellchecker
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<SpellCheckingProblemInfo>
check(java.util.List<TextChunkDescriptor> textDescriptors)
Performs a spellcheck of the given text descriptors.SpellSuggestionsInfo
getSuggestionsForWordAtPosition(int position)
Gets the suggestions for the word at a certain position.Dictionary
getTermsDictionary()
Get the current custom terms dictionary to be applied when doing spell checking actions.java.util.List<TextChunkDescriptor>
getTextDescriptors(int startOffset, int endOffset)
Returns the list of descriptors for chunks of text between the given offsets.void
replaceWithSuggestion(int startOffset, int endOffset, java.lang.String newWord)
Replaces word at a certain position.void
setDefaultLanguage(java.lang.String lang)
Sets the default language to be used for spell checking if an xml:lang attribute is not specified.void
setSpellcheckingEngine(java.lang.String lang, SpellcheckingEngine checker)
Sets the default spellchecker for a language.void
setTermsDictionary(Dictionary apiDict)
Set a custom terms dictionary to be used on spell checking actions.
-
-
-
Method Detail
-
getSuggestionsForWordAtPosition
SpellSuggestionsInfo getSuggestionsForWordAtPosition(int position) throws javax.swing.text.BadLocationException, java.io.IOException
Gets the suggestions for the word at a certain position.- Parameters:
position
- Position in the document.- Returns:
- List of spellchecking suggestions for the word.
- Throws:
javax.swing.text.BadLocationException
java.io.IOException
-
replaceWithSuggestion
void replaceWithSuggestion(int startOffset, int endOffset, java.lang.String newWord) throws javax.swing.text.BadLocationException, java.io.IOException
Replaces word at a certain position.- Parameters:
startOffset
- Start offset for replacement.endOffset
- End offset for replacement.newWord
- Word to be inserted.- Throws:
javax.swing.text.BadLocationException
java.io.IOException
-
getTextDescriptors
java.util.List<TextChunkDescriptor> getTextDescriptors(int startOffset, int endOffset)
Returns the list of descriptors for chunks of text between the given offsets.- Parameters:
startOffset
- The start offset.endOffset
- The end offset.- Returns:
- The list of text descriptors.
-
check
java.util.List<SpellCheckingProblemInfo> check(java.util.List<TextChunkDescriptor> textDescriptors) throws java.io.IOException
Performs a spellcheck of the given text descriptors. This method is thread-safe. Can be called on multiple threads and can also be called while other threads are modifying the document.- Parameters:
textDescriptors
- The text descriptors.- Returns:
- The list of spelling problems.
- Throws:
java.io.IOException
- If there is a problem reading the dictionaries.
-
getTermsDictionary
Dictionary getTermsDictionary()
Get the current custom terms dictionary to be applied when doing spell checking actions.- Returns:
- Returns the custom terms dictionary.
- Since:
- 21
-
setTermsDictionary
void setTermsDictionary(Dictionary apiDict)
Set a custom terms dictionary to be used on spell checking actions.- Parameters:
apiDict
- The terms dictionary to set.- Since:
- 21
-
setDefaultLanguage
void setDefaultLanguage(java.lang.String lang)
Sets the default language to be used for spell checking if an xml:lang attribute is not specified. Examples of format: en_US, fr_FR, de_DE, jp_JP, it_IT, nl_NL- Parameters:
lang
- The language used to be used for spell checking.- Since:
- 21
-
setSpellcheckingEngine
void setSpellcheckingEngine(java.lang.String lang, SpellcheckingEngine checker)
Sets the default spellchecker for a language. Examples of language format: en_US, fr_FR, de_DE, jp_JP, it_IT, nl_NL- Parameters:
lang
- The language to be handled by the spell checking engine.checker
- The spell checking engine to be used for the language.- Since:
- 21
-
-