8006790: Improve checking for windows

Reviewed-by: art, mschoene
This commit is contained in:
Sergey Malenkov 2013-02-05 20:07:54 +04:00
parent 05882c2a52
commit ac95e3f1ed
10 changed files with 29 additions and 26 deletions

View File

@ -170,7 +170,7 @@ public class LWWindowPeer
setTitle(((Dialog) getTarget()).getTitle()); setTitle(((Dialog) getTarget()).getTitle());
} }
setAlwaysOnTop(getTarget().isAlwaysOnTop()); updateAlwaysOnTopState();
updateMinimumSize(); updateMinimumSize();
final Shape shape = getTarget().getShape(); final Shape shape = getTarget().getShape();
@ -357,8 +357,8 @@ public class LWWindowPeer
} }
@Override @Override
public void setAlwaysOnTop(boolean value) { public void updateAlwaysOnTopState() {
platformWindow.setAlwaysOnTop(value); platformWindow.setAlwaysOnTop(getTarget().isAlwaysOnTop());
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -180,7 +180,7 @@ class CFileDialog implements FileDialogPeer {
} }
@Override @Override
public void setAlwaysOnTop(boolean alwaysOnTop) { public void updateAlwaysOnTopState() {
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -87,7 +87,7 @@ public class CPrinterDialogPeer extends LWWindowPeer {
} }
// 1.6 peer method // 1.6 peer method
public void setAlwaysOnTop(boolean value) { public void updateAlwaysOnTopState() {
// no-op, since we just show the native print dialog // no-op, since we just show the native print dialog
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -2234,7 +2234,7 @@ public class Window extends Container implements Accessible {
WindowPeer peer = (WindowPeer)this.peer; WindowPeer peer = (WindowPeer)this.peer;
synchronized(getTreeLock()) { synchronized(getTreeLock()) {
if (peer != null) { if (peer != null) {
peer.setAlwaysOnTop(alwaysOnTop); peer.updateAlwaysOnTopState();
} }
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -53,15 +53,14 @@ public interface WindowPeer extends ContainerPeer {
void toBack(); void toBack();
/** /**
* Sets if the window should always stay on top of all other windows or * Updates the window's always-on-top state.
* not. * Sets if the window should always stay
* * on top of all other windows or not.
* @param alwaysOnTop if the window should always stay on top of all other
* windows or not
* *
* @see Window#getAlwaysOnTop()
* @see Window#setAlwaysOnTop(boolean) * @see Window#setAlwaysOnTop(boolean)
*/ */
void setAlwaysOnTop(boolean alwaysOnTop); void updateAlwaysOnTopState();
/** /**
* Updates the window's focusable state. * Updates the window's focusable state.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -542,7 +542,7 @@ public abstract class EmbeddedFrame extends Frame
public void toBack() {} public void toBack() {}
public void updateFocusableWindowState() {} public void updateFocusableWindowState() {}
public void updateAlwaysOnTop() {} public void updateAlwaysOnTop() {}
public void setAlwaysOnTop(boolean alwaysOnTop) {} public void updateAlwaysOnTopState() {}
public Component getGlobalHeavyweightFocusOwner() { return null; } public Component getGlobalHeavyweightFocusOwner() { return null; }
public void setBoundsPrivate(int x, int y, int width, int height) { public void setBoundsPrivate(int x, int y, int width, int height) {
setBounds(x, y, width, height, SET_BOUNDS); setBounds(x, y, width, height, SET_BOUNDS);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -993,8 +993,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
XLayerProtocol.LAYER_NORMAL); XLayerProtocol.LAYER_NORMAL);
} }
public void setAlwaysOnTop(boolean alwaysOnTop) { public void updateAlwaysOnTopState() {
this.alwaysOnTop = alwaysOnTop; this.alwaysOnTop = ((Window) this.target).isAlwaysOnTop();
updateAlwaysOnTop(); updateAlwaysOnTop();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -237,7 +237,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
// unused methods. Overridden to disable this functionality as // unused methods. Overridden to disable this functionality as
// it requires HWND which is not available for FileDialog // it requires HWND which is not available for FileDialog
public void setAlwaysOnTop(boolean value) {} public void updateAlwaysOnTopState() {}
public void setDirectory(String dir) {} public void setDirectory(String dir) {}
public void setFile(String file) {} public void setFile(String file) {}
public void setTitle(String title) {} public void setTitle(String title) {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -117,7 +117,7 @@ public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
// unused methods. Overridden to disable this functionality as // unused methods. Overridden to disable this functionality as
// it requires HWND which is not available for FileDialog // it requires HWND which is not available for FileDialog
void initialize() {} void initialize() {}
public void setAlwaysOnTop(boolean b) {} public void updateAlwaysOnTopState() {}
public void setResizable(boolean resizable) {} public void setResizable(boolean resizable) {}
public void hide() {} public void hide() {}
public void enable() {} public void enable() {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -132,6 +132,10 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
} }
} }
public void updateAlwaysOnTopState() {
setAlwaysOnTop(((Window)target).isAlwaysOnTop());
}
public void updateFocusableWindowState() { public void updateFocusableWindowState() {
setFocusableWindow(((Window)target).isFocusableWindow()); setFocusableWindow(((Window)target).isFocusableWindow());
} }