home *** CD-ROM | disk | FTP | other *** search
- import java.awt.BorderLayout;
- import java.awt.Button;
- import java.awt.Canvas;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dialog;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.Frame;
- import java.awt.GridLayout;
- import java.awt.Label;
- import java.awt.List;
- import java.awt.Panel;
- import java.awt.Toolkit;
- import java.awt.Window;
- import java.util.Vector;
-
- class RelatedDialog extends Dialog implements Runnable {
- DialogLayout m_Layout;
- boolean m_fInitialized;
- HHCtrl m_applet;
- String m_targetFrame;
- Vector m_itemList;
- private Thread m_callingThread;
- Frame m_parent;
- public static final int ACTION_PENDING = 0;
- public static final int ACTION_DISPLAY = 1;
- public static final int ACTION_CANCEL = 2;
- int status;
- Button btnDisplay;
- Button btnCancel;
- Label IDC_STATIC1;
- List lstItems;
-
- boolean isInitialized() {
- return this.m_fInitialized;
- }
-
- boolean CreateControls() {
- int var1 = 0;
- int var2 = 0;
- if (this.m_fInitialized) {
- return false;
- } else {
- try {
- var1 = Integer.valueOf(this.m_applet.getString("rel.dlgwidth"));
- var2 = Integer.valueOf(this.m_applet.getString("rel.dlgheight"));
- } catch (Exception var6) {
- if (var1 == 0) {
- var1 = 294;
- }
-
- if (var2 == 0) {
- var2 = 238;
- }
- }
-
- ((Component)this).resize(var1, var2);
- ((Container)this).setLayout(new BorderLayout(10, 7));
- Panel var3 = new Panel();
- ((Container)var3).setLayout(new BorderLayout(4, 5));
- ((Container)var3).add("North", new Label(this.m_applet.getString("rel.label"), 0));
- this.lstItems = new List(1, false);
- ((Container)var3).add("Center", this.lstItems);
- this.lstItems.setBackground(Color.white);
- Panel var4 = new Panel();
- ((Container)var4).setLayout(new BorderLayout(0, 5));
- Panel var5 = new Panel();
- ((Container)var5).setLayout(new GridLayout(1, 2, 8, 4));
- this.btnDisplay = new Button(" " + this.m_applet.getString("rel.display") + " ");
- ((Container)var5).add(this.btnDisplay);
- this.btnCancel = new Button(" " + this.m_applet.getString("rel.cancel") + " ");
- ((Container)var5).add(this.btnCancel);
- ((Container)var4).add("East", var5);
- ((Container)var4).add("South", new Canvas());
- ((Container)var3).add("South", var4);
- ((Container)this).add("North", new Canvas());
- ((Container)this).add("South", new Canvas());
- ((Container)this).add("Center", var3);
- ((Container)this).add("West", new Canvas());
- ((Container)this).add("East", new Canvas());
- this.m_fInitialized = true;
- return true;
- }
- }
-
- public void setCallingThread(Thread var1) {
- this.m_callingThread = var1;
- }
-
- RelatedDialog(String var1, String var2, HHCtrl var3, Frame var4) {
- super(var4, var1, true);
- this.m_parent = var4;
- this.m_applet = var3;
- this.m_targetFrame = var2;
- ((Dialog)this).setResizable(false);
- ((Component)this).setBackground(Color.lightGray);
- ((Dialog)this).setTitle(var1);
- }
-
- void setItems(Vector var1) {
- if (this.lstItems.countItems() > 0) {
- this.lstItems.clear();
- }
-
- for(int var3 = 0; var3 < var1.size(); ++var3) {
- String var2 = (String)var1.elementAt(var3);
- if (var2.indexOf(";") > 0) {
- this.lstItems.addItem(var2.substring(0, var2.indexOf(";")));
- }
- }
-
- if (var1.size() > 0) {
- this.lstItems.select(0);
- }
-
- this.m_itemList = var1;
- }
-
- public int getStatus() {
- return this.status;
- }
-
- public void show() {
- this.status = 0;
- String var1 = System.getProperty("java.vendor");
- Toolkit var2 = ((Window)this).getToolkit();
- Dimension var3 = var2.getScreenSize();
- if (var1.indexOf("Microsoft") != -1) {
- Dimension var4 = ((Component)this).size();
- ((Component)this).move(var3.width / 2 - var4.width / 2, var3.height / 2 - var4.height / 2);
- super.show();
- ((Component)this).move(var3.width / 2 - var4.width / 2, var3.height / 2 - var4.height / 2);
- ((Component)this).resize(var4);
- } else {
- ((Component)this).move(var3.width / 2 - ((Component)this).size().width / 2, var3.height / 2 - ((Component)this).size().height / 2);
- super.show();
- ((Component)this).move(var3.width / 2 - ((Component)this).size().width / 2, var3.height / 2 - ((Component)this).size().height / 2);
- }
-
- this.lstItems.requestFocus();
- }
-
- public void run() {
- this.m_applet.showRelated();
- }
-
- public boolean handleEvent(Event var1) {
- if ((var1.target != this.btnDisplay || var1.id != 1001) && (var1.target != this.lstItems || var1.id != 1001)) {
- if ((var1.target != this.btnCancel || var1.id != 1001) && (var1.id != 402 || var1.key != 27)) {
- if (var1.id == 201) {
- this.status = 2;
- ((Component)this).hide();
- this.m_parent.requestFocus();
- this.m_callingThread.resume();
- return true;
- } else if (var1.target == this.lstItems && var1.id == 402 && var1.key == 10) {
- this.status = 1;
- ((Component)this).hide();
- this.m_parent.requestFocus();
- this.m_callingThread.resume();
- return true;
- } else {
- return super.handleEvent(var1);
- }
- } else {
- this.status = 2;
- ((Component)this).hide();
- this.m_parent.requestFocus();
- this.m_callingThread.resume();
- return true;
- }
- } else {
- this.status = 1;
- ((Component)this).hide();
- this.m_parent.requestFocus();
- this.m_callingThread.resume();
- return true;
- }
- }
- }
-