1229 CPlatformWindow rootOwner = this; 1230 while (rootOwner.owner != null) { 1231 rootOwner = rootOwner.owner; 1232 } 1233 return rootOwner; 1234 } 1235 1236 private void orderAboveSiblings() { 1237 CPlatformWindow rootOwner = getRootOwner(); 1238 1239 // Do not order child windows of iconified owner. 1240 if (!rootOwner.isIconified()) { 1241 final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor(); 1242 Window[] windows = windowAccessor.getOwnedWindows(rootOwner.target); 1243 1244 // No need to order windows if it doesn't own other windows and hence return 1245 if (windows.length == 0) { 1246 return; 1247 } 1248 1249 // Recursively pop up the windows from the very bottom, (i.e. root owner) so that 1250 // the windows are ordered above their nearest owner; ancestors of the window, 1251 // which is going to become 'main window', are placed above their siblings. 1252 if (rootOwner.isVisible()) { 1253 rootOwner.execute(CWrapper.NSWindow::orderFront); 1254 } 1255 1256 // Order child windows. 1257 orderAboveSiblingsImpl(windows); 1258 } 1259 } 1260 1261 private void orderAboveSiblingsImpl(Window[] windows) { 1262 ArrayList<Window> childWindows = new ArrayList<Window>(); 1263 1264 final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor(); 1265 final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor(); 1266 Arrays.sort(windows, siblingsComparator); 1267 // Go through the list of windows and perform ordering. 1268 CPlatformWindow pwUnder = null; | 1229 CPlatformWindow rootOwner = this; 1230 while (rootOwner.owner != null) { 1231 rootOwner = rootOwner.owner; 1232 } 1233 return rootOwner; 1234 } 1235 1236 private void orderAboveSiblings() { 1237 CPlatformWindow rootOwner = getRootOwner(); 1238 1239 // Do not order child windows of iconified owner. 1240 if (!rootOwner.isIconified()) { 1241 final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor(); 1242 Window[] windows = windowAccessor.getOwnedWindows(rootOwner.target); 1243 1244 // No need to order windows if it doesn't own other windows and hence return 1245 if (windows.length == 0) { 1246 return; 1247 } 1248 1249 boolean isThereVisibleChild = false; 1250 1251 // Looking for visible child windows 1252 for (int i = 0; i < windows.length; i ++) { 1253 if (windows[i].isVisible()) { 1254 isThereVisibleChild = true; 1255 break; 1256 } 1257 } 1258 1259 // Do not order the window if all its child are invisible 1260 if (!isThereVisibleChild) { 1261 return; 1262 } 1263 1264 // Recursively pop up the windows from the very bottom, (i.e. root owner) so that 1265 // the windows are ordered above their nearest owner; ancestors of the window, 1266 // which is going to become 'main window', are placed above their siblings. 1267 if (rootOwner.isVisible()) { 1268 rootOwner.execute(CWrapper.NSWindow::orderFront); 1269 } 1270 1271 // Order child windows. 1272 orderAboveSiblingsImpl(windows); 1273 } 1274 } 1275 1276 private void orderAboveSiblingsImpl(Window[] windows) { 1277 ArrayList<Window> childWindows = new ArrayList<Window>(); 1278 1279 final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor(); 1280 final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor(); 1281 Arrays.sort(windows, siblingsComparator); 1282 // Go through the list of windows and perform ordering. 1283 CPlatformWindow pwUnder = null; |