< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java

Print this page




1247 
1248     private boolean isOneOfOwnersOrSelf(CPlatformWindow window) {
1249         while (window != null) {
1250             if (this == window) {
1251                 return true;
1252             }
1253             window = window.owner;
1254         }
1255         return false;
1256     }
1257 
1258     private CPlatformWindow getRootOwner() {
1259         CPlatformWindow rootOwner = this;
1260         while (rootOwner.owner != null) {
1261             rootOwner = rootOwner.owner;
1262         }
1263         return rootOwner;
1264     }
1265 
1266     private void orderAboveSiblings() {
1267         CPlatformWindow rootOwner = getRootOwner();
1268 
1269         // Do not order child windows of iconified owner.
1270         if (!rootOwner.isIconified()) {
1271             final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
1272             Window[] windows = windowAccessor.getOwnedWindows(rootOwner.target);
1273 
1274             // No need to order windows if it doesn't own other windows and hence return
1275             if (windows.length == 0) {
1276                 return;
1277             }
1278 
1279             // Recursively pop up the windows from the very bottom, (i.e. root owner) so that
1280             // the windows are ordered above their nearest owner; ancestors of the window,
1281             // which is going to become 'main window', are placed above their siblings.
1282             if (rootOwner.isVisible()) {

1283                 rootOwner.execute(CWrapper.NSWindow::orderFront);
1284             }
1285 
1286             // Order child windows.
1287             orderAboveSiblingsImpl(windows);


1288         }
1289     }
1290 
1291     private void orderAboveSiblingsImpl(Window[] windows) {
1292         ArrayList<Window> childWindows = new ArrayList<Window>();
1293 
1294         final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor();
1295         final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
1296         Arrays.sort(windows, siblingsComparator);
1297         // Go through the list of windows and perform ordering.
1298         CPlatformWindow pwUnder = null;
1299         for (Window w : windows) {
1300             boolean iconified = false;
1301             final Object p = componentAccessor.getPeer(w);
1302             if (p instanceof LWWindowPeer) {
1303                 CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
1304                 iconified = isIconified();
1305                 if (pw != null && pw.isVisible() && !iconified) {
1306                     // If the window is one of ancestors of 'main window' or is going to become main by itself,
1307                     // the window should be ordered above its siblings; otherwise the window is just ordered




1247 
1248     private boolean isOneOfOwnersOrSelf(CPlatformWindow window) {
1249         while (window != null) {
1250             if (this == window) {
1251                 return true;
1252             }
1253             window = window.owner;
1254         }
1255         return false;
1256     }
1257 
1258     private CPlatformWindow getRootOwner() {
1259         CPlatformWindow rootOwner = this;
1260         while (rootOwner.owner != null) {
1261             rootOwner = rootOwner.owner;
1262         }
1263         return rootOwner;
1264     }
1265 
1266     private void orderAboveSiblings() {












1267         // Recursively pop up the windows from the very bottom, (i.e. root owner) so that
1268         // the windows are ordered above their nearest owner; ancestors of the window,
1269         // which is going to become 'main window', are placed above their siblings.
1270         CPlatformWindow rootOwner = getRootOwner();
1271         if (rootOwner.isVisible() && !rootOwner.isIconified() && !rootOwner.isActive()) {
1272             rootOwner.execute(CWrapper.NSWindow::orderFront);
1273         }
1274 
1275         // Do not order child windows of iconified owner.
1276         if (!rootOwner.isIconified()) {
1277             final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
1278             orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target));
1279         }
1280     }
1281 
1282     private void orderAboveSiblingsImpl(Window[] windows) {
1283         ArrayList<Window> childWindows = new ArrayList<Window>();
1284 
1285         final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor();
1286         final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
1287         Arrays.sort(windows, siblingsComparator);
1288         // Go through the list of windows and perform ordering.
1289         CPlatformWindow pwUnder = null;
1290         for (Window w : windows) {
1291             boolean iconified = false;
1292             final Object p = componentAccessor.getPeer(w);
1293             if (p instanceof LWWindowPeer) {
1294                 CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
1295                 iconified = isIconified();
1296                 if (pw != null && pw.isVisible() && !iconified) {
1297                     // If the window is one of ancestors of 'main window' or is going to become main by itself,
1298                     // the window should be ordered above its siblings; otherwise the window is just ordered


< prev index next >