home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- import java.applet.Applet;
- import java.awt.Dialog.ModalExclusionType;
- import java.awt.event.KeyEvent;
- import java.awt.event.MouseWheelEvent;
- import java.awt.event.WindowEvent;
- import java.awt.event.WindowFocusListener;
- import java.awt.event.WindowListener;
- import java.awt.event.WindowStateListener;
- import java.awt.im.InputContext;
- import java.awt.image.BufferStrategy;
- import java.awt.peer.WindowPeer;
- import java.beans.PropertyChangeListener;
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.io.OptionalDataException;
- import java.io.Serializable;
- import java.lang.ref.WeakReference;
- import java.lang.reflect.InvocationTargetException;
- import java.security.AccessController;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.EventListener;
- import java.util.List;
- import java.util.Locale;
- import java.util.ResourceBundle;
- import java.util.Set;
- import java.util.Vector;
- import java.util.concurrent.atomic.AtomicBoolean;
- import javax.accessibility.Accessible;
- import javax.accessibility.AccessibleContext;
- import sun.awt.AppContext;
- import sun.awt.DebugHelper;
- import sun.awt.SunToolkit;
- import sun.awt.CausedFocusEvent.Cause;
- import sun.java2d.Disposer;
- import sun.security.action.GetPropertyAction;
- import sun.security.util.SecurityConstants;
-
- public class Window extends Container implements Accessible {
- String warningString;
- transient List<Image> icons;
- private transient Component temporaryLostComponent;
- static boolean systemSyncLWRequests = false;
- boolean syncLWRequests;
- transient boolean beforeFirstShow;
- static final int OPENED = 1;
- int state;
- private boolean alwaysOnTop;
- static Vector<Window> allWindows = new Vector();
- transient Vector<WeakReference<Window>> ownedWindowList;
- private transient WeakReference<Window> weakThis;
- transient boolean showWithParent;
- transient Dialog modalBlocker;
- Dialog.ModalExclusionType modalExclusionType;
- transient WindowListener windowListener;
- transient WindowStateListener windowStateListener;
- transient WindowFocusListener windowFocusListener;
- transient InputContext inputContext;
- private transient Object inputContextLock;
- private FocusManager focusMgr;
- private boolean focusableWindowState;
- transient boolean isInShow;
- private static final String base = "win";
- private static int nameCounter = 0;
- private static final long serialVersionUID = 4497834738069338734L;
- private static final DebugHelper dbg = DebugHelper.create(Window.class);
- private static final boolean locationByPlatformProp;
- transient boolean isTrayIconWindow;
- transient Object anchor;
- private static final AtomicBoolean beforeFirstWindowShown;
- private int windowSerializedDataVersion;
- private boolean locationByPlatform;
-
- private static native void initIDs();
-
- Window(GraphicsConfiguration var1) {
- this.syncLWRequests = false;
- this.beforeFirstShow = true;
- this.ownedWindowList = new Vector();
- this.inputContextLock = new Object();
- this.focusableWindowState = true;
- this.isInShow = false;
- this.isTrayIconWindow = false;
- this.anchor = new Object();
- this.windowSerializedDataVersion = 2;
- this.locationByPlatform = locationByPlatformProp;
- this.init(var1);
- }
-
- private void init(GraphicsConfiguration var1) {
- GraphicsEnvironment.checkHeadless();
- this.syncLWRequests = systemSyncLWRequests;
- this.weakThis = new WeakReference(this);
- this.addToWindowList();
- this.setWarningString();
- this.cursor = Cursor.getPredefinedCursor(0);
- this.visible = false;
- if (var1 == null) {
- this.graphicsConfig = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
- } else {
- this.graphicsConfig = var1;
- }
-
- if (this.graphicsConfig.getDevice().getType() != 0) {
- throw new IllegalArgumentException("not a screen device");
- } else {
- this.setLayout(new BorderLayout());
- Rectangle var2 = this.graphicsConfig.getBounds();
- Insets var3 = this.getToolkit().getScreenInsets(this.graphicsConfig);
- int var4 = this.getX() + var2.x + var3.left;
- int var5 = this.getY() + var2.y + var3.top;
- if (var4 != this.x || var5 != this.y) {
- this.setLocation(var4, var5);
- this.setLocationByPlatform(locationByPlatformProp);
- }
-
- this.modalExclusionType = ModalExclusionType.NO_EXCLUDE;
- Disposer.addRecord(this.anchor, new WindowDisposerRecord(this.appContext, this));
- }
- }
-
- Window() throws HeadlessException {
- this.syncLWRequests = false;
- this.beforeFirstShow = true;
- this.ownedWindowList = new Vector();
- this.inputContextLock = new Object();
- this.focusableWindowState = true;
- this.isInShow = false;
- this.isTrayIconWindow = false;
- this.anchor = new Object();
- this.windowSerializedDataVersion = 2;
- this.locationByPlatform = locationByPlatformProp;
- GraphicsEnvironment.checkHeadless();
- this.init((GraphicsConfiguration)null);
- }
-
- public Window(Frame var1) {
- this(var1 == null ? (GraphicsConfiguration)null : var1.getGraphicsConfiguration());
- this.ownedInit(var1);
- }
-
- public Window(Window var1) {
- this(var1 == null ? (GraphicsConfiguration)null : var1.getGraphicsConfiguration());
- this.ownedInit(var1);
- }
-
- public Window(Window var1, GraphicsConfiguration var2) {
- this(var2);
- this.ownedInit(var1);
- }
-
- private void ownedInit(Window var1) {
- this.parent = var1;
- if (var1 != null) {
- var1.addOwnedWindow(this.weakThis);
- }
-
- }
-
- String constructComponentName() {
- synchronized(this.getClass()) {
- return "win" + nameCounter++;
- }
- }
-
- public List<Image> getIconImages() {
- List var1 = this.icons;
- return var1 != null && var1.size() != 0 ? new ArrayList(var1) : new ArrayList();
- }
-
- public synchronized void setIconImages(List<? extends Image> var1) {
- this.icons = var1 == null ? new ArrayList() : new ArrayList(var1);
- WindowPeer var2 = (WindowPeer)this.peer;
- if (var2 != null) {
- var2.updateIconImages();
- }
-
- this.firePropertyChange("iconImage", (Object)null, (Object)null);
- }
-
- public void setIconImage(Image var1) {
- ArrayList var2 = new ArrayList();
- if (var1 != null) {
- var2.add(var1);
- }
-
- this.setIconImages(var2);
- }
-
- public void addNotify() {
- synchronized(this.getTreeLock()) {
- Container var2 = this.parent;
- if (var2 != null && var2.getPeer() == null) {
- var2.addNotify();
- }
-
- if (this.peer == null) {
- this.peer = this.getToolkit().createWindow(this);
- }
-
- allWindows.add(this);
- super.addNotify();
- }
- }
-
- public void removeNotify() {
- synchronized(this.getTreeLock()) {
- allWindows.remove(this);
- super.removeNotify();
- }
- }
-
- public void pack() {
- Container var1 = this.parent;
- if (var1 != null && var1.getPeer() == null) {
- var1.addNotify();
- }
-
- if (this.peer == null) {
- this.addNotify();
- }
-
- Dimension var2 = this.getPreferredSize();
- if (this.peer != null) {
- this.setClientSize(var2.width, var2.height);
- }
-
- if (this.beforeFirstShow) {
- this.isPacked = true;
- }
-
- this.validate();
- }
-
- public void setMinimumSize(Dimension var1) {
- synchronized(this.getTreeLock()) {
- super.setMinimumSize(var1);
- Dimension var3 = this.getSize();
- if (this.isMinimumSizeSet() && (var3.width < var1.width || var3.height < var1.height)) {
- int var4 = Math.max(this.width, var1.width);
- int var5 = Math.max(this.height, var1.height);
- this.setSize(var4, var5);
- }
-
- if (this.peer != null) {
- ((WindowPeer)this.peer).updateMinimumSize();
- }
-
- }
- }
-
- public void setSize(Dimension var1) {
- super.setSize(var1);
- }
-
- public void setSize(int var1, int var2) {
- super.setSize(var1, var2);
- }
-
- /** @deprecated */
- @Deprecated
- public void reshape(int var1, int var2, int var3, int var4) {
- if (this.isMinimumSizeSet()) {
- Dimension var5 = this.getMinimumSize();
- if (var3 < var5.width) {
- var3 = var5.width;
- }
-
- if (var4 < var5.height) {
- var4 = var5.height;
- }
- }
-
- super.reshape(var1, var2, var3, var4);
- }
-
- void setClientSize(int var1, int var2) {
- synchronized(this.getTreeLock()) {
- this.setBoundsOp(4);
- this.setBounds(this.x, this.y, var1, var2);
- }
- }
-
- public void setVisible(boolean var1) {
- super.setVisible(var1);
- }
-
- /** @deprecated */
- @Deprecated
- public void show() {
- if (this.peer == null) {
- this.addNotify();
- }
-
- this.validate();
- this.isInShow = true;
- if (this.visible) {
- this.toFront();
- } else {
- this.beforeFirstShow = false;
- if (beforeFirstWindowShown.getAndSet(false)) {
- SunToolkit.closeSplashScreen();
- }
-
- Dialog.checkShouldBeBlocked(this);
- super.show();
- this.locationByPlatform = false;
-
- for(int var1 = 0; var1 < this.ownedWindowList.size(); ++var1) {
- Window var2 = (Window)((WeakReference)this.ownedWindowList.elementAt(var1)).get();
- if (var2 != null && var2.showWithParent) {
- var2.show();
- var2.showWithParent = false;
- }
- }
-
- if (!this.isModalBlocked()) {
- this.updateChildrenBlocking();
- }
-
- if (this instanceof Frame || this instanceof Dialog) {
- updateChildFocusableWindowState(this);
- }
- }
-
- this.isInShow = false;
- if ((this.state & 1) == 0) {
- this.postWindowEvent(200);
- this.state |= 1;
- }
-
- }
-
- static void updateChildFocusableWindowState(Window var0) {
- if (var0.getPeer() != null && var0.isShowing()) {
- ((WindowPeer)var0.getPeer()).updateFocusableWindowState();
- }
-
- for(int var1 = 0; var1 < var0.ownedWindowList.size(); ++var1) {
- Window var2 = (Window)((WeakReference)var0.ownedWindowList.elementAt(var1)).get();
- if (var2 != null) {
- updateChildFocusableWindowState(var2);
- }
- }
-
- }
-
- synchronized void postWindowEvent(int var1) {
- if (this.windowListener != null || (this.eventMask & 64L) != 0L || Toolkit.enabledOnToolkit(64L)) {
- WindowEvent var2 = new WindowEvent(this, var1);
- Toolkit.getEventQueue().postEvent(var2);
- }
-
- }
-
- /** @deprecated */
- @Deprecated
- public void hide() {
- synchronized(this.ownedWindowList) {
- for(int var2 = 0; var2 < this.ownedWindowList.size(); ++var2) {
- Window var3 = (Window)((WeakReference)this.ownedWindowList.elementAt(var2)).get();
- if (var3 != null && var3.visible) {
- var3.hide();
- var3.showWithParent = true;
- }
- }
- }
-
- if (this.isModalBlocked()) {
- this.modalBlocker.unblockWindow(this);
- }
-
- super.hide();
- }
-
- final void clearMostRecentFocusOwnerOnHide() {
- }
-
- public void dispose() {
- this.doDispose();
- }
-
- void disposeImpl() {
- this.dispose();
- if (this.getPeer() != null) {
- this.doDispose();
- }
-
- }
-
- void doDispose() {
- 1DisposeAction var1 = new 1DisposeAction(this);
- if (EventQueue.isDispatchThread()) {
- var1.run();
- } else {
- try {
- EventQueue.invokeAndWait(var1);
- } catch (InterruptedException var3) {
- System.err.println("Disposal was interrupted:");
- var3.printStackTrace();
- } catch (InvocationTargetException var4) {
- System.err.println("Exception during disposal:");
- var4.printStackTrace();
- }
- }
-
- this.postWindowEvent(202);
- }
-
- void adjustListeningChildrenOnParent(long var1, int var3) {
- }
-
- void adjustDecendantsOnParent(int var1) {
- }
-
- public void toFront() {
- this.toFront_NoClientCode();
- }
-
- final void toFront_NoClientCode() {
- if (this.visible) {
- WindowPeer var1 = (WindowPeer)this.peer;
- if (var1 != null) {
- var1.toFront();
- }
-
- if (this.isModalBlocked()) {
- this.modalBlocker.toFront_NoClientCode();
- }
- }
-
- }
-
- public void toBack() {
- this.toBack_NoClientCode();
- }
-
- final void toBack_NoClientCode() {
- if (this.isAlwaysOnTop()) {
- try {
- this.setAlwaysOnTop(false);
- } catch (SecurityException var2) {
- }
- }
-
- if (this.visible) {
- WindowPeer var1 = (WindowPeer)this.peer;
- if (var1 != null) {
- var1.toBack();
- }
- }
-
- }
-
- public Toolkit getToolkit() {
- return Toolkit.getDefaultToolkit();
- }
-
- public final String getWarningString() {
- return this.warningString;
- }
-
- private void setWarningString() {
- this.warningString = null;
- SecurityManager var1 = System.getSecurityManager();
- if (var1 != null && !var1.checkTopLevelWindow(this)) {
- this.warningString = (String)AccessController.doPrivileged(new GetPropertyAction("awt.appletWarning", "Java Applet Window"));
- }
-
- }
-
- public Locale getLocale() {
- return this.locale == null ? Locale.getDefault() : this.locale;
- }
-
- public InputContext getInputContext() {
- if (this.inputContext == null) {
- synchronized(this.inputContextLock) {
- if (this.inputContext == null) {
- this.inputContext = InputContext.getInstance();
- }
- }
- }
-
- return this.inputContext;
- }
-
- public void setCursor(Cursor var1) {
- if (var1 == null) {
- var1 = Cursor.getPredefinedCursor(0);
- }
-
- super.setCursor(var1);
- }
-
- public Window getOwner() {
- return (Window)this.parent;
- }
-
- public Window[] getOwnedWindows() {
- synchronized(this.ownedWindowList) {
- int var3 = this.ownedWindowList.size();
- int var4 = 0;
- Window[] var5 = new Window[var3];
-
- for(int var6 = 0; var6 < var3; ++var6) {
- var5[var4] = (Window)((WeakReference)this.ownedWindowList.elementAt(var6)).get();
- if (var5[var4] != null) {
- ++var4;
- }
- }
-
- Window[] var1;
- if (var3 != var4) {
- var1 = (Window[])Arrays.copyOf(var5, var4);
- } else {
- var1 = var5;
- }
-
- return var1;
- }
- }
-
- boolean isModalBlocked() {
- return this.modalBlocker != null;
- }
-
- void setModalBlocked(Dialog var1, boolean var2) {
- this.modalBlocker = var2 ? var1 : null;
- WindowPeer var3 = (WindowPeer)this.peer;
- if (var3 != null) {
- var3.setModalBlocked(var1, var2);
- }
-
- }
-
- Dialog getModalBlocker() {
- return this.modalBlocker;
- }
-
- static Vector<Window> getAllWindows() {
- synchronized(allWindows) {
- Vector var1 = new Vector();
- var1.addAll(allWindows);
- return var1;
- }
- }
-
- static Vector<Window> getAllUnblockedWindows() {
- synchronized(allWindows) {
- Vector var1 = new Vector();
-
- for(int var2 = 0; var2 < allWindows.size(); ++var2) {
- Window var3 = (Window)allWindows.get(var2);
- if (!var3.isModalBlocked()) {
- var1.add(var3);
- }
- }
-
- return var1;
- }
- }
-
- private static Window[] getWindows(AppContext var0) {
- synchronized(Window.class) {
- Vector var3 = (Vector)var0.get(Window.class);
- Window[] var2;
- if (var3 != null) {
- int var4 = var3.size();
- int var5 = 0;
- Window[] var6 = new Window[var4];
-
- for(int var7 = 0; var7 < var4; ++var7) {
- Window var8 = (Window)((WeakReference)var3.get(var7)).get();
- if (var8 != null) {
- var6[var5++] = var8;
- }
- }
-
- if (var4 != var5) {
- var2 = (Window[])Arrays.copyOf(var6, var5);
- } else {
- var2 = var6;
- }
- } else {
- var2 = new Window[0];
- }
-
- return var2;
- }
- }
-
- public static Window[] getWindows() {
- return getWindows(AppContext.getAppContext());
- }
-
- public static Window[] getOwnerlessWindows() {
- Window[] var0 = getWindows();
- int var1 = 0;
-
- for(Window var5 : var0) {
- if (var5.getOwner() == null) {
- ++var1;
- }
- }
-
- Window[] var8 = new Window[var1];
- int var9 = 0;
-
- for(Window var7 : var0) {
- if (var7.getOwner() == null) {
- var8[var9++] = var7;
- }
- }
-
- return var8;
- }
-
- Window getDocumentRoot() {
- synchronized(this.getTreeLock()) {
- Window var2;
- for(var2 = this; var2.getOwner() != null; var2 = var2.getOwner()) {
- }
-
- return var2;
- }
- }
-
- public void setModalExclusionType(Dialog.ModalExclusionType var1) {
- if (var1 == null) {
- var1 = ModalExclusionType.NO_EXCLUDE;
- }
-
- if (this.modalExclusionType != var1) {
- if (!Toolkit.getDefaultToolkit().isModalExclusionTypeSupported(var1)) {
- var1 = ModalExclusionType.NO_EXCLUDE;
- }
-
- if (var1 == ModalExclusionType.TOOLKIT_EXCLUDE) {
- SecurityManager var2 = System.getSecurityManager();
- if (var2 != null) {
- var2.checkPermission(SecurityConstants.TOOLKIT_MODALITY_PERMISSION);
- }
- }
-
- this.modalExclusionType = var1;
- }
- }
-
- public Dialog.ModalExclusionType getModalExclusionType() {
- return this.modalExclusionType;
- }
-
- boolean isModalExcluded(Dialog.ModalExclusionType var1) {
- if (this.modalExclusionType != null && this.modalExclusionType.compareTo(var1) >= 0) {
- return true;
- } else {
- Window var2 = this.getOwner();
- return var2 != null && var2.isModalExcluded(var1);
- }
- }
-
- void updateChildrenBlocking() {
- Vector var1 = new Vector();
- Window[] var2 = this.getOwnedWindows();
-
- for(int var3 = 0; var3 < var2.length; ++var3) {
- var1.add(var2[var3]);
- }
-
- for(int var7 = 0; var7 < var1.size(); ++var7) {
- Window var4 = (Window)var1.get(var7);
- if (var4.isVisible()) {
- if (var4.isModalBlocked()) {
- Dialog var5 = var4.getModalBlocker();
- var5.unblockWindow(var4);
- }
-
- Dialog.checkShouldBeBlocked(var4);
- Window[] var8 = var4.getOwnedWindows();
-
- for(int var6 = 0; var6 < var8.length; ++var6) {
- var1.add(var8[var6]);
- }
- }
- }
-
- }
-
- public synchronized void addWindowListener(WindowListener var1) {
- if (var1 != null) {
- this.newEventsOnly = true;
- this.windowListener = AWTEventMulticaster.add(this.windowListener, var1);
- }
- }
-
- public synchronized void addWindowStateListener(WindowStateListener var1) {
- if (var1 != null) {
- this.windowStateListener = AWTEventMulticaster.add(this.windowStateListener, var1);
- this.newEventsOnly = true;
- }
- }
-
- public synchronized void addWindowFocusListener(WindowFocusListener var1) {
- if (var1 != null) {
- this.windowFocusListener = AWTEventMulticaster.add(this.windowFocusListener, var1);
- this.newEventsOnly = true;
- }
- }
-
- public synchronized void removeWindowListener(WindowListener var1) {
- if (var1 != null) {
- this.windowListener = AWTEventMulticaster.remove(this.windowListener, var1);
- }
- }
-
- public synchronized void removeWindowStateListener(WindowStateListener var1) {
- if (var1 != null) {
- this.windowStateListener = AWTEventMulticaster.remove(this.windowStateListener, var1);
- }
- }
-
- public synchronized void removeWindowFocusListener(WindowFocusListener var1) {
- if (var1 != null) {
- this.windowFocusListener = AWTEventMulticaster.remove(this.windowFocusListener, var1);
- }
- }
-
- public synchronized WindowListener[] getWindowListeners() {
- return (WindowListener[])this.getListeners(WindowListener.class);
- }
-
- public synchronized WindowFocusListener[] getWindowFocusListeners() {
- return (WindowFocusListener[])this.getListeners(WindowFocusListener.class);
- }
-
- public synchronized WindowStateListener[] getWindowStateListeners() {
- return (WindowStateListener[])this.getListeners(WindowStateListener.class);
- }
-
- public <T extends EventListener> T[] getListeners(Class<T> var1) {
- Object var2 = null;
- if (var1 == WindowFocusListener.class) {
- var2 = this.windowFocusListener;
- } else if (var1 == WindowStateListener.class) {
- var2 = this.windowStateListener;
- } else {
- if (var1 != WindowListener.class) {
- return (T[])super.getListeners(var1);
- }
-
- var2 = this.windowListener;
- }
-
- return (T[])AWTEventMulticaster.getListeners((EventListener)var2, var1);
- }
-
- boolean eventEnabled(AWTEvent var1) {
- switch (var1.id) {
- case 200:
- case 201:
- case 202:
- case 203:
- case 204:
- case 205:
- case 206:
- if ((this.eventMask & 64L) == 0L && this.windowListener == null) {
- return false;
- }
-
- return true;
- case 207:
- case 208:
- if ((this.eventMask & 524288L) == 0L && this.windowFocusListener == null) {
- return false;
- }
-
- return true;
- case 209:
- if ((this.eventMask & 262144L) == 0L && this.windowStateListener == null) {
- return false;
- }
-
- return true;
- default:
- return super.eventEnabled(var1);
- }
- }
-
- protected void processEvent(AWTEvent var1) {
- if (var1 instanceof WindowEvent) {
- switch (var1.getID()) {
- case 200:
- case 201:
- case 202:
- case 203:
- case 204:
- case 205:
- case 206:
- this.processWindowEvent((WindowEvent)var1);
- break;
- case 207:
- case 208:
- this.processWindowFocusEvent((WindowEvent)var1);
- break;
- case 209:
- this.processWindowStateEvent((WindowEvent)var1);
- }
-
- } else {
- super.processEvent(var1);
- }
- }
-
- protected void processWindowEvent(WindowEvent var1) {
- WindowListener var2 = this.windowListener;
- if (var2 != null) {
- switch (var1.getID()) {
- case 200:
- var2.windowOpened(var1);
- break;
- case 201:
- var2.windowClosing(var1);
- break;
- case 202:
- var2.windowClosed(var1);
- break;
- case 203:
- var2.windowIconified(var1);
- break;
- case 204:
- var2.windowDeiconified(var1);
- break;
- case 205:
- var2.windowActivated(var1);
- break;
- case 206:
- var2.windowDeactivated(var1);
- }
- }
-
- }
-
- protected void processWindowFocusEvent(WindowEvent var1) {
- WindowFocusListener var2 = this.windowFocusListener;
- if (var2 != null) {
- switch (var1.getID()) {
- case 207:
- var2.windowGainedFocus(var1);
- break;
- case 208:
- var2.windowLostFocus(var1);
- }
- }
-
- }
-
- protected void processWindowStateEvent(WindowEvent var1) {
- WindowStateListener var2 = this.windowStateListener;
- if (var2 != null) {
- switch (var1.getID()) {
- case 209:
- var2.windowStateChanged(var1);
- }
- }
-
- }
-
- void preProcessKeyEvent(KeyEvent var1) {
- if (var1.isActionKey() && var1.getKeyCode() == 112 && var1.isControlDown() && var1.isShiftDown() && var1.getID() == 401) {
- this.list(System.out, 0);
- }
-
- }
-
- void postProcessKeyEvent(KeyEvent var1) {
- }
-
- public final void setAlwaysOnTop(boolean var1) throws SecurityException {
- SecurityManager var2 = System.getSecurityManager();
- if (var2 != null) {
- var2.checkPermission(SecurityConstants.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
- }
-
- boolean var3;
- synchronized(this) {
- var3 = this.alwaysOnTop;
- this.alwaysOnTop = var1;
- }
-
- if (var3 != var1) {
- if (this.isAlwaysOnTopSupported()) {
- WindowPeer var4 = (WindowPeer)this.peer;
- synchronized(this.getTreeLock()) {
- if (var4 != null) {
- var4.setAlwaysOnTop(var1);
- }
- }
- }
-
- this.firePropertyChange("alwaysOnTop", var3, var1);
- }
-
- }
-
- public boolean isAlwaysOnTopSupported() {
- return Toolkit.getDefaultToolkit().isAlwaysOnTopSupported();
- }
-
- public final boolean isAlwaysOnTop() {
- return this.alwaysOnTop;
- }
-
- public Component getFocusOwner() {
- return this.isFocused() ? KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() : null;
- }
-
- public Component getMostRecentFocusOwner() {
- if (this.isFocused()) {
- return this.getFocusOwner();
- } else {
- Component var1 = KeyboardFocusManager.getMostRecentFocusOwner(this);
- if (var1 != null) {
- return var1;
- } else {
- return this.isFocusableWindow() ? this.getFocusTraversalPolicy().getInitialComponent(this) : null;
- }
- }
- }
-
- public boolean isActive() {
- return KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow() == this;
- }
-
- public boolean isFocused() {
- return KeyboardFocusManager.getCurrentKeyboardFocusManager().getGlobalFocusedWindow() == this;
- }
-
- public Set<AWTKeyStroke> getFocusTraversalKeys(int var1) {
- if (var1 >= 0 && var1 < 4) {
- Set var2 = this.focusTraversalKeys != null ? this.focusTraversalKeys[var1] : null;
- return var2 != null ? var2 : KeyboardFocusManager.getCurrentKeyboardFocusManager().getDefaultFocusTraversalKeys(var1);
- } else {
- throw new IllegalArgumentException("invalid focus traversal key identifier");
- }
- }
-
- public final void setFocusCycleRoot(boolean var1) {
- }
-
- public final boolean isFocusCycleRoot() {
- return true;
- }
-
- public final Container getFocusCycleRootAncestor() {
- return null;
- }
-
- public final boolean isFocusableWindow() {
- if (!this.getFocusableWindowState()) {
- return false;
- } else if (!(this instanceof Frame) && !(this instanceof Dialog)) {
- if (this.getFocusTraversalPolicy().getDefaultComponent(this) == null) {
- return false;
- } else {
- for(Window var1 = this.getOwner(); var1 != null; var1 = var1.getOwner()) {
- if (var1 instanceof Frame || var1 instanceof Dialog) {
- return var1.isShowing();
- }
- }
-
- return false;
- }
- } else {
- return true;
- }
- }
-
- public boolean getFocusableWindowState() {
- return this.focusableWindowState;
- }
-
- public void setFocusableWindowState(boolean var1) {
- boolean var2;
- synchronized(this) {
- var2 = this.focusableWindowState;
- this.focusableWindowState = var1;
- }
-
- WindowPeer var3 = (WindowPeer)this.peer;
- if (var3 != null) {
- var3.updateFocusableWindowState();
- }
-
- this.firePropertyChange("focusableWindowState", var2, var1);
- if (var2 && !var1 && this.isFocused()) {
- for(Window var4 = this.getOwner(); var4 != null; var4 = var4.getOwner()) {
- Component var5 = KeyboardFocusManager.getMostRecentFocusOwner(var4);
- if (var5 != null && var5.requestFocus(false, Cause.ACTIVATION)) {
- return;
- }
- }
-
- KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
- }
-
- }
-
- public void addPropertyChangeListener(PropertyChangeListener var1) {
- super.addPropertyChangeListener(var1);
- }
-
- public void addPropertyChangeListener(String var1, PropertyChangeListener var2) {
- super.addPropertyChangeListener(var1, var2);
- }
-
- void dispatchEventImpl(AWTEvent var1) {
- if (var1.getID() == 101) {
- this.invalidate();
- this.validate();
- }
-
- super.dispatchEventImpl(var1);
- }
-
- /** @deprecated */
- @Deprecated
- public boolean postEvent(Event var1) {
- if (this.handleEvent(var1)) {
- var1.consume();
- return true;
- } else {
- return false;
- }
- }
-
- public boolean isShowing() {
- return this.visible;
- }
-
- /** @deprecated */
- @Deprecated
- public void applyResourceBundle(ResourceBundle var1) {
- this.applyComponentOrientation(ComponentOrientation.getOrientation(var1));
- }
-
- /** @deprecated */
- @Deprecated
- public void applyResourceBundle(String var1) {
- this.applyResourceBundle(ResourceBundle.getBundle(var1));
- }
-
- void addOwnedWindow(WeakReference var1) {
- if (var1 != null) {
- synchronized(this.ownedWindowList) {
- if (!this.ownedWindowList.contains(var1)) {
- this.ownedWindowList.addElement(var1);
- }
- }
- }
-
- }
-
- void removeOwnedWindow(WeakReference var1) {
- if (var1 != null) {
- this.ownedWindowList.removeElement(var1);
- }
-
- }
-
- void connectOwnedWindow(Window var1) {
- var1.parent = this;
- this.addOwnedWindow(var1.weakThis);
- }
-
- private void addToWindowList() {
- synchronized(Window.class) {
- Vector var2 = (Vector)this.appContext.get(Window.class);
- if (var2 == null) {
- var2 = new Vector();
- this.appContext.put(Window.class, var2);
- }
-
- var2.add(this.weakThis);
- }
- }
-
- private static void removeFromWindowList(AppContext var0, WeakReference var1) {
- synchronized(Window.class) {
- Vector var3 = (Vector)var0.get(Window.class);
- if (var3 != null) {
- var3.remove(var1);
- }
-
- }
- }
-
- private void removeFromWindowList() {
- removeFromWindowList(this.appContext, this.weakThis);
- }
-
- private void writeObject(ObjectOutputStream var1) throws IOException {
- synchronized(this) {
- this.focusMgr = new FocusManager();
- this.focusMgr.focusRoot = this;
- this.focusMgr.focusOwner = this.getMostRecentFocusOwner();
- var1.defaultWriteObject();
- this.focusMgr = null;
- AWTEventMulticaster.save(var1, "windowL", this.windowListener);
- AWTEventMulticaster.save(var1, "windowFocusL", this.windowFocusListener);
- AWTEventMulticaster.save(var1, "windowStateL", this.windowStateListener);
- }
-
- var1.writeObject((Object)null);
- synchronized(this.ownedWindowList) {
- for(int var3 = 0; var3 < this.ownedWindowList.size(); ++var3) {
- Window var4 = (Window)((WeakReference)this.ownedWindowList.elementAt(var3)).get();
- if (var4 != null) {
- var1.writeObject("ownedL");
- var1.writeObject(var4);
- }
- }
- }
-
- var1.writeObject((Object)null);
- if (this.icons != null) {
- for(Image var8 : this.icons) {
- if (var8 instanceof Serializable) {
- var1.writeObject(var8);
- }
- }
- }
-
- var1.writeObject((Object)null);
- }
-
- private void initDeserializedWindow() {
- this.setWarningString();
- this.inputContextLock = new Object();
- this.visible = false;
- this.weakThis = new WeakReference(this);
- this.anchor = new Object();
- Disposer.addRecord(this.anchor, new WindowDisposerRecord(this.appContext, this));
- this.addToWindowList();
- }
-
- private void deserializeResources(ObjectInputStream var1) throws ClassNotFoundException, IOException, HeadlessException {
- this.ownedWindowList = new Vector();
- if (this.windowSerializedDataVersion < 2) {
- if (this.focusMgr != null && this.focusMgr.focusOwner != null) {
- KeyboardFocusManager.setMostRecentFocusOwner(this, this.focusMgr.focusOwner);
- }
-
- this.focusableWindowState = true;
- }
-
- Object var2;
- while(null != (var2 = var1.readObject())) {
- String var3 = ((String)var2).intern();
- if ("windowL" == var3) {
- this.addWindowListener((WindowListener)var1.readObject());
- } else if ("windowFocusL" == var3) {
- this.addWindowFocusListener((WindowFocusListener)var1.readObject());
- } else if ("windowStateL" == var3) {
- this.addWindowStateListener((WindowStateListener)var1.readObject());
- } else {
- var1.readObject();
- }
- }
-
- try {
- while(null != (var2 = var1.readObject())) {
- String var6 = ((String)var2).intern();
- if ("ownedL" == var6) {
- this.connectOwnedWindow((Window)var1.readObject());
- } else {
- var1.readObject();
- }
- }
-
- Object var7 = var1.readObject();
-
- for(this.icons = new ArrayList(); var7 != null; var7 = var1.readObject()) {
- if (var7 instanceof Image) {
- this.icons.add((Image)var7);
- }
- }
- } catch (OptionalDataException var4) {
- }
-
- }
-
- private void readObject(ObjectInputStream var1) throws ClassNotFoundException, IOException, HeadlessException {
- GraphicsEnvironment.checkHeadless();
- this.initDeserializedWindow();
- ObjectInputStream.GetField var2 = var1.readFields();
- this.syncLWRequests = var2.get("syncLWRequests", systemSyncLWRequests);
- this.state = var2.get("state", 0);
- this.focusableWindowState = var2.get("focusableWindowState", true);
- this.windowSerializedDataVersion = var2.get("windowSerializedDataVersion", 1);
- this.locationByPlatform = var2.get("locationByPlatform", locationByPlatformProp);
- this.focusMgr = (FocusManager)var2.get("focusMgr", (Object)null);
- Dialog.ModalExclusionType var3 = (Dialog.ModalExclusionType)var2.get("modalExclusionType", ModalExclusionType.NO_EXCLUDE);
- this.setModalExclusionType(var3);
- boolean var4 = var2.get("alwaysOnTop", false);
- if (var4) {
- this.setAlwaysOnTop(var4);
- }
-
- this.deserializeResources(var1);
- }
-
- public AccessibleContext getAccessibleContext() {
- if (this.accessibleContext == null) {
- this.accessibleContext = new AccessibleAWTWindow(this);
- }
-
- return this.accessibleContext;
- }
-
- public GraphicsConfiguration getGraphicsConfiguration() {
- synchronized(this.getTreeLock()) {
- if (this.graphicsConfig == null && !GraphicsEnvironment.isHeadless()) {
- this.graphicsConfig = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
- }
-
- return this.graphicsConfig;
- }
- }
-
- void resetGC() {
- if (!GraphicsEnvironment.isHeadless()) {
- this.setGCFromPeer();
- if (this.graphicsConfig == null) {
- this.graphicsConfig = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
- }
-
- DebugHelper var10000 = dbg;
- }
-
- }
-
- public void setLocationRelativeTo(Component var1) {
- Container var2 = null;
- if (var1 != null) {
- if (!(var1 instanceof Window) && !(var1 instanceof Applet)) {
- for(Container var3 = var1.getParent(); var3 != null; var3 = var3.getParent()) {
- if (var3 instanceof Window || var3 instanceof Applet) {
- var2 = var3;
- break;
- }
- }
- } else {
- var2 = (Container)var1;
- }
- }
-
- if ((var1 == null || var1.isShowing()) && var2 != null && var2.isShowing()) {
- Dimension var10 = var1.getSize();
- Point var11 = var1.getLocationOnScreen();
- Rectangle var5 = this.getBounds();
- int var6 = var11.x + (var10.width - var5.width >> 1);
- int var7 = var11.y + (var10.height - var5.height >> 1);
- Rectangle var8 = var2.getGraphicsConfiguration().getBounds();
- if (var7 + var5.height > var8.y + var8.height) {
- var7 = var8.y + var8.height - var5.height;
- if (var11.x - var8.x + var10.width / 2 < var8.width / 2) {
- var6 = var11.x + var10.width;
- } else {
- var6 = var11.x - var5.width;
- }
- }
-
- if (var6 + var5.width > var8.x + var8.width) {
- var6 = var8.x + var8.width - var5.width;
- }
-
- if (var6 < var8.x) {
- var6 = var8.x;
- }
-
- if (var7 < var8.y) {
- var7 = var8.y;
- }
-
- this.setLocation(var6, var7);
- } else {
- Dimension var9 = this.getSize();
- Point var4 = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
- this.setLocation(var4.x - var9.width / 2, var4.y - var9.height / 2);
- }
-
- }
-
- void deliverMouseWheelToAncestor(MouseWheelEvent var1) {
- }
-
- boolean dispatchMouseWheelToAncestor(MouseWheelEvent var1) {
- return false;
- }
-
- public void createBufferStrategy(int var1) {
- super.createBufferStrategy(var1);
- }
-
- public void createBufferStrategy(int var1, BufferCapabilities var2) throws AWTException {
- super.createBufferStrategy(var1, var2);
- }
-
- public BufferStrategy getBufferStrategy() {
- return super.getBufferStrategy();
- }
-
- Component getTemporaryLostComponent() {
- return this.temporaryLostComponent;
- }
-
- Component setTemporaryLostComponent(Component var1) {
- Component var2 = this.temporaryLostComponent;
- if (var1 != null && (!var1.isDisplayable() || !var1.isVisible() || !var1.isEnabled() || !var1.isFocusable())) {
- this.temporaryLostComponent = null;
- } else {
- this.temporaryLostComponent = var1;
- }
-
- return var2;
- }
-
- boolean canContainFocusOwner(Component var1) {
- return super.canContainFocusOwner(var1) && this.isFocusableWindow();
- }
-
- public void setLocationByPlatform(boolean var1) {
- synchronized(this.getTreeLock()) {
- if (var1 && this.isShowing()) {
- throw new IllegalComponentStateException("The window is showing on screen.");
- } else {
- this.locationByPlatform = var1;
- }
- }
- }
-
- public boolean isLocationByPlatform() {
- synchronized(this.getTreeLock()) {
- return this.locationByPlatform;
- }
- }
-
- public void setBounds(int var1, int var2, int var3, int var4) {
- synchronized(this.getTreeLock()) {
- if (this.getBoundsOp() == 1 || this.getBoundsOp() == 3) {
- this.locationByPlatform = false;
- }
-
- super.setBounds(var1, var2, var3, var4);
- }
- }
-
- public void setBounds(Rectangle var1) {
- this.setBounds(var1.x, var1.y, var1.width, var1.height);
- }
-
- boolean isRecursivelyVisible() {
- return this.visible;
- }
-
- // $FF: synthetic method
- static WeakReference access$000(Window var0) {
- return var0.weakThis;
- }
-
- // $FF: synthetic method
- static void access$100(AppContext var0, WeakReference var1) {
- removeFromWindowList(var0, var1);
- }
-
- // $FF: synthetic method
- static Object access$200(Window var0) {
- return var0.inputContextLock;
- }
-
- static {
- Toolkit.loadLibraries();
- if (!GraphicsEnvironment.isHeadless()) {
- initIDs();
- }
-
- String var0 = (String)AccessController.doPrivileged(new GetPropertyAction("java.awt.syncLWRequests"));
- systemSyncLWRequests = var0 != null && var0.equals("true");
- var0 = (String)AccessController.doPrivileged(new GetPropertyAction("java.awt.Window.locationByPlatform"));
- locationByPlatformProp = var0 != null && var0.equals("true");
- beforeFirstWindowShown = new AtomicBoolean(true);
- }
- }
-