home *** CD-ROM | disk | FTP | other *** search
- package hhapplet;
-
- import BsscXML.BsscXML;
- import XMLConsumer.WhResource;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.Enumeration;
- import java.util.Hashtable;
- import java.util.Vector;
-
- public class ResourceLib {
- public static final String RES_CANCEL = "Cancel";
- public static final String RES_CANTOPENURL = "CantOpenURLorFile";
- public static final String RES_CANTSEARCH = "CantSearch";
- public static final String RES_COMPLETINGCONTENTS = "CompletingContents";
- public static final String RES_CONTENTS = "Contents";
- public static final String RES_DEFINITION = "Definition";
- public static final String RES_DISPLAY = "Display";
- public static final String RES_DONE = "Done";
- public static final String RES_FIND = "Find";
- public static final String RES_GLOSSARY = "Glossary";
- public static final String RES_INDEX = "Index";
- public static final String RES_INDEXINPUTPROMPT = "IndexInputPrompt";
- public static final String RES_INDEXSELECTPROMPT = "RelateTopicListPrompt";
- public static final String RES_LOADINGCONTENTS = "LoadingContents";
- public static final String RES_LOADINGDATA = "LoadingData";
- public static final String RES_LOADINGFTS = "LoadingFTS";
- public static final String RES_LOADINGGLOSSARY = "LoadingGlossary";
- public static final String RES_LOADINGINDEX = "LoadingIndex";
- public static final String RES_LOADINGTOC = "LoadingTOCItem";
- public static final String RES_SEARCH = "Search";
- public static final String RES_SEARCHING = "Searching";
- public static final String RES_SEARCHINPUTPROMPT = "FtsInputPrompt";
- public static final String RES_TERM = "Term";
- public static final String RES_TOPICFOUND = "TopicsFound";
- public static final String RES_TOPICNOTFOUND = "TopicsNotFound";
- public static final String RES_SORTORDER = "langorder";
- public static final String RES_ENGLISH = "English";
- private static Hashtable m_resTable = new Hashtable();
- private static WhResource m_whResource = null;
-
- public static boolean SetRes(String var0, String var1) {
- if (m_resTable != null) {
- m_resTable.put(var0, var1);
- return true;
- } else {
- return false;
- }
- }
-
- public static String GetRes(String var0) {
- return m_resTable != null ? (String)m_resTable.get(var0) : null;
- }
-
- public static Vector getStopWords() {
- return m_whResource != null ? m_whResource.getStopWords() : null;
- }
-
- public static int getFirstShowPaneIndex() {
- return m_whResource != null ? m_whResource.getFirstShowPane() : 0;
- }
-
- public static void InitRes() {
- SetRes("Cancel", "Cancel");
- SetRes("CantOpenURLorFile", "Can't open URL or file ");
- SetRes("CantSearch", "Help cannot search for that phrase!");
- SetRes("CompletingContents", "Completing Contents...");
- SetRes("Contents", "Contents");
- SetRes("Definition", "Definition:");
- SetRes("Display", "Display");
- SetRes("Done", "Done");
- SetRes("Find", "Find");
- SetRes("Glossary", "Glossary");
- SetRes("Index", "Index");
- SetRes("IndexInputPrompt", "Type in the keyword to find:");
- SetRes("RelateTopicListPrompt", "Click a topic, then click Display.");
- SetRes("LoadingData", "Loading, please wait...");
- SetRes("LoadingFTS", "Loading Search Data...");
- SetRes("LoadingGlossary", "Loading Glossary Data...");
- SetRes("LoadingIndex", "Loading Index...");
- SetRes("LoadingTOCItem", "Loading Table of Contents:");
- SetRes("Search", "Search");
- SetRes("Searching", "Searching ...");
- SetRes("FtsInputPrompt", "Type in the word(s) to search for:");
- SetRes("Term", "Term:");
- SetRes("TopicsFound", "Topics Found");
- SetRes("LoadingContents", "Loading contents, please wait...");
- SetRes("TopicsNotFound", "No Topics Found.");
- SetRes("English", "true");
- SetRes("langorder", "");
- }
-
- public static boolean LoadResource(String var0) {
- try {
- if (m_whResource == null) {
- URL var1 = URLFileHandler.makeURL(BsscXML.getDocumentBase(), var0, (String)null);
- m_whResource = new WhResource(var1);
- m_whResource.process();
- }
-
- Enumeration var5 = m_resTable.keys();
-
- while(var5.hasMoreElements()) {
- String var2 = (String)var5.nextElement();
- String var3 = m_whResource.getValue(var2);
- if (var3 != null) {
- m_resTable.put(var2, var3);
- }
- }
- } catch (MalformedURLException var4) {
- }
-
- return true;
- }
-
- public static PaneSetting getPaneSetting(String var0) {
- return m_whResource != null ? m_whResource.getPaneSetting(var0) : null;
- }
-
- public static Vector getStems() {
- return m_whResource != null ? m_whResource.getStems() : null;
- }
- }
-