home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / awt / Dialog.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  5.1 KB  |  271 lines

  1. package java.awt;
  2.  
  3. import java.awt.event.ComponentEvent;
  4. import java.awt.peer.DialogPeer;
  5. import javax.accessibility.AccessibleContext;
  6. import sun.awt.AxBridgeHelper;
  7.  
  8. public class Dialog extends Window {
  9.    boolean resizable;
  10.    boolean modal;
  11.    String title;
  12.    private transient boolean keepBlocking;
  13.    private static final String base = "dialog";
  14.    private static int nameCounter;
  15.    private static final long serialVersionUID = 5920926903803293709L;
  16.    private AxBridgeHelper axbHelper;
  17.  
  18.    public Dialog(Frame var1) {
  19.       this(var1, "", false);
  20.    }
  21.  
  22.    public Dialog(Frame var1, boolean var2) {
  23.       this(var1, "", var2);
  24.    }
  25.  
  26.    public Dialog(Frame var1, String var2) {
  27.       this(var1, var2, false);
  28.    }
  29.  
  30.    public Dialog(Frame var1, String var2, boolean var3) {
  31.       super(var1);
  32.       this.resizable = true;
  33.       this.keepBlocking = false;
  34.       this.axbHelper = null;
  35.       this.title = var2;
  36.       this.modal = var3;
  37.    }
  38.  
  39.    public Dialog(Dialog var1) {
  40.       this(var1, "", false);
  41.    }
  42.  
  43.    public Dialog(Dialog var1, String var2) {
  44.       this(var1, var2, false);
  45.    }
  46.  
  47.    public Dialog(Dialog var1, String var2, boolean var3) {
  48.       super(var1);
  49.       this.resizable = true;
  50.       this.keepBlocking = false;
  51.       this.axbHelper = null;
  52.       this.title = var2;
  53.       this.modal = var3;
  54.    }
  55.  
  56.    String constructComponentName() {
  57.       Class var1 = this.getClass();
  58.       synchronized(var1) {
  59.          String var2 = "dialog" + nameCounter++;
  60.          return var2;
  61.       }
  62.    }
  63.  
  64.    public void addNotify() {
  65.       Object var1 = ((Component)this).getTreeLock();
  66.       synchronized(var1) {
  67.          if (super.parent != null && super.parent.getPeer() == null) {
  68.             super.parent.addNotify();
  69.          }
  70.  
  71.          if (super.peer == null) {
  72.             super.peer = ((Window)this).getToolkit().createDialog(this);
  73.          }
  74.  
  75.          super.addNotify();
  76.       }
  77.    }
  78.  
  79.    public boolean isModal() {
  80.       return this.modal;
  81.    }
  82.  
  83.    public void setModal(boolean var1) {
  84.       this.modal = var1;
  85.    }
  86.  
  87.    public String getTitle() {
  88.       return this.title;
  89.    }
  90.  
  91.    public synchronized void setTitle(String var1) {
  92.       this.title = var1;
  93.       DialogPeer var2 = (DialogPeer)super.peer;
  94.       if (var2 != null) {
  95.          var2.setTitle(var1);
  96.       }
  97.  
  98.    }
  99.  
  100.    private boolean conditionalShow() {
  101.       Object var2 = ((Component)this).getTreeLock();
  102.       boolean var1;
  103.       synchronized(var2) {
  104.          if (super.peer == null) {
  105.             this.addNotify();
  106.          }
  107.  
  108.          ((Container)this).validate();
  109.          if (super.visible) {
  110.             ((Window)this).toFront();
  111.             var1 = false;
  112.          } else {
  113.             var1 = true;
  114.             super.visible = true;
  115.             super.peer.show();
  116.             ((Container)this).createHierarchyEvents(1400, this, super.parent, 4L);
  117.          }
  118.  
  119.          if (var1 && (super.componentListener != null || (super.eventMask & 1L) != 0L)) {
  120.             ComponentEvent var3 = new ComponentEvent(this, 102);
  121.             Toolkit.getEventQueue().postEvent(var3);
  122.          }
  123.       }
  124.  
  125.       if (var1 && (super.state & 1) == 0) {
  126.          ((Window)this).postWindowEvent(200);
  127.          super.state |= 1;
  128.       }
  129.  
  130.       return var1;
  131.    }
  132.  
  133.    public void show() {
  134.       if (!this.isModal()) {
  135.          this.conditionalShow();
  136.       } else {
  137.          this.keepBlocking = true;
  138.          if (this.conditionalShow()) {
  139.             Toolkit.getEventQueue();
  140.             if (EventQueue.isDispatchThread()) {
  141.                EventDispatchThread var7 = (EventDispatchThread)Thread.currentThread();
  142.                var7.pumpEventsForHierarchy(new 1(this), this);
  143.             } else {
  144.                boolean var1 = false;
  145.                if (super.peer.getClass().getName().equals("sun.awt.windows.WDialogPeer")) {
  146.                   this.axbHelper = new AxBridgeHelper();
  147.                   if (AxBridgeHelper.isAppMainThread()) {
  148.                      var1 = true;
  149.                      this.axbHelper.nativeModalWait();
  150.                   }
  151.  
  152.                   this.axbHelper = null;
  153.                }
  154.  
  155.                if (!var1) {
  156.                   Object var2 = ((Component)this).getTreeLock();
  157.                   synchronized(var2) {
  158.                      while(this.keepBlocking && super.windowClosingException == null) {
  159.                         try {
  160.                            ((Component)this).getTreeLock().wait();
  161.                         } catch (InterruptedException var5) {
  162.                            break;
  163.                         }
  164.                      }
  165.                   }
  166.                }
  167.             }
  168.  
  169.             if (super.windowClosingException != null) {
  170.                super.windowClosingException.fillInStackTrace();
  171.                throw super.windowClosingException;
  172.             }
  173.          }
  174.       }
  175.  
  176.    }
  177.  
  178.    void interruptBlocking() {
  179.       if (this.modal) {
  180.          this.disposeImpl();
  181.       } else if (super.windowClosingException != null) {
  182.          super.windowClosingException.fillInStackTrace();
  183.          super.windowClosingException.printStackTrace();
  184.          super.windowClosingException = null;
  185.       }
  186.  
  187.    }
  188.  
  189.    private void hideAndDisposeHandler() {
  190.       if (this.keepBlocking) {
  191.          Object var1 = ((Component)this).getTreeLock();
  192.          synchronized(var1) {
  193.             this.keepBlocking = false;
  194.             EventQueue.invokeLater(new 2(this));
  195.             if (super.peer.getClass().getName().equals("sun.awt.windows.WDialogPeer") && this.axbHelper != null) {
  196.                this.axbHelper.nativeModalNotify();
  197.                this.axbHelper = null;
  198.             }
  199.  
  200.             ((Component)this).getTreeLock().notifyAll();
  201.          }
  202.       }
  203.  
  204.    }
  205.  
  206.    public void hide() {
  207.       super.hide();
  208.       this.hideAndDisposeHandler();
  209.    }
  210.  
  211.    public void dispose() {
  212.       this.disposeImpl();
  213.    }
  214.  
  215.    private void disposeImpl() {
  216.       super.dispose();
  217.       this.hideAndDisposeHandler();
  218.    }
  219.  
  220.    public boolean isResizable() {
  221.       return this.resizable;
  222.    }
  223.  
  224.    public void setResizable(boolean var1) {
  225.       boolean var2 = false;
  226.       synchronized(this) {
  227.          this.resizable = var1;
  228.          DialogPeer var4 = (DialogPeer)super.peer;
  229.          if (var4 != null) {
  230.             var4.setResizable(var1);
  231.             var2 = true;
  232.          }
  233.       }
  234.  
  235.       if (var2 && super.valid) {
  236.          ((Container)this).invalidate();
  237.       }
  238.  
  239.    }
  240.  
  241.    protected String paramString() {
  242.       String var1 = super.paramString() + (this.modal ? ",modal" : ",modeless");
  243.       if (this.title != null) {
  244.          var1 = var1 + ",title=" + this.title;
  245.       }
  246.  
  247.       return var1;
  248.    }
  249.  
  250.    private static native void initIDs();
  251.  
  252.    public AccessibleContext getAccessibleContext() {
  253.       if (super.accessibleContext == null) {
  254.          super.accessibleContext = new AccessibleAWTDialog(this);
  255.       }
  256.  
  257.       return super.accessibleContext;
  258.    }
  259.  
  260.    // $FF: synthetic method
  261.    static boolean access$000(Dialog var0) {
  262.       return var0.keepBlocking;
  263.    }
  264.  
  265.    static {
  266.       Toolkit.loadLibraries();
  267.       initIDs();
  268.       nameCounter = 0;
  269.    }
  270. }
  271.