365 366 final boolean isFrame = (target instanceof Frame); 367 final boolean isDialog = (target instanceof Dialog); 368 final boolean isPopup = (target.getType() == Window.Type.POPUP); 369 if (isDialog) { 370 styleBits = SET(styleBits, MINIMIZABLE, false); 371 } 372 373 // Either java.awt.Frame or java.awt.Dialog can be undecorated, however java.awt.Window always is undecorated. 374 { 375 this.undecorated = isFrame ? ((Frame)target).isUndecorated() : (isDialog ? ((Dialog)target).isUndecorated() : true); 376 if (this.undecorated) styleBits = SET(styleBits, DECORATED, false); 377 } 378 379 // Either java.awt.Frame or java.awt.Dialog can be resizable, however java.awt.Window is never resizable 380 { 381 final boolean resizable = isFrame ? ((Frame)target).isResizable() : (isDialog ? ((Dialog)target).isResizable() : false); 382 styleBits = SET(styleBits, RESIZABLE, resizable); 383 if (!resizable) { 384 styleBits = SET(styleBits, ZOOMABLE, false); 385 } else { 386 setCanFullscreen(true); 387 } 388 } 389 390 if (target.isAlwaysOnTop()) { 391 styleBits = SET(styleBits, ALWAYS_ON_TOP, true); 392 } 393 394 if (target.getModalExclusionType() == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) { 395 styleBits = SET(styleBits, MODAL_EXCLUDED, true); 396 } 397 398 // If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look. 399 if (isPopup) { 400 styleBits = SET(styleBits, TEXTURED, false); 401 // Popups in applets don't activate applet's process 402 styleBits = SET(styleBits, NONACTIVATING, true); 403 styleBits = SET(styleBits, IS_POPUP, true); 404 } 405 406 if (Window.Type.UTILITY.equals(target.getType())) { 671 CWrapper.NSWindow.NSWindowBelow, 672 blockerPtr); 673 }); 674 }); 675 } 676 this.visible = visible; 677 678 // Manage the extended state when showing 679 if (visible) { 680 // Apply the extended state as expected in shared code 681 if (target instanceof Frame) { 682 if (!wasMaximized && isMaximized()) { 683 // setVisible could have changed the native maximized state 684 deliverZoom(true); 685 } else { 686 int frameState = ((Frame)target).getExtendedState(); 687 if ((frameState & Frame.ICONIFIED) != 0) { 688 // Treat all state bit masks with ICONIFIED bit as ICONIFIED state. 689 frameState = Frame.ICONIFIED; 690 } 691 switch (frameState) { 692 case Frame.ICONIFIED: 693 execute(CWrapper.NSWindow::miniaturize); 694 break; 695 case Frame.MAXIMIZED_BOTH: 696 maximize(); 697 break; 698 default: // NORMAL 699 unmaximize(); // in case it was maximized, otherwise this is a no-op 700 break; 701 } 702 } 703 } 704 } 705 706 nativeSynthesizeMouseEnteredExitedEvents(); 707 708 // Configure stuff #2 709 updateFocusabilityForAutoRequestFocus(true); 710 | 365 366 final boolean isFrame = (target instanceof Frame); 367 final boolean isDialog = (target instanceof Dialog); 368 final boolean isPopup = (target.getType() == Window.Type.POPUP); 369 if (isDialog) { 370 styleBits = SET(styleBits, MINIMIZABLE, false); 371 } 372 373 // Either java.awt.Frame or java.awt.Dialog can be undecorated, however java.awt.Window always is undecorated. 374 { 375 this.undecorated = isFrame ? ((Frame)target).isUndecorated() : (isDialog ? ((Dialog)target).isUndecorated() : true); 376 if (this.undecorated) styleBits = SET(styleBits, DECORATED, false); 377 } 378 379 // Either java.awt.Frame or java.awt.Dialog can be resizable, however java.awt.Window is never resizable 380 { 381 final boolean resizable = isFrame ? ((Frame)target).isResizable() : (isDialog ? ((Dialog)target).isResizable() : false); 382 styleBits = SET(styleBits, RESIZABLE, resizable); 383 if (!resizable) { 384 styleBits = SET(styleBits, ZOOMABLE, false); 385 } 386 } 387 388 if (target.isAlwaysOnTop()) { 389 styleBits = SET(styleBits, ALWAYS_ON_TOP, true); 390 } 391 392 if (target.getModalExclusionType() == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) { 393 styleBits = SET(styleBits, MODAL_EXCLUDED, true); 394 } 395 396 // If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look. 397 if (isPopup) { 398 styleBits = SET(styleBits, TEXTURED, false); 399 // Popups in applets don't activate applet's process 400 styleBits = SET(styleBits, NONACTIVATING, true); 401 styleBits = SET(styleBits, IS_POPUP, true); 402 } 403 404 if (Window.Type.UTILITY.equals(target.getType())) { 669 CWrapper.NSWindow.NSWindowBelow, 670 blockerPtr); 671 }); 672 }); 673 } 674 this.visible = visible; 675 676 // Manage the extended state when showing 677 if (visible) { 678 // Apply the extended state as expected in shared code 679 if (target instanceof Frame) { 680 if (!wasMaximized && isMaximized()) { 681 // setVisible could have changed the native maximized state 682 deliverZoom(true); 683 } else { 684 int frameState = ((Frame)target).getExtendedState(); 685 if ((frameState & Frame.ICONIFIED) != 0) { 686 // Treat all state bit masks with ICONIFIED bit as ICONIFIED state. 687 frameState = Frame.ICONIFIED; 688 } 689 /* Frame should be set property WINDOW_FULLSCREENABLE to true if the 690 frame is resizable. 691 **/ 692 if (((Frame)target).isResizable()) { 693 setCanFullscreen(true); 694 } 695 696 switch (frameState) { 697 case Frame.ICONIFIED: 698 execute(CWrapper.NSWindow::miniaturize); 699 break; 700 case Frame.MAXIMIZED_BOTH: 701 maximize(); 702 break; 703 default: // NORMAL 704 unmaximize(); // in case it was maximized, otherwise this is a no-op 705 break; 706 } 707 } 708 } 709 } 710 711 nativeSynthesizeMouseEnteredExitedEvents(); 712 713 // Configure stuff #2 714 updateFocusabilityForAutoRequestFocus(true); 715 |