home *** CD-ROM | disk | FTP | other *** search
- package hhapplet;
-
- 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.Dimension;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.Frame;
- import java.awt.Label;
- import java.awt.List;
- import java.awt.Panel;
- import java.awt.Point;
- import java.awt.Toolkit;
- import java.awt.Window;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.Vector;
-
- public class IndexSecondaryDialog extends Frame {
- protected Button m_btnDisplay = null;
- protected Button m_btnCancel = null;
- protected List m_list = null;
- protected Applet m_applet;
- protected Vector m_vEntries;
- protected DialogDoneTarget m_ddtDone;
- private BsscHelpRedirector m_rd = null;
- private boolean m_bIsIE3 = false;
- private Point m_pntPosition;
-
- public boolean gotFocus(Event var1, Object var2) {
- if (var1.target == this) {
- this.m_list.requestFocus();
- return true;
- } else {
- return super.gotFocus(var1, var2);
- }
- }
-
- public void showTopic() {
- ((Component)this).setBackground(new Color(192, 192, 192));
- if (!System.getProperty("os.name").startsWith("Windows") && !System.getProperty("os.name").startsWith("Mac OS")) {
- this.show();
- }
-
- short var1 = 300;
- short var2 = 240;
- Dimension var3 = Toolkit.getDefaultToolkit().getScreenSize();
- int var4 = var3.width / 2 - var1 / 2;
- int var5 = var3.height / 2 - var2 / 2;
- if (!System.getProperty("os.name").startsWith("Windows") && !System.getProperty("os.name").startsWith("Mac OS")) {
- ((Component)this).reshape(var4, var5, var1, var2);
- } else {
- ((Component)this).resize(var1, var2);
- }
-
- this.m_pntPosition = new Point(var4, var5);
- if (System.getProperty("java.vendor").startsWith("Microsoft") && System.getProperty("java.version").startsWith("1.0")) {
- this.m_bIsIE3 = true;
- }
-
- int var6 = BsscFontFixPatch.GetFontSize();
- this.m_list.setFont(new Font(BsscFontFixPatch.GetFontName(), 0, var6));
-
- for(int var7 = 0; var7 < this.m_vEntries.size(); ++var7) {
- this.m_list.addItem(((IndexSecondaryEntry)this.m_vEntries.elementAt(var7)).name);
- }
-
- this.m_list.select(0);
- Panel var8 = new Panel();
- ((Container)var8).add(this.m_btnDisplay);
- ((Container)var8).add(this.m_btnCancel);
- ((Container)this).setLayout(new BorderLayout(5, 5));
- this.m_list.setBackground(Color.white);
- ((Container)this).add("North", new Label(" " + ResourceLib.GetRes("RelateTopicListPrompt")));
- ((Container)this).add("Center", this.m_list);
- ((Container)this).add("South", var8);
- if (!System.getProperty("os.name").startsWith("Windows") && !System.getProperty("os.name").startsWith("Mac OS")) {
- ((Window)this).toFront();
- } else {
- ((Component)this).reshape(var4, var5, var1, var2);
- ((Component)this).move(var4, var5);
- ((Frame)this).setResizable(false);
- this.show();
- }
- }
-
- public IndexSecondaryDialog(Applet var1, Vector var2, DialogDoneTarget var3, BsscHelpRedirector var4) {
- super(ResourceLib.GetRes("TopicsFound"));
- this.m_applet = var1;
- this.m_vEntries = var2;
- this.m_ddtDone = var3;
- this.m_btnDisplay = new Button(ResourceLib.GetRes("Display"));
- this.m_btnCancel = new Button(ResourceLib.GetRes("Cancel"));
- this.m_list = new List();
- this.m_rd = var4;
- }
-
- public List getList() {
- return this.m_list;
- }
-
- protected void gotoSelectedIndex() {
- int var1 = this.m_list.getSelectedIndex();
- if (var1 != -1) {
- try {
- IndexSecondaryEntry var2 = (IndexSecondaryEntry)this.m_vEntries.elementAt(var1);
- URL var3 = URLFileHandler.makeURL(this.m_applet.getDocumentBase(), var2.local, var2.url);
- String var4 = var3.toString();
- if (var4.indexOf("file:/\\\\") == 0) {
- var4 = "file://" + var4.substring(8);
- var3 = new URL(var4);
- }
-
- this.m_rd.showDoc(var3, var2.frame);
- } catch (MalformedURLException var5) {
- ((Throwable)var5).printStackTrace();
- }
-
- this.closeDialog();
- ((Frame)this).dispose();
- }
-
- }
-
- public void show() {
- if (this.m_bIsIE3) {
- Dimension var1 = ((Component)this).size();
- ((Component)this).reshape(this.m_pntPosition.x, this.m_pntPosition.y, var1.width, var1.height);
- super.show();
- ((Component)this).reshape(this.m_pntPosition.x, this.m_pntPosition.y, var1.width, var1.height);
- } else {
- super.show();
- }
-
- this.m_list.requestFocus();
- }
-
- public boolean action(Event var1, Object var2) {
- if (var1.target != this.m_btnDisplay && var1.target != this.m_list) {
- if (var1.target == this.m_btnCancel) {
- this.closeDialog();
- return true;
- } else {
- return false;
- }
- } else {
- this.gotoSelectedIndex();
- return true;
- }
- }
-
- protected void closeDialog() {
- ((Frame)this).dispose();
- if (this.m_ddtDone != null) {
- this.m_ddtDone.dialogDone();
- }
-
- }
-
- public boolean handleEvent(Event var1) {
- if (!System.getProperty("java.version").startsWith("1.1.5") || !System.getProperty("java.vendor").startsWith("Netscape") || var1.id != 401 || var1.key != 10 || var1.target != this.m_btnDisplay && var1.target != this.m_btnCancel) {
- if (var1.id == 201) {
- this.closeDialog();
- ((Frame)this).dispose();
- } else {
- if (var1.target == this.m_list && var1.key == 10 && var1.id == 401) {
- this.gotoSelectedIndex();
- return true;
- }
-
- if (var1.target == this.m_list && var1.key == 10 && var1.id == 402) {
- if (System.getProperty("java.version").equals("1.1") && System.getProperty("java.vendor").startsWith("Microsoft")) {
- this.gotoSelectedIndex();
- return true;
- }
- } else if (var1.key == 27 && var1.id == 402) {
- this.closeDialog();
- ((Frame)this).dispose();
- }
- }
-
- return super.handleEvent(var1);
- } else {
- this.action(var1, var1.target);
- return true;
- }
- }
- }
-