home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 40 / CDPowerplay40.iso / utils / flash4 / flash4full.exe / data1.cab / App_Files / Help / search.jar / SearchApplet4ech.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-08-20  |  4.8 KB  |  153 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 SearchApplet4ech extends Applet implements Runnable {
  13.    boolean timed = false;
  14.    boolean stop_search = false;
  15.    Button launch;
  16.    FileLoadThread flt;
  17.    ResourceBundle bundle;
  18.    // $FF: renamed from: sf SearchFrame
  19.    SearchFrame field_0;
  20.    String encoding;
  21.    String resource_file;
  22.    String target;
  23.    String[] filedata;
  24.    String[] lc_filedata;
  25.    Thread woohoo;
  26.    URL[] fileurls;
  27.    Vector matched_docs = new Vector(17);
  28.  
  29.    public void init() {
  30.       if (((Applet)this).getParameter("TIMED") != null) {
  31.          this.timed = new Boolean(((Applet)this).getParameter("TIMED"));
  32.       }
  33.  
  34.       this.resource_file = ((Applet)this).getParameter("RESOURCE.FILE");
  35.       this.encoding = ((Applet)this).getParameter("ENCODING");
  36.       this.target = ((Applet)this).getParameter("TARGET") != null ? ((Applet)this).getParameter("TARGET") : "right_frame";
  37.  
  38.       try {
  39.          this.bundle = ResourceBundle.getBundle("SearchAppletProperties");
  40.       } catch (Exception var2) {
  41.          System.out.println(var2);
  42.       }
  43.  
  44.       ((Component)this).setBackground(new Color(51, 51, 153));
  45.       ((Container)this).setLayout(new BorderLayout(0, 0));
  46.       this.launch = new Button(this.getMessage("searchapplet.launch.button"));
  47.       this.launch.setBackground(Color.white);
  48.       this.launch.setForeground(new Color(51, 51, 153));
  49.       this.launch.disable();
  50.       ((Container)this).add("Center", this.launch);
  51.    }
  52.  
  53.    public boolean handleEvent(Event var1) {
  54.       if (var1.id == 1001 && var1.target == this.launch && !this.field_0.isShowing()) {
  55.          this.field_0.setVisible(true);
  56.       }
  57.  
  58.       return super.handleEvent(var1);
  59.    }
  60.  
  61.    public void start() {
  62.       if (this.woohoo == null) {
  63.          this.woohoo = new Thread(this);
  64.       }
  65.  
  66.       this.woohoo.start();
  67.    }
  68.  
  69.    public void run() {
  70.       if (this.filedata == null) {
  71.          this.flt = new FileLoadThread(this, this.resource_file, this.encoding);
  72.          this.flt.start();
  73.       }
  74.  
  75.       this.field_0 = new SearchFrame(this);
  76.       this.field_0.pack();
  77.    }
  78.  
  79.    public void prompt() {
  80.       this.filedata = this.flt.getFileData();
  81.       this.lc_filedata = new String[this.filedata.length];
  82.       this.fileurls = this.flt.getFileURLs();
  83.       this.launch.enable();
  84.       if (this.timed) {
  85.          System.out.println("File Load Time: " + this.flt.getLoadTime() + "ms");
  86.       }
  87.  
  88.       this.field_0.setStatus("");
  89.    }
  90.  
  91.    public void stop() {
  92.       if (this.woohoo != null) {
  93.          this.woohoo.stop();
  94.          this.woohoo = null;
  95.       }
  96.  
  97.    }
  98.  
  99.    public void destroy() {
  100.       if (this.field_0 != null) {
  101.          if (this.field_0.isShowing()) {
  102.             this.field_0.setVisible(false);
  103.          }
  104.  
  105.          this.field_0.dispose();
  106.       }
  107.  
  108.    }
  109.  
  110.    public void search(String[] var1, boolean var2) {
  111.       (new SearchThread(this, this.field_0, var1, this.filedata, this.lc_filedata, var2)).start();
  112.    }
  113.  
  114.    public void setStopSearch(boolean var1) {
  115.       this.stop_search = var1;
  116.    }
  117.  
  118.    public boolean getStopSearch() {
  119.       return this.stop_search;
  120.    }
  121.  
  122.    public boolean getTimedStatus() {
  123.       return this.timed;
  124.    }
  125.  
  126.    public String getMessage(String var1) {
  127.       String var2 = this.bundle.getString(var1);
  128.       return var2 != null ? var2 : "";
  129.    }
  130.  
  131.    public void showDoc(int var1) {
  132.       int var2 = (Integer)this.matched_docs.elementAt(var1);
  133.  
  134.       try {
  135.          ((Applet)this).getAppletContext().showDocument(this.fileurls[var2], this.target);
  136.       } catch (Exception var4) {
  137.          System.out.println(var4);
  138.       }
  139.    }
  140.  
  141.    public void clearMatchedDocuments() {
  142.       this.matched_docs.removeAllElements();
  143.    }
  144.  
  145.    public void addMatchedDocument(int var1) {
  146.       this.matched_docs.addElement(new Integer(var1));
  147.    }
  148.  
  149.    public void setLowerCaseFileData(int var1, String var2) {
  150.       this.lc_filedata[var1] = var2;
  151.    }
  152. }
  153.