< prev index next >

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

Print this page




1188 
1189     private boolean isOneOfOwnersOrSelf(CPlatformWindow window) {
1190         while (window != null) {
1191             if (this == window) {
1192                 return true;
1193             }
1194             window = window.owner;
1195         }
1196         return false;
1197     }
1198 
1199     private CPlatformWindow getRootOwner() {
1200         CPlatformWindow rootOwner = this;
1201         while (rootOwner.owner != null) {
1202             rootOwner = rootOwner.owner;
1203         }
1204         return rootOwner;
1205     }
1206 
1207     private void orderAboveSiblings() {












1208         // Recursively pop up the windows from the very bottom, (i.e. root owner) so that
1209         // the windows are ordered above their nearest owner; ancestors of the window,
1210         // which is going to become 'main window', are placed above their siblings.
1211         CPlatformWindow rootOwner = getRootOwner();
1212         if (rootOwner.isVisible() && !rootOwner.isIconified()) {
1213             rootOwner.execute(CWrapper.NSWindow::orderFront);
1214         }
1215         // Do not order child windows of iconified owner.
1216         if (!rootOwner.isIconified()) {
1217             final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
1218             orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target));
1219         }
1220     }
1221 
1222     private void orderAboveSiblingsImpl(Window[] windows) {
1223         ArrayList<Window> childWindows = new ArrayList<Window>();
1224 
1225         final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor();
1226         final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
1227         Arrays.sort(windows, siblingsComparator);
1228         // Go through the list of windows and perform ordering.
1229         CPlatformWindow pwUnder = null;
1230         for (Window w : windows) {
1231             boolean iconified = false;
1232             final Object p = componentAccessor.getPeer(w);
1233             if (p instanceof LWWindowPeer) {
1234                 CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
1235                 iconified = isIconified();
1236                 if (pw != null && pw.isVisible() && !iconified) {
1237                     // If the window is one of ancestors of 'main window' or is going to become main by itself,
1238                     // the window should be ordered above its siblings; otherwise the window is just ordered




1188 
1189     private boolean isOneOfOwnersOrSelf(CPlatformWindow window) {
1190         while (window != null) {
1191             if (this == window) {
1192                 return true;
1193             }
1194             window = window.owner;
1195         }
1196         return false;
1197     }
1198 
1199     private CPlatformWindow getRootOwner() {
1200         CPlatformWindow rootOwner = this;
1201         while (rootOwner.owner != null) {
1202             rootOwner = rootOwner.owner;
1203         }
1204         return rootOwner;
1205     }
1206 
1207     private void orderAboveSiblings() {
1208         CPlatformWindow rootOwner = getRootOwner();
1209 
1210         // Do not order child windows of iconified owner.
1211         if (!rootOwner.isIconified()) {
1212             final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
1213             Window[] windows = windowAccessor.getOwnedWindows(rootOwner.target);
1214 
1215             // No need to order windows if it doesn't own other windows and hence return
1216             if (windows.length == 0) {
1217                 return;
1218             }
1219 
1220             // Recursively pop up the windows from the very bottom, (i.e. root owner) so that
1221             // the windows are ordered above their nearest owner; ancestors of the window,
1222             // which is going to become 'main window', are placed above their siblings.
1223             if (rootOwner.isVisible()) {

1224                 rootOwner.execute(CWrapper.NSWindow::orderFront);
1225             }
1226 
1227             // Order child windows.
1228             orderAboveSiblingsImpl(windows);

1229         }
1230     }
1231 
1232     private void orderAboveSiblingsImpl(Window[] windows) {
1233         ArrayList<Window> childWindows = new ArrayList<Window>();
1234 
1235         final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor();
1236         final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
1237         Arrays.sort(windows, siblingsComparator);
1238         // Go through the list of windows and perform ordering.
1239         CPlatformWindow pwUnder = null;
1240         for (Window w : windows) {
1241             boolean iconified = false;
1242             final Object p = componentAccessor.getPeer(w);
1243             if (p instanceof LWWindowPeer) {
1244                 CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
1245                 iconified = isIconified();
1246                 if (pw != null && pw.isVisible() && !iconified) {
1247                     // If the window is one of ancestors of 'main window' or is going to become main by itself,
1248                     // the window should be ordered above its siblings; otherwise the window is just ordered


< prev index next >