com.inet.jortho
Class FileUserDictionary

java.lang.Object
  extended by 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 interface UserDictionaryProvider. It save the user dictionaries on the local disk as text files.


Constructor Summary
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
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface UserDictionaryProvider
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 interface CustomDictionaryProvider
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 interface UserDictionaryProvider
Parameters:
wordList - the new word list. Can be empty but not null.


Copyright © 2005 - 2009 i-net software. All Rights Reserved.