Java Code Examples for org.netbeans.jemmy.operators.JPopupMenuOperator#waitState()

The following examples show how to use org.netbeans.jemmy.operators.JPopupMenuOperator#waitState() . 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: Utilities.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static boolean verifyPopup(final JPopupMenuOperator popup, String[] menus) {
    for (int i = 0; i < menus.length; i++) {
        try {
            popup.showMenuItem(menus[i]);
        } catch (NullPointerException npe) {
            throw new JemmyException("Popup path [" + menus[i] + "] not found.");
        }
    }
    //close popup and wait until is not visible
    popup.waitState(new ComponentChooser() {

        public boolean checkComponent(Component comp) {
            popup.pushKey(KeyEvent.VK_ESCAPE);
            return !popup.isVisible();
        }

        public String getDescription() {
            return "Popup menu closed";
        }
    });
    return true;
}
 
Example 2
Source File: Node.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * verifies node's popup paths for presence (without invocation)
 *
 * @param popupPaths String[] popup paths
 */
public void verifyPopup(String[] popupPaths) {
    //invocation of root popup
    final JPopupMenuOperator popup = callPopup();
    for (int i = 0; i < popupPaths.length; i++) {
        try {
            popup.showMenuItem(popupPaths[i], "|");
        } catch (NullPointerException npe) {
            throw new JemmyException("Popup path [" + popupPaths[i] + "] not found.");
        }
    }
    //close popup and wait until is not visible
    popup.waitState(new ComponentChooser() {

        @Override
        public boolean checkComponent(Component comp) {
            popup.pushKey(KeyEvent.VK_ESCAPE);
            return !popup.isVisible();
        }

        @Override
        public String getDescription() {
            return "Popup menu closed";
        }
    });
}