home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- import java.awt.event.ComponentEvent;
- import java.awt.peer.DialogPeer;
- import javax.accessibility.AccessibleContext;
- import sun.awt.AxBridgeHelper;
-
- public class Dialog extends Window {
- boolean resizable;
- boolean modal;
- String title;
- private transient boolean keepBlocking;
- private static final String base = "dialog";
- private static int nameCounter;
- private static final long serialVersionUID = 5920926903803293709L;
- private AxBridgeHelper axbHelper;
-
- public Dialog(Frame var1) {
- this(var1, "", false);
- }
-
- public Dialog(Frame var1, boolean var2) {
- this(var1, "", var2);
- }
-
- public Dialog(Frame var1, String var2) {
- this(var1, var2, false);
- }
-
- public Dialog(Frame var1, String var2, boolean var3) {
- super(var1);
- this.resizable = true;
- this.keepBlocking = false;
- this.axbHelper = null;
- this.title = var2;
- this.modal = var3;
- }
-
- public Dialog(Dialog var1) {
- this(var1, "", false);
- }
-
- public Dialog(Dialog var1, String var2) {
- this(var1, var2, false);
- }
-
- public Dialog(Dialog var1, String var2, boolean var3) {
- super(var1);
- this.resizable = true;
- this.keepBlocking = false;
- this.axbHelper = null;
- this.title = var2;
- this.modal = var3;
- }
-
- String constructComponentName() {
- Class var1 = this.getClass();
- synchronized(var1) {
- String var2 = "dialog" + nameCounter++;
- return var2;
- }
- }
-
- public void addNotify() {
- Object var1 = ((Component)this).getTreeLock();
- synchronized(var1) {
- if (super.parent != null && super.parent.getPeer() == null) {
- super.parent.addNotify();
- }
-
- if (super.peer == null) {
- super.peer = ((Window)this).getToolkit().createDialog(this);
- }
-
- super.addNotify();
- }
- }
-
- public boolean isModal() {
- return this.modal;
- }
-
- public void setModal(boolean var1) {
- this.modal = var1;
- }
-
- public String getTitle() {
- return this.title;
- }
-
- public synchronized void setTitle(String var1) {
- this.title = var1;
- DialogPeer var2 = (DialogPeer)super.peer;
- if (var2 != null) {
- var2.setTitle(var1);
- }
-
- }
-
- private boolean conditionalShow() {
- Object var2 = ((Component)this).getTreeLock();
- boolean var1;
- synchronized(var2) {
- if (super.peer == null) {
- this.addNotify();
- }
-
- ((Container)this).validate();
- if (super.visible) {
- ((Window)this).toFront();
- var1 = false;
- } else {
- var1 = true;
- super.visible = true;
- super.peer.show();
- ((Container)this).createHierarchyEvents(1400, this, super.parent, 4L);
- }
-
- if (var1 && (super.componentListener != null || (super.eventMask & 1L) != 0L)) {
- ComponentEvent var3 = new ComponentEvent(this, 102);
- Toolkit.getEventQueue().postEvent(var3);
- }
- }
-
- if (var1 && (super.state & 1) == 0) {
- ((Window)this).postWindowEvent(200);
- super.state |= 1;
- }
-
- return var1;
- }
-
- public void show() {
- if (!this.isModal()) {
- this.conditionalShow();
- } else {
- this.keepBlocking = true;
- if (this.conditionalShow()) {
- Toolkit.getEventQueue();
- if (EventQueue.isDispatchThread()) {
- EventDispatchThread var7 = (EventDispatchThread)Thread.currentThread();
- var7.pumpEventsForHierarchy(new 1(this), this);
- } else {
- boolean var1 = false;
- if (super.peer.getClass().getName().equals("sun.awt.windows.WDialogPeer")) {
- this.axbHelper = new AxBridgeHelper();
- if (AxBridgeHelper.isAppMainThread()) {
- var1 = true;
- this.axbHelper.nativeModalWait();
- }
-
- this.axbHelper = null;
- }
-
- if (!var1) {
- Object var2 = ((Component)this).getTreeLock();
- synchronized(var2) {
- while(this.keepBlocking && super.windowClosingException == null) {
- try {
- ((Component)this).getTreeLock().wait();
- } catch (InterruptedException var5) {
- break;
- }
- }
- }
- }
- }
-
- if (super.windowClosingException != null) {
- super.windowClosingException.fillInStackTrace();
- throw super.windowClosingException;
- }
- }
- }
-
- }
-
- void interruptBlocking() {
- if (this.modal) {
- this.disposeImpl();
- } else if (super.windowClosingException != null) {
- super.windowClosingException.fillInStackTrace();
- super.windowClosingException.printStackTrace();
- super.windowClosingException = null;
- }
-
- }
-
- private void hideAndDisposeHandler() {
- if (this.keepBlocking) {
- Object var1 = ((Component)this).getTreeLock();
- synchronized(var1) {
- this.keepBlocking = false;
- EventQueue.invokeLater(new 2(this));
- if (super.peer.getClass().getName().equals("sun.awt.windows.WDialogPeer") && this.axbHelper != null) {
- this.axbHelper.nativeModalNotify();
- this.axbHelper = null;
- }
-
- ((Component)this).getTreeLock().notifyAll();
- }
- }
-
- }
-
- public void hide() {
- super.hide();
- this.hideAndDisposeHandler();
- }
-
- public void dispose() {
- this.disposeImpl();
- }
-
- private void disposeImpl() {
- super.dispose();
- this.hideAndDisposeHandler();
- }
-
- public boolean isResizable() {
- return this.resizable;
- }
-
- public void setResizable(boolean var1) {
- boolean var2 = false;
- synchronized(this) {
- this.resizable = var1;
- DialogPeer var4 = (DialogPeer)super.peer;
- if (var4 != null) {
- var4.setResizable(var1);
- var2 = true;
- }
- }
-
- if (var2 && super.valid) {
- ((Container)this).invalidate();
- }
-
- }
-
- protected String paramString() {
- String var1 = super.paramString() + (this.modal ? ",modal" : ",modeless");
- if (this.title != null) {
- var1 = var1 + ",title=" + this.title;
- }
-
- return var1;
- }
-
- private static native void initIDs();
-
- public AccessibleContext getAccessibleContext() {
- if (super.accessibleContext == null) {
- super.accessibleContext = new AccessibleAWTDialog(this);
- }
-
- return super.accessibleContext;
- }
-
- // $FF: synthetic method
- static boolean access$000(Dialog var0) {
- return var0.keepBlocking;
- }
-
- static {
- Toolkit.loadLibraries();
- initIDs();
- nameCounter = 0;
- }
- }
-