Java Code Examples for java.awt.Window#getOwnedWindows()

The following examples show how to use java.awt.Window#getOwnedWindows() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataTypeEditorsScreenShots.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Test
public void testDialog_Multiple_Match() throws Exception {

	positionListingTop(0x40D3B8);
	DropDownSelectionTextField<?> textField = showTypeChooserDialog();

	triggerText(textField, "undefined");

	DialogComponentProvider dialog = getDialog();
	JComponent component = dialog.getComponent();
	Window dataTypeDialog = windowForComponent(component);
	Window[] popUpWindows = dataTypeDialog.getOwnedWindows();

	List<Component> dataTypeWindows = new ArrayList<>(Arrays.asList(popUpWindows));
	dataTypeWindows.add(dataTypeDialog);

	captureComponents(dataTypeWindows);
	closeAllWindowsAndFrames();
}
 
Example 2
Source File: DataTypeEditorsScreenShots.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Test
public void testDialog_Single_Match() throws Exception {

	positionListingTop(0x40D3B8);
	DropDownSelectionTextField<?> textField = showTypeChooserDialog();
	triggerText(textField, "qword");

	DialogComponentProvider dialog = getDialog();
	JComponent component = dialog.getComponent();
	Window dataTypeDialog = windowForComponent(component);
	Window[] popUpWindows = dataTypeDialog.getOwnedWindows();

	List<Component> dataTypeWindows = new ArrayList<>(Arrays.asList(popUpWindows));
	dataTypeWindows.add(dataTypeDialog);

	captureComponents(dataTypeWindows);

}
 
Example 3
Source File: GUIBrowser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public WindowNode(Window win) {
    super(win);
    Window[] wns = win.getOwnedWindows();
    Vector<WindowNode> wwns = new Vector<>();
    for (Window wn : wns) {
        if (propDialog.showAll || wn.isVisible()) {
            wwns.add(new WindowNode(wn));
        }
    }
    wins = new WindowNode[wwns.size()];
    for (int i = 0; i < wwns.size(); i++) {
        wins[i] = wwns.get(i);
    }
    title = win.toString();
    clss = win.getClass().getName();
    BufferedImage image = null;
    try {
        image = new Robot().
                createScreenCapture(new Rectangle(win.getLocationOnScreen(),
                        win.getSize()));
    } catch (AWTException e) {
        e.printStackTrace();
    }
    setComponentImageProvider(new ComponentImageProvider(image, x, y));
}
 
Example 4
Source File: WindowWaiter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static Window getAWindow(Window owner, ComponentChooser cc) {
    if (owner == null) {
        return WindowWaiter.getAWindow(cc);
    } else {
        Window result = null;
        Window[] windows = owner.getOwnedWindows();
        for (Window window : windows) {
            if (cc.checkComponent(window)) {
                return window;
            }
            if ((result = WindowWaiter.getWindow(window, cc)) != null) {
                return result;
            }
        }
        return null;
    }
}
 
Example 5
Source File: AbstractDockingTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private static boolean isHierarchyShowing(Window w) {

		if (w.isShowing()) {
			return true;
		}

		Window[] children = w.getOwnedWindows();
		for (Window child : children) {
			if (child.isShowing()) {
				return true;
			}
		}

		return false;
	}
 
Example 6
Source File: AbstractDockingTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private static void windowToString(Window w, int depth, StringBuilder buffy) {

		String title = getDebugTitleForWindow(w);
		String prefix = StringUtils.repeat('\t', depth);
		String visibility = w.isShowing() ? "" : " (not showing)";
		String padded = prefix + title + visibility;
		buffy.append(padded).append('\n');

		Window[] children = w.getOwnedWindows();
		for (Window child : children) {
			windowToString(child, depth + 1, buffy);
		}
	}
 
Example 7
Source File: NotifyExcPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static boolean hasModalDialog(Window w) {
    if (w == null) { // #63830
        return false;
    }
    Window[] ws = w.getOwnedWindows();
    for(int i = 0; i < ws.length; i++) {
        if(ws[i] instanceof Dialog && ((Dialog)ws[i]).isModal() && ws[i].isVisible()) {
            return true;
        } else if(hasModalDialog(ws[i])) {
            return true;
        }
    }
    
    return false;
}
 
Example 8
Source File: DesktopProperty.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the UI of the passed in window and all its children.
 */
private static void updateWindowUI(Window window) {
    SwingUtilities.updateComponentTreeUI(window);
    Window[] ownedWins = window.getOwnedWindows();
    for (Window ownedWin : ownedWins) {
        updateWindowUI(ownedWin);
    }
}
 
Example 9
Source File: Test4319113.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void updateWindowTreeUI(Window window) {
    SwingUtilities.updateComponentTreeUI(window);
    Window[] arrwindow = window.getOwnedWindows();
    int n = arrwindow.length;
    while (--n >= 0) {
        Window window2 = arrwindow[n];
        if (!window2.isDisplayable()) continue;
        Test4319113.updateWindowTreeUI(window2);
    }
}
 
Example 10
Source File: BaseWindow.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * @param window The window to check.
 * @return {@code true} if an owned window is showing.
 */
public static boolean hasOwnedWindowsShowing(Window window) {
    if (window != null) {
        for (Window one : window.getOwnedWindows()) {
            if (one.isShowing() && one.getType() != Window.Type.POPUP) {
                return true;
            }
        }
    }
    return false;
}
 
Example 11
Source File: TaskDialog.java    From jeveassets with GNU General Public License v2.0 5 votes vote down vote up
private Window getTopWindow(Window in) {
	for (Window window : in.getOwnedWindows()) {
		if (window.isVisible()) {
			return getTopWindow(window);
		}
	}
	return in;
}