Class DictCapabilities

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--DictCapabilities
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class DictCapabilities
extends org.xml.sax.helpers.DefaultHandler

Queries the dictionary server for available lexica. The methods of this class designed for public use are all static.

Version:
$03/03/25 08:12:25 mdh$
Author:
Malcolm D. Hyman

Constructor Summary
DictCapabilities()
           
 
Method Summary
static boolean areKnown()
          Returns true if the capabilities of the dictionary server are already known.
static void forgetEverything()
          Resets the flag that indicates that the dictionary server has already been queried.
static java.util.Map getChoicesForLanguage(java.lang.String lang)
          Returns a map of human-readable lexicon names against lexicon codes.
static java.lang.String getDefaultForLanguage(java.lang.String lang)
          Returns the code for the default lexicon for the language lang.
static void queryCapabilities(ContentOwner owner)
          Queries the dictionary server to find out what lexica are available.
static void setDefaultForLanguage(java.lang.String lang, java.lang.String lex)
          Sets the default lexicon for the language lang, thereby preserving the user's preference.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          This is part of the ContentHandler interface.
static boolean supportsLanguage(java.lang.String lang)
          Returns true if the dictionary server can provide any lexica for the language lang.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DictCapabilities

public DictCapabilities()
Method Detail

queryCapabilities

public static void queryCapabilities(ContentOwner owner)
Queries the dictionary server to find out what lexica are available.
Parameters:
owner - content owner (used to determine scriptbase)

areKnown

public static boolean areKnown()
Returns true if the capabilities of the dictionary server are already known.
Returns:
true if capabilities are known

forgetEverything

public static void forgetEverything()
Resets the flag that indicates that the dictionary server has already been queried. The next time the dictionary server needs to be accessed, it will first be queried for its capabilities.

supportsLanguage

public static boolean supportsLanguage(java.lang.String lang)
Returns true if the dictionary server can provide any lexica for the language lang.
Parameters:
lang - language identifier
Returns:
true if any dictionaries for lang

getChoicesForLanguage

public static java.util.Map getChoicesForLanguage(java.lang.String lang)
Returns a map of human-readable lexicon names against lexicon codes.
Parameters:
lang - language identifier
Returns:
lexicon map

getDefaultForLanguage

public static java.lang.String getDefaultForLanguage(java.lang.String lang)
Returns the code for the default lexicon for the language lang.
Parameters:
lang - language identifier
Returns:
code for default lexicon

setDefaultForLanguage

public static void setDefaultForLanguage(java.lang.String lang,
                                         java.lang.String lex)
Sets the default lexicon for the language lang, thereby preserving the user's preference.
Parameters:
lang - language identifier
lex - lexicon code

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
This is part of the ContentHandler interface.
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler