Package com.inet.jortho
Class FileUserDictionary
- java.lang.Object
-
- com.inet.jortho.FileUserDictionary
-
- All Implemented Interfaces:
CustomDictionaryProvider
,UserDictionaryProvider
public class FileUserDictionary extends java.lang.Object implements UserDictionaryProvider
This is a reference implementation of the interfaceUserDictionaryProvider
. It save the user dictionaries on the local disk as text files.
-
-
Constructor Summary
Constructors Constructor Description FileUserDictionary()
Create a FileUserDictionary with the dictionaries in the root of the current application.FileUserDictionary(java.lang.String fileBase)
Create a FileUserDictionary with the dictionaries on a specific location.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWord(java.lang.String word)
Adds a new word to the current user dictionary.java.util.Iterator<java.lang.String>
getWords(java.util.Locale locale)
Gets the list of custom words for this locale.void
setUserWords(java.lang.String wordList)
Set a completely new word list
-
-
-
Constructor Detail
-
FileUserDictionary
public FileUserDictionary()
Create a FileUserDictionary with the dictionaries in the root of the current application.
-
FileUserDictionary
public FileUserDictionary(java.lang.String fileBase)
Create a FileUserDictionary with the dictionaries on a specific location.- Parameters:
fileBase
- the base
-
-
Method Detail
-
addWord
public void addWord(java.lang.String word)
Adds a new word to the current user dictionary. The implementor must save this word in its own backend.- Specified by:
addWord
in interfaceUserDictionaryProvider
- Parameters:
word
- the new word.
-
getWords
public java.util.Iterator<java.lang.String> getWords(java.util.Locale locale)
Gets the list of custom words for this locale. The implementation can decide if there is a custom dictionary for each available language or only one. This method is called before the language change event is fired if the language is changed and the dictionary is loaded.- Specified by:
getWords
in interfaceCustomDictionaryProvider
- Parameters:
locale
- The locale of the selected language.- Returns:
- A list of words delimited with line breaks. It can be null.
-
setUserWords
public void setUserWords(java.lang.String wordList)
Set a completely new word list- Specified by:
setUserWords
in interfaceUserDictionaryProvider
- Parameters:
wordList
- the new word list. Can be empty but not null.
-
-