/** Removes a desktop from this context */ public void removeDesktop(DockingDesktop desktop) { desktops.remove(desktop); // time to check if some windows should be removed as not ancestors of remaining desktops Iterator it = ownedWindowActivationOrder.iterator(); while(it.hasNext()) { Window w = (Window) it.next(); boolean ancestor = false; for(int i = 0; i < desktops.size(); i++) { DockingDesktop desk = (DockingDesktop) desktops.get(i); if(w.isAncestorOf(desk)) { ancestor = true; break; } } if(! ancestor) { // this window isn't an ancestor of any managed desktops : we drop it it.remove(); } } }
/** * Returns whether the given component is "actively" shown in screen, that is, * it or any of its ancestors is focused. * * @param aComponent * the component to determine whether it is actively shown on screen, * may be <code>null</code>. * @return <code>true</code> if the given component is actively shown, * <code>false</code> otherwise. */ public static final boolean isActivelyShown( final Component aComponent ) { final KeyboardFocusManager kbdFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); final Window owner = kbdFocusManager.getFocusedWindow(); return ( ( aComponent != null ) && ( owner != null ) && ( ( owner == aComponent ) || owner .isAncestorOf( aComponent ) ) ); }
@Override public void run() { Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); //in Java 1.5+ KeyboardFocusManager.getActiveWindow() may return null if (null != w && w.isAncestorOf(ComboInplaceEditor.this)) { if (isShowing() && !isPopupVisible()) { log("Popup checker ensuring editor prepared or popup visible"); if (isEditable()) { prepareEditor(); } showPopup(); } checker = null; } } }
public void run() { Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); if (w.isAncestorOf(ComboInplaceEditor.this)) { if (isShowing() && !isPopupVisible()) { log ("Popup checker ensuring editor prepared or popup visible"); if (isEditable()) { prepareEditor(); } else { showPopup(); } } checker = null; } } }
public void run() { Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); if (w.isAncestorOf(ComboInplaceEditor.this)) { if (isShowing() && !isPopupVisible()) { log ("Popup checker ensuring editor prepared or popup visible"); if (isEditable()) { prepareEditor(); } else { showPopup(); } } checker = null; } } }
protected void handleWindowEvent(WindowEvent e) { Component owner = getActualOwner(); if (e.getSource() != getTopLevelAncestor() && e.getWindow() != null && (e.getWindow() == owner || e.getWindow().isAncestorOf(owner))) { // check if it's embedded in browser if (e.getID() == WindowEvent.WINDOW_CLOSING || e.getID() == WindowEvent.WINDOW_ICONIFIED) { hidePopup(true);