private static boolean isWindowTextured(final Component c) { if (!(c instanceof JComponent)) { return false; } final JRootPane pane = ((JComponent) c).getRootPane(); if (pane == null) { return false; } Object prop = pane.getClientProperty(CPlatformWindow.WINDOW_BRUSH_METAL_LOOK); if (prop != null) { return Boolean.parseBoolean(prop.toString()); } prop = pane.getClientProperty(CPlatformWindow.WINDOW_STYLE); return prop != null && "textured".equals(prop); }
private boolean couldBeInFullScreen() { if (myParent instanceof JFrame) { JRootPane rootPane = ((JFrame) myParent).getRootPane(); return rootPane.getClientProperty(MacMainFrameDecorator.FULL_SCREEN) == null; } return false; }
private static boolean isHintsAllowed(Window window) { if (window instanceof RootPaneContainer) { final JRootPane pane = ((RootPaneContainer) window).getRootPane(); if (pane != null) { return Boolean.TRUE.equals(pane.getClientProperty(AbstractPopup.SHOW_HINTS)); } } return false; }
private static Window pop(Window owner) { JRootPane root = getRootPane(owner); if (root != null) { synchronized (CACHE) { @SuppressWarnings("unchecked") ArrayDeque<Window> cache = (ArrayDeque<Window>) root.getClientProperty(CACHE); if (cache != null && !cache.isEmpty()) { return cache.pop(); } } } return null; }
private static boolean push(Window owner, Window window) { JRootPane root = getRootPane(owner); if (root != null) { synchronized (CACHE) { @SuppressWarnings("unchecked") ArrayDeque<Window> cache = (ArrayDeque<Window>) root.getClientProperty(CACHE); if (cache == null) { cache = new ArrayDeque<Window>(); root.putClientProperty(CACHE, cache); } cache.push(window); return true; } } return false; }
@Nullable public static Component getOwner(@Nullable Component c) { if (c == null) return null; final Window wnd = SwingUtilities.getWindowAncestor(c); if (wnd instanceof JWindow) { final JRootPane root = ((JWindow) wnd).getRootPane(); final JBPopup popup = (JBPopup) root.getClientProperty(JBPopup.KEY); if (popup == null) return c; final Component owner = popup.getOwner(); if (owner == null) return c; return getOwner(owner); } else { return c; } }