home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.BorderLayout;
- import java.awt.Button;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Event;
- import java.net.URL;
- import java.util.ResourceBundle;
- import java.util.Vector;
-
- public class SearchApplet4ech extends Applet implements Runnable {
- boolean timed = false;
- boolean stop_search = false;
- Button launch;
- FileLoadThread flt;
- ResourceBundle bundle;
- // $FF: renamed from: sf SearchFrame
- SearchFrame field_0;
- String encoding;
- String resource_file;
- String target;
- String[] filedata;
- String[] lc_filedata;
- Thread woohoo;
- URL[] fileurls;
- Vector matched_docs = new Vector(17);
-
- public void init() {
- if (((Applet)this).getParameter("TIMED") != null) {
- this.timed = new Boolean(((Applet)this).getParameter("TIMED"));
- }
-
- this.resource_file = ((Applet)this).getParameter("RESOURCE.FILE");
- this.encoding = ((Applet)this).getParameter("ENCODING");
- this.target = ((Applet)this).getParameter("TARGET") != null ? ((Applet)this).getParameter("TARGET") : "right_frame";
-
- try {
- this.bundle = ResourceBundle.getBundle("SearchAppletProperties");
- } catch (Exception var2) {
- System.out.println(var2);
- }
-
- ((Component)this).setBackground(new Color(51, 51, 153));
- ((Container)this).setLayout(new BorderLayout(0, 0));
- this.launch = new Button(this.getMessage("searchapplet.launch.button"));
- this.launch.setBackground(Color.white);
- this.launch.setForeground(new Color(51, 51, 153));
- this.launch.disable();
- ((Container)this).add("Center", this.launch);
- }
-
- public boolean handleEvent(Event var1) {
- if (var1.id == 1001 && var1.target == this.launch && !this.field_0.isShowing()) {
- this.field_0.setVisible(true);
- }
-
- return super.handleEvent(var1);
- }
-
- public void start() {
- if (this.woohoo == null) {
- this.woohoo = new Thread(this);
- }
-
- this.woohoo.start();
- }
-
- public void run() {
- if (this.filedata == null) {
- this.flt = new FileLoadThread(this, this.resource_file, this.encoding);
- this.flt.start();
- }
-
- this.field_0 = new SearchFrame(this);
- this.field_0.pack();
- }
-
- public void prompt() {
- this.filedata = this.flt.getFileData();
- this.lc_filedata = new String[this.filedata.length];
- this.fileurls = this.flt.getFileURLs();
- this.launch.enable();
- if (this.timed) {
- System.out.println("File Load Time: " + this.flt.getLoadTime() + "ms");
- }
-
- this.field_0.setStatus("");
- }
-
- public void stop() {
- if (this.woohoo != null) {
- this.woohoo.stop();
- this.woohoo = null;
- }
-
- }
-
- public void destroy() {
- if (this.field_0 != null) {
- if (this.field_0.isShowing()) {
- this.field_0.setVisible(false);
- }
-
- this.field_0.dispose();
- }
-
- }
-
- public void search(String[] var1, boolean var2) {
- (new SearchThread(this, this.field_0, var1, this.filedata, this.lc_filedata, var2)).start();
- }
-
- public void setStopSearch(boolean var1) {
- this.stop_search = var1;
- }
-
- public boolean getStopSearch() {
- return this.stop_search;
- }
-
- public boolean getTimedStatus() {
- return this.timed;
- }
-
- public String getMessage(String var1) {
- String var2 = this.bundle.getString(var1);
- return var2 != null ? var2 : "";
- }
-
- public void showDoc(int var1) {
- int var2 = (Integer)this.matched_docs.elementAt(var1);
-
- try {
- ((Applet)this).getAppletContext().showDocument(this.fileurls[var2], this.target);
- } catch (Exception var4) {
- System.out.println(var4);
- }
- }
-
- public void clearMatchedDocuments() {
- this.matched_docs.removeAllElements();
- }
-
- public void addMatchedDocument(int var1) {
- this.matched_docs.addElement(new Integer(var1));
- }
-
- public void setLowerCaseFileData(int var1, String var2) {
- this.lc_filedata[var1] = var2;
- }
- }
-