home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2004 May / DPPCPRO0504.ISO / May / Seatools / SeaTools.iso / tools / en / webhelp / webhelp.jar / hhapplet / ResourceLib.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-04-17  |  3.8 KB  |  124 lines

  1. package hhapplet;
  2.  
  3. import BsscXML.BsscXML;
  4. import XMLConsumer.WhResource;
  5. import java.net.MalformedURLException;
  6. import java.net.URL;
  7. import java.util.Enumeration;
  8. import java.util.Hashtable;
  9. import java.util.Vector;
  10.  
  11. public class ResourceLib {
  12.    public static final String RES_CANCEL = "Cancel";
  13.    public static final String RES_CANTOPENURL = "CantOpenURLorFile";
  14.    public static final String RES_CANTSEARCH = "CantSearch";
  15.    public static final String RES_COMPLETINGCONTENTS = "CompletingContents";
  16.    public static final String RES_CONTENTS = "Contents";
  17.    public static final String RES_DEFINITION = "Definition";
  18.    public static final String RES_DISPLAY = "Display";
  19.    public static final String RES_DONE = "Done";
  20.    public static final String RES_FIND = "Find";
  21.    public static final String RES_GLOSSARY = "Glossary";
  22.    public static final String RES_INDEX = "Index";
  23.    public static final String RES_INDEXINPUTPROMPT = "IndexInputPrompt";
  24.    public static final String RES_INDEXSELECTPROMPT = "RelateTopicListPrompt";
  25.    public static final String RES_LOADINGCONTENTS = "LoadingContents";
  26.    public static final String RES_LOADINGDATA = "LoadingData";
  27.    public static final String RES_LOADINGFTS = "LoadingFTS";
  28.    public static final String RES_LOADINGGLOSSARY = "LoadingGlossary";
  29.    public static final String RES_LOADINGINDEX = "LoadingIndex";
  30.    public static final String RES_LOADINGTOC = "LoadingTOCItem";
  31.    public static final String RES_SEARCH = "Search";
  32.    public static final String RES_SEARCHING = "Searching";
  33.    public static final String RES_SEARCHINPUTPROMPT = "FtsInputPrompt";
  34.    public static final String RES_TERM = "Term";
  35.    public static final String RES_TOPICFOUND = "TopicsFound";
  36.    public static final String RES_TOPICNOTFOUND = "TopicsNotFound";
  37.    public static final String RES_SORTORDER = "langorder";
  38.    public static final String RES_ENGLISH = "English";
  39.    private static Hashtable m_resTable = new Hashtable();
  40.    private static WhResource m_whResource = null;
  41.  
  42.    public static boolean SetRes(String var0, String var1) {
  43.       if (m_resTable != null) {
  44.          m_resTable.put(var0, var1);
  45.          return true;
  46.       } else {
  47.          return false;
  48.       }
  49.    }
  50.  
  51.    public static String GetRes(String var0) {
  52.       return m_resTable != null ? (String)m_resTable.get(var0) : null;
  53.    }
  54.  
  55.    public static Vector getStopWords() {
  56.       return m_whResource != null ? m_whResource.getStopWords() : null;
  57.    }
  58.  
  59.    public static int getFirstShowPaneIndex() {
  60.       return m_whResource != null ? m_whResource.getFirstShowPane() : 0;
  61.    }
  62.  
  63.    public static void InitRes() {
  64.       SetRes("Cancel", "Cancel");
  65.       SetRes("CantOpenURLorFile", "Can't open URL or file ");
  66.       SetRes("CantSearch", "Help cannot search for that phrase!");
  67.       SetRes("CompletingContents", "Completing Contents...");
  68.       SetRes("Contents", "Contents");
  69.       SetRes("Definition", "Definition:");
  70.       SetRes("Display", "Display");
  71.       SetRes("Done", "Done");
  72.       SetRes("Find", "Find");
  73.       SetRes("Glossary", "Glossary");
  74.       SetRes("Index", "Index");
  75.       SetRes("IndexInputPrompt", "Type in the keyword to find:");
  76.       SetRes("RelateTopicListPrompt", "Click a topic, then click Display.");
  77.       SetRes("LoadingData", "Loading, please wait...");
  78.       SetRes("LoadingFTS", "Loading Search Data...");
  79.       SetRes("LoadingGlossary", "Loading Glossary Data...");
  80.       SetRes("LoadingIndex", "Loading Index...");
  81.       SetRes("LoadingTOCItem", "Loading Table of Contents:");
  82.       SetRes("Search", "Search");
  83.       SetRes("Searching", "Searching ...");
  84.       SetRes("FtsInputPrompt", "Type in the word(s) to search for:");
  85.       SetRes("Term", "Term:");
  86.       SetRes("TopicsFound", "Topics Found");
  87.       SetRes("LoadingContents", "Loading contents, please wait...");
  88.       SetRes("TopicsNotFound", "No Topics Found.");
  89.       SetRes("English", "true");
  90.       SetRes("langorder", "");
  91.    }
  92.  
  93.    public static boolean LoadResource(String var0) {
  94.       try {
  95.          if (m_whResource == null) {
  96.             URL var1 = URLFileHandler.makeURL(BsscXML.getDocumentBase(), var0, (String)null);
  97.             m_whResource = new WhResource(var1);
  98.             m_whResource.process();
  99.          }
  100.  
  101.          Enumeration var5 = m_resTable.keys();
  102.  
  103.          while(var5.hasMoreElements()) {
  104.             String var2 = (String)var5.nextElement();
  105.             String var3 = m_whResource.getValue(var2);
  106.             if (var3 != null) {
  107.                m_resTable.put(var2, var3);
  108.             }
  109.          }
  110.       } catch (MalformedURLException var4) {
  111.       }
  112.  
  113.       return true;
  114.    }
  115.  
  116.    public static PaneSetting getPaneSetting(String var0) {
  117.       return m_whResource != null ? m_whResource.getPaneSetting(var0) : null;
  118.    }
  119.  
  120.    public static Vector getStems() {
  121.       return m_whResource != null ? m_whResource.getStems() : null;
  122.    }
  123. }
  124.