home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 April / maximum-cd-2000-04.iso / Utilities / InternetTools / dreamweaver3 / data1.cab / App_Files / Help / search.jar / SearchApplet11ech.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-10-19  |  4.7 KB  |  171 lines

  1. import java.applet.Applet;
  2. import java.awt.Button;
  3. import java.awt.Event;
  4. import java.net.URL;
  5. import java.util.ResourceBundle;
  6. import java.util.Vector;
  7.  
  8. public class SearchApplet11ech extends Applet implements Runnable {
  9.    boolean timed = false;
  10.    boolean debug = false;
  11.    boolean stop_search = false;
  12.    Button launch;
  13.    FileLoadThread flt;
  14.    ResourceBundle bundle;
  15.    // $FF: renamed from: sf SearchFrame
  16.    SearchFrame field_0;
  17.    String encoding = "8859_1";
  18.    String resource_file;
  19.    String target;
  20.    String[] filedata;
  21.    String[] lc_filedata;
  22.    String bundle_name = "SearchAppletProperties";
  23.    String version = "19991016.1";
  24.    Thread woohoo;
  25.    URL[] fileurls;
  26.    Vector matched_docs = new Vector(17);
  27.  
  28.    public void init() {
  29.       System.out.println("Search Applet version: " + this.version);
  30.       if (((Applet)this).getParameter("DEBUG") != null) {
  31.          this.debug = new Boolean(((Applet)this).getParameter("DEBUG"));
  32.       }
  33.  
  34.       if (((Applet)this).getParameter("TIMED") != null) {
  35.          this.timed = new Boolean(((Applet)this).getParameter("TIMED"));
  36.       }
  37.  
  38.       if (((Applet)this).getParameter("BUNDLE") != null) {
  39.          this.bundle_name = ((Applet)this).getParameter("BUNDLE");
  40.       }
  41.  
  42.       this.resource_file = ((Applet)this).getParameter("RESOURCE.FILE");
  43.       if (((Applet)this).getParameter("ENCODING") != null) {
  44.          this.encoding = ((Applet)this).getParameter("ENCODING");
  45.       }
  46.  
  47.       this.target = ((Applet)this).getParameter("TARGET") != null ? ((Applet)this).getParameter("TARGET") : "right_frame";
  48.  
  49.       try {
  50.          this.bundle = ResourceBundle.getBundle(this.bundle_name);
  51.       } catch (Exception var2) {
  52.          System.out.println(var2);
  53.       }
  54.    }
  55.  
  56.    public boolean handleEvent(Event var1) {
  57.       if (var1.id == 1001 && var1.target == this.launch && !this.field_0.isShowing()) {
  58.          this.field_0.setVisible(true);
  59.       }
  60.  
  61.       return super.handleEvent(var1);
  62.    }
  63.  
  64.    public void start() {
  65.       if (this.woohoo == null) {
  66.          this.woohoo = new Thread(this);
  67.       }
  68.  
  69.       this.woohoo.start();
  70.    }
  71.  
  72.    public void run() {
  73.       if (this.field_0 == null) {
  74.          this.field_0 = new SearchFrame(this);
  75.          this.field_0.pack();
  76.       }
  77.  
  78.       if (this.filedata == null) {
  79.          this.flt = new FileLoadThread(this, this.resource_file, this.encoding);
  80.          this.flt.start();
  81.       } else {
  82.          if (!this.field_0.isVisible()) {
  83.             this.field_0.setVisible(true);
  84.          }
  85.  
  86.       }
  87.    }
  88.  
  89.    public void prompt() {
  90.       this.filedata = this.flt.getFileData();
  91.       this.lc_filedata = new String[this.filedata.length];
  92.       this.fileurls = this.flt.getFileURLs();
  93.       this.field_0.setVisible(true);
  94.       if (this.timed) {
  95.          System.out.println("File Load Time: " + this.flt.getLoadTime() + "ms");
  96.       }
  97.  
  98.       this.field_0.setStatus("");
  99.    }
  100.  
  101.    public void stop() {
  102.       if (this.woohoo != null) {
  103.          this.woohoo.stop();
  104.          this.woohoo = null;
  105.       }
  106.  
  107.    }
  108.  
  109.    public void destroy() {
  110.       if (this.field_0 != null) {
  111.          if (this.field_0.isShowing()) {
  112.             this.field_0.setVisible(false);
  113.          }
  114.  
  115.          this.field_0.dispose();
  116.       }
  117.  
  118.    }
  119.  
  120.    public void search(String[] var1, boolean var2) {
  121.       (new SearchThread(this, this.field_0, var1, this.filedata, this.lc_filedata, var2)).start();
  122.    }
  123.  
  124.    public void setStopSearch(boolean var1) {
  125.       this.stop_search = var1;
  126.    }
  127.  
  128.    public boolean getStopSearch() {
  129.       return this.stop_search;
  130.    }
  131.  
  132.    public boolean getTimedStatus() {
  133.       return this.timed;
  134.    }
  135.  
  136.    public boolean getDebugStatus() {
  137.       return this.debug;
  138.    }
  139.  
  140.    public String getMessage(String var1) {
  141.       String var2 = this.bundle.getString(var1);
  142.       return var2 != null ? var2 : "";
  143.    }
  144.  
  145.    public void showDoc(int var1) {
  146.       int var2 = (Integer)this.matched_docs.elementAt(var1);
  147.  
  148.       try {
  149.          ((Applet)this).getAppletContext().showDocument(this.fileurls[var2], this.target);
  150.       } catch (Exception var4) {
  151.          System.out.println(var4);
  152.       }
  153.    }
  154.  
  155.    public void clearMatchedDocuments() {
  156.       this.matched_docs.removeAllElements();
  157.    }
  158.  
  159.    public void addMatchedDocument(int var1) {
  160.       this.matched_docs.addElement(new Integer(var1));
  161.    }
  162.  
  163.    public void setLowerCaseFileData(int var1, String var2) {
  164.       this.lc_filedata[var1] = var2;
  165.    }
  166.  
  167.    public String getEncoding() {
  168.       return this.encoding;
  169.    }
  170. }
  171.