home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 January / maximum-cd-2000-01.iso / Dreamweaver2 / data1.cab / Program_Files / Help / search.jar / SearchApplet9ech.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-29  |  5.2 KB  |  176 lines

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