public void callPopupMenuItemOnSelectedCells(String menuPath) { int selectedRow = jTableOperator.getSelectedRow(); int selectedColumn = jTableOperator.getSelectedColumn(); JPopupMenuOperator menuOperator = new JPopupMenuOperator( jTableOperator.callPopupOnCell(selectedRow, selectedColumn)); JMenuItemOperator item = menuOperator.showMenuItem(menuPath, new EqualsStringComparator()); item.push(); }
/** * finds a specific item in all popupmenu items by text comparison, and * pushes the the relevant menu item. */ public void pushMenuItem(JPopupMenuOperator pp, String txt) throws Exception { final String lText = txt; pp.pushMenu(new String[] { lText }, new StringComparator() { public boolean equals(String caption, String match) { return caption.toLowerCase().startsWith(lText.toLowerCase()); } }); }
public JPopupMenu callPopupOnComponent(ComponentOperator componentOperator, Point pointToClick) { return JPopupMenuOperator.callPopup(componentOperator, pointToClick.x, pointToClick.y, Operator .getPopupMouseButton()); } }
new JPopupMenuOperator(runtimeTree.callPopupOnPath(path)).pushMenuNoBlock(addServerMenuItem);
private static Node performTomcatServerAction(String action) { Node asNode = getTomcatServerNode(); asNode.select(); new EventTool().waitNoEvent(10000); String serverIDEName = asNode.getText(); log("ServerNode name = "+serverIDEName); JPopupMenuOperator popup = asNode.callPopup(); if (popup == null) { throw new Error("Cannot get context menu for Tomcat server node "); } boolean startEnabled = popup.showMenuItem(action).isEnabled(); if(startEnabled) { popup.pushMenuNoBlock(action); } return asNode; }
@RobotKeyword("Selects an item from the tree node's popup menu and does not wait for a result.\n" + "Needed if the action starts a process that stays running (e.g. opens a dialog) and the above keyword doesn't return.\n" + "Separator for items is ``|``.\n\n" + "Example:\n" + "| `Select From Tree Node Popup Menu In Separate Thread` | myTree | Root|Folder | New Folder | ") @ArgumentNames({"identifier", "nodeIdentifier", "menuPath"}) public void selectFromTreeNodePopupMenuInSeparateThread(String identifier, String nodeIdentifier, String menuPath) { JPopupMenuOperator popupOperator = treeOperator(identifier).createPopupOperator(nodeIdentifier); popupOperator.pushMenuNoBlock(menuPath, new EqualsStringComparator()); }
JPopupMenuOperator wrapWithOperator(JPopupMenu popupMenu) { return new JPopupMenuOperator(popupMenu); }
@RobotKeyword("Gets item names from the components context popup menu.\n" + "Does a right click on the component and retrieves the specified menu items from the popup menu.\n\n" + "Example:\n" + "| @{items}= | `Get Menu Items From Popup Menu` | myComponent | Actions |\n" + "| `Should Contain` | ${items} | Do something |") @ArgumentNames({ "identifier", "menuPath" }) public List<String> getMenuItemsFromPopupMenu(final String identifier, final String menuPath) { JPopupMenuOperator popup = operator(identifier).invokePopup(); if (menuPath == null || "".equals(menuPath)) { return ComponentUtils.getParsedElements(popup.getSubElements()); } JMenuItemOperator subItem = popup.showMenuItem(menuPath); return subItem.getSubElements().length < 1 ? new ArrayList<String>() : ComponentUtils.getParsedElements(subItem.getSubElements()[0].getSubElements()); }
private JMenuItemOperator getPopupMenuItem(String identifier, String row, String columnIdentifier, String menuPath) { TableOperator tableOperator = createTableOperator(identifier); JPopupMenuOperator popupMenuOperator = tableOperator.callPopupOnCell(row, columnIdentifier); return popupMenuOperator.showMenuItem(menuPath, new EqualsStringComparator()); }
public JPopupMenuOperator createPopupOperator(JPopupMenu popupMenu) { JPopupMenuOperator popupMenuOperator = wrapWithOperator(popupMenu); popupMenuOperator.grabFocus(); SwingWaiter.waitToAvoidInstability(500); return popupMenuOperator; }
} catch (TimeoutExpiredException tee) { new JPopupMenuOperator(runtimeTree.callPopupOnPath(path)).pushMenuNoBlock(addServerMenuItem); NbDialogOperator addServerInstanceDialog = new NbDialogOperator(addServerInstanceDialogTitle); new JListOperator(addServerInstanceDialog, 1).selectItem(glassFishV3ListItem);
private static Node performTomcatServerAction(String action) { Node asNode = getTomcatServerNode(); asNode.select(); new EventTool().waitNoEvent(10000); String serverIDEName = asNode.getText(); log("ServerNode name = "+serverIDEName); JPopupMenuOperator popup = asNode.callPopup(); if (popup == null) { throw new Error("Cannot get context menu for Tomcat server node "); } boolean startEnabled = popup.showMenuItem(action).isEnabled(); if(startEnabled) { popup.pushMenuNoBlock(action); } return asNode; }
@RobotKeyword("Selects an item from the components context popup menu.\n" + "Does a right click on the component and selects the specified menu item from the popup menu.\n\n" + "Example:\n" + "| `Select From Popup Menu` | myComponent | Actions | Do something |\n") @ArgumentNames({ "identifier", "menuPath" }) public void selectFromPopupMenu(String identifier, String menuPath) { JPopupMenuOperator popup = operator(identifier).invokePopup(); popup.pushMenuNoBlock(menuPath, new EqualsStringComparator()); }
public JPopupMenuOperator callPopupOnCell(String row, String columnIdentifier) { Point coordinates = findCell(row, columnIdentifier); return new JPopupMenuOperator(jTableOperator.callPopupOnCell( coordinates.y, coordinates.x)); }
@RobotKeyword("Gets item names from the node context popup menu.\n" + "Clears earlier selections.\n" + "If several nodes have the same path then *only the first* menu item names of those nodes are returned.\n\n" + "Example:\n" + "| @{items}= | `Get Node Items From Tree Popup Menu` | myTree | Root|Folder | Actions |\n" + "| `Should Contain` | ${items} | Do something |") @ArgumentNames({"identifier", "nodeIdentifier", "menuPath"}) public List<String> getNodeItemsFromTreePopupMenu(String identifier, String nodeIdentifier, String menuPath) { JPopupMenuOperator popupMenuOperator = treeOperator(identifier).createPopupOperator(nodeIdentifier); if (menuPath == null || menuPath.isEmpty()) { return ComponentUtils.getParsedElements(popupMenuOperator.getSubElements()); } else { JMenuItemOperator subItem = popupMenuOperator.showMenuItem(menuPath); return subItem.getSubElements().length < 1 ? new ArrayList<String>() : ComponentUtils.getParsedElements(subItem.getSubElements()[0].getSubElements()); } }
/** * Invoke action on project node from popup menu * @param project * @param pushAction */ public static void actionOnProject(String project, String pushAction) { ProjectRootNode prn; try { prn = ProjectsTabOperator.invoke().getProjectRootNode(project); } catch (TimeoutExpiredException e) { prn = new ProjectsTabOperator().getProjectRootNode(project); } prn.callPopup().pushMenuNoBlock(pushAction); }
/** * Directly sends mouse events causing popup menu displaying to the selected * node. * <p> * Using Jemmy/Jelly to call popup can cause reselecting of node and more * events than is desirable for this case. * * @return JPopupMenuOperator instance */ @Override public ComponentOperator open() { /* it stopped to work after a while, see issue 58790 java.awt.Point p = dataObjectNode.tree().getPointToClick(dataObjectNode.getTreePath()); JPopupMenu menu = callPopup(dataObjectNode.tree(), p.x, p.y, java.awt.event.InputEvent.BUTTON3_MASK); return new JPopupMenuOperator(menu); */ java.awt.Point point = dataObjectNode.tree().getPointToClick(dataObjectNode.getTreePath()); int button = JTreeOperator.getPopupMouseButton(); dataObjectNode.tree().clickMouse(point.x, point.y, 1, button); return new JPopupMenuOperator(); }
@RobotKeyword("Selects an item from the tree node's popup menu.\n\n" + "Example:\n" + "| `Select From Tree Node Popup Menu` | myTree | Root|Folder | New Folder | ") @ArgumentNames({"identifier", "nodeIdentifier", "menuPath"}) public void selectFromTreeNodePopupMenu(String identifier, String nodeIdentifier, String menuPath) { JPopupMenuOperator popupOperator = treeOperator(identifier).createPopupOperator(nodeIdentifier); popupOperator.pushMenu(menuPath, new EqualsStringComparator()); }
/** * Invoke action on project node from popup menu * @param project * @param pushAction */ public static void actionOnProject(String project, String pushAction) { ProjectRootNode prn; try { prn = ProjectsTabOperator.invoke().getProjectRootNode(project); } catch (TimeoutExpiredException e) { prn = new ProjectsTabOperator().getProjectRootNode(project); } prn.callPopup().pushMenuNoBlock(pushAction); }
/** * Directly sends mouse events causing popup menu displaying to the selected * node. * <p> * Using Jemmy/Jelly to call popup can cause reselecting of node and more * events than is desirable for this case. * * @return JPopupMenuOperator instance */ @Override public ComponentOperator open() { /* it stopped to work after a while, see issue 58790 java.awt.Point p = dataObjectNode.tree().getPointToClick(dataObjectNode.getTreePath()); JPopupMenu menu = callPopup(dataObjectNode.tree(), p.x, p.y, java.awt.event.InputEvent.BUTTON3_MASK); return new JPopupMenuOperator(menu); */ java.awt.Point point = dataObjectNode.tree().getPointToClick(dataObjectNode.getTreePath()); int button = JTreeOperator.getPopupMouseButton(); dataObjectNode.tree().clickMouse(point.x, point.y, 1, button); return new JPopupMenuOperator(); }