Java Code Examples for org.netbeans.jemmy.operators.JTableOperator#getModel()
The following examples show how to use
org.netbeans.jemmy.operators.JTableOperator#getModel() .
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: KeyMapOperator.java From netbeans with Apache License 2.0 | 6 votes |
public boolean unassignAlternativeShortcutToAction(String actionName, String shortcutStr) { System.out.println("[TEST_DEBUG]"); System.out.println("[TEST_DEBUG] ### Unassigning alternative shortcut for " + actionName + " - Started"); String tmpStr = actionSearchByName().getText(); searchActionName(actionName); JTableOperator tab = actionsTable(); TableModel tm = tab.getModel(); String _str; System.out.println("[TEST_DEBUG] Found " + tab.getRowCount() + " actions matching action pattern: " + actionName); for (int i = 0; i < tab.getRowCount(); i++) { _str = tm.getValueAt(i, 0).toString(); System.out.println("[TEST_DEBUG] Examining action " + _str + ", which is no. " + (i + 1) + "in the table..."); if (_str.toLowerCase().startsWith(actionName.toLowerCase()) && tm.getValueAt(i, 1).toString().toLowerCase().equals(shortcutStr.toLowerCase())) { System.out.println("[TEST_DEBUG] Action " + actionName + "was found"); JListOperator jli = clickShortcutEllipsisButton(tab, i); jli.clickOnItem("Clear"); sleep(100); System.out.println("[TEST_DEBUG] ### Unassigning alternative shortcut for " + actionName + " - OK"); break; } } searchActionName(tmpStr); return true; }
Example 2
Source File: ProjectImporterTestCase.java From netbeans with Apache License 2.0 | 5 votes |
protected void selectProjectFromWS(WizardOperator wizz, String workspace, String projectToImport) { JTextFieldOperator txtWorkspaceLocation = new JTextFieldOperator(wizz, 0); String workspacePath = getDataDir().getAbsolutePath() + File.separatorChar + workspace; txtWorkspaceLocation.setText(workspacePath); wizz.next(); JTableOperator projectsTable = new JTableOperator(wizz); TableModel model = projectsTable.getModel(); selectProjectByName(model, projectToImport); }
Example 3
Source File: AbbreviationsAddRemovePerformer.java From netbeans with Apache License 2.0 | 5 votes |
public void testAllAbbrev() throws Exception { Abbreviations abbrevs = Abbreviations.invoke("Java"); JTableOperator templateTable = abbrevs.getTemplateTable(); TableModel model = templateTable.getModel(); for (int i = 0; i < model.getRowCount(); i++) { String abb = model.getValueAt(i, 0).toString(); String exp = model.getValueAt(i, 1).toString(); getRef().println(abb); getRef().println(exp); } abbrevs.ok(); }
Example 4
Source File: KeyMapOperator.java From netbeans with Apache License 2.0 | 5 votes |
private JListOperator clickShortcutEllipsisButton(JTableOperator tab, int row) { TableModel tm = tab.getModel(); TableCellRenderer cellRenderer = tab.getCellRenderer(row, 2); Rectangle cellRect = tab.getCellRect(row, 1, true); //org.netbeans.modules.options.keymap.ShortcutCellPanel sc = (org.netbeans.modules.options.keymap.ShortcutCellPanel) tm.getValueAt(row, 1); // final JButton button = sc.getButton(); // int x = button.getX() + button.getWidth() / 2; // int y = button.getY() + button.getHeight() / 2; Rectangle r = tab.getCellRect(row, 1, false); tab.clickMouse(r.x + r.width-3, r.y + (r.height/2), 1); System.out.println("[TEST_DEBUG] Pressed [...] button on row " + (row + 1)); return new JListOperator(new JPopupMenuOperator()); }
Example 5
Source File: KeyMapOperator.java From netbeans with Apache License 2.0 | 5 votes |
public boolean assignShortcutToAction(String actionName, boolean ctrl, boolean shift, boolean alt, int Key, boolean expectedAlreadyAssigned, boolean reassign) { System.out.println("[TEST_DEBUG]"); System.out.println("[TEST_DEBUG] ### Reassigning shortcut for " + actionName + " - Started"); int mask = buildKeyModifierMask(ctrl, alt, shift); String tmpStr = actionSearchByName().getText(); searchActionName(actionName); JTableOperator tab = actionsTable(); TableModel tm = tab.getModel(); String _str; System.out.println("[TEST_DEBUG] Found " + tab.getRowCount() + " actions matching action pattern: " + actionName); for (int i = 0; i < tab.getRowCount(); i++) { _str = tm.getValueAt(i, 0).toString(); System.out.println("[TEST_DEBUG] Examining action \"" + _str + "\", which is no. " + (i + 1) + " in the table..."); if (_str.toLowerCase().equals(actionName.toLowerCase())) { System.out.println("[TEST_DEBUG] -> action \"" + _str + "\" (" + actionName + ") was found"); sleep(100); tab.clickForEdit(i, 1); sleep(100); injectKeyBinding(tab, Key, mask); if (expectedAlreadyAssigned) { if (reassign) { new NbDialogOperator("Conflicting Shortcut Dialog").yes(); } else { new NbDialogOperator("Conflicting Shortcut Dialog").cancel(); } } sleep(100); break; } } searchActionName(tmpStr); System.out.println("[TEST_DEBUG] ### Reassigning shortcut for " + actionName + " - OK"); return true; }
Example 6
Source File: KeyMapOperator.java From netbeans with Apache License 2.0 | 5 votes |
public boolean assignAlternativeShortcutToAction(String actionName, boolean ctrl, boolean shift, boolean alt, int Key, boolean expectedAlreadyAssigned, boolean reassign) { boolean retval = false; System.out.println("[TEST_DEBUG]"); System.out.println("[TEST_DEBUG] ### Assigning alternative shortcut for " + actionName + " - Started"); int mask = buildKeyModifierMask(ctrl, alt, shift); String tmpStr = actionSearchByName().getText(); searchActionName(actionName); JTableOperator tab = actionsTable(); TableModel tm = tab.getModel(); String _str; System.out.println("[TEST_DEBUG] Found " + tab.getRowCount() + " actions matching action pattern: " + actionName); for (int i = 0; i < tab.getRowCount(); i++) { _str = tm.getValueAt(i, 0).toString(); System.out.println("[TEST_DEBUG] Examining action " + _str + ", which is no. " + (i + 1) + "in the table..."); if (_str.toLowerCase().equals(actionName.toLowerCase())) { System.out.println("[TEST_DEBUG] Action " + actionName + "was found"); JListOperator jli = clickShortcutEllipsisButton(tab, i); retval = true; try { jli.clickOnItem("Add Alternative"); } catch (Exception e) { retval = false; } sleep(100); injectKeyBinding(tab, Key, mask); if (expectedAlreadyAssigned) { if (reassign) { new NbDialogOperator("Conflicting Shortcut Dialog").yes(); } else { new NbDialogOperator("Conflicting Shortcut Dialog").cancel(); } } sleep(100); System.out.println("[TEST_DEBUG] ### Assigning alternative shortcut for " + actionName + " - OK"); break; } } searchActionName(tmpStr); return retval; }
Example 7
Source File: CommitUiTest.java From netbeans with Apache License 2.0 | 4 votes |
public void testInvokeCloseCommit() throws Exception { long timeout = JemmyProperties.getCurrentTimeout("ComponentOperator.WaitComponentTimeout"); try { if (TestKit.getOsName().indexOf("Mac") > -1) { NewProjectWizardOperator.invoke().close(); } TestKit.prepareGitProject(TestKit.PROJECT_CATEGORY, TestKit.PROJECT_TYPE, TestKit.PROJECT_NAME); new EventTool().waitNoEvent(2000); while (IndexingBridge.getInstance().isIndexingInProgress()) { Thread.sleep(3000); } TestKit.createNewElements(PROJECT_NAME, "xx", "NewClass"); new EventTool().waitNoEvent(1000); TestKit.createNewElement(PROJECT_NAME, "xx", "NewClass2"); new EventTool().waitNoEvent(1000); TestKit.createNewElement(PROJECT_NAME, "xx", "NewClass3"); new EventTool().waitNoEvent(1000); Node packNode = new Node(new SourcePackagesNode(PROJECT_NAME), "xx"); CommitOperator co = CommitOperator.invoke(packNode); new EventTool().waitNoEvent(2000); co.selectCommitAction("NewClass.java", "Commit"); new EventTool().waitNoEvent(500); co.selectCommitAction("NewClass.java", "Commit"); new EventTool().waitNoEvent(500); co.selectCommitAction("NewClass.java", "Exclude from Commit"); new EventTool().waitNoEvent(500); co.selectCommitAction(2, "Commit"); new EventTool().waitNoEvent(500); co.selectCommitAction(2, "Commit"); new EventTool().waitNoEvent(500); co.selectCommitAction(2, "Exclude from Commit"); new EventTool().waitNoEvent(500); JTableOperator table = co.tabFiles(); TableModel model = table.getModel(); String[] expected = {"NewClass.java", "NewClass2.java", "NewClass3.java"}; String[] actual = new String[model.getRowCount()]; for (int i = 0; i < model.getRowCount(); i++) { actual[i] = model.getValueAt(i, 1).toString(); } int result = TestKit.compareThem(expected, actual, false); assertEquals("Commit table doesn't contain all files!!!", expected.length, result); co.verify(); co.cancel(); TestKit.closeProject(PROJECT_NAME); } catch (Exception e) { TestKit.closeProject(PROJECT_NAME); throw new Exception("Test failed: " + e); } }
Example 8
Source File: CommitUiTest.java From netbeans with Apache License 2.0 | 4 votes |
public void testInvokeCloseCommit() throws Exception { // try { MessageHandler mh = new MessageHandler("Committing"); log.addHandler(mh); TestKit.closeProject(PROJECT_NAME); if (TestKit.getOsName().indexOf("Mac") > -1) new NewProjectWizardOperator().invoke().close(); new EventTool().waitNoEvent(3000); new File(TMP_PATH).mkdirs(); RepositoryMaintenance.deleteFolder(new File(TMP_PATH + File.separator + REPO_PATH)); System.out.println(TMP_PATH + File.separator + REPO_PATH +" , "+ getDataDir().getCanonicalPath() + File.separator + "repo_dump"); RepositoryMaintenance.createRepository(TMP_PATH + File.separator + REPO_PATH); RepositoryMaintenance.loadRepositoryFromFile(TMP_PATH + File.separator + REPO_PATH, getDataDir().getAbsolutePath() + File.separator + "repo_dump"); projectPath = TestKit.prepareProject("Java", "Java Application", PROJECT_NAME); ImportWizardOperator iwo = ImportWizardOperator.invoke(ProjectsTabOperator.invoke().getProjectRootNode(PROJECT_NAME)); new EventTool().waitNoEvent(3000); RepositoryStepOperator rso = new RepositoryStepOperator(); new EventTool().waitNoEvent(3000); //rso.verify(); rso.setRepositoryURL(RepositoryStepOperator.ITEM_FILE + RepositoryMaintenance.changeFileSeparator(TMP_PATH + File.separator + REPO_PATH, false)); new EventTool().waitNoEvent(3000); rso.next(); new EventTool().waitNoEvent(3000); FolderToImportStepOperator ftiso = new FolderToImportStepOperator(); ftiso.setRepositoryFolder("trunk/Import_" + PROJECT_NAME); new EventTool().waitNoEvent(1000); ftiso.setImportMessage("initial import"); new EventTool().waitNoEvent(1000); ftiso.next(); new EventTool().waitNoEvent(3000); CommitStepOperator cso = new CommitStepOperator(); cso.finish(); TestKit.waitText(mh); TestKit.createNewElements(PROJECT_NAME, "xx", "NewClass"); TestKit.createNewElement(PROJECT_NAME, "xx", "NewClass2"); TestKit.createNewElement(PROJECT_NAME, "xx", "NewClass3"); Node packNode = new Node(new SourcePackagesNode(PROJECT_NAME), "xx"); new EventTool().waitNoEvent(2000); CommitOperator co = CommitOperator.invoke(packNode); new EventTool().waitNoEvent(1000); co.selectCommitAction("NewClass.java", "Add As Text"); co.selectCommitAction("NewClass.java", "Add As Binary"); co.selectCommitAction("NewClass.java", "Exclude from Commit"); co.selectCommitAction(2, "Add As Text"); // co.selectCommitAction(2, "Add As Binary"); co.selectCommitAction(2, "Exclude from Commit"); JTableOperator table = co.tabFiles(); TableModel model = table.getModel(); String[] expected = {"xx", "NewClass.java", "NewClass2.java", "NewClass3.java"}; String[] actual = new String[model.getRowCount()]; for (int i = 0; i < model.getRowCount(); i++) { actual[i] = model.getValueAt(i, 1).toString(); } int result = TestKit.compareThem(expected, actual, false); assertEquals("Commit table doesn't contain all files!!!", expected.length, result); co.verify(); co.cancel(); // } catch (Exception e) { // throw new Exception("Test failed: " + e); // } finally { TestKit.closeProject(PROJECT_NAME); // } }
Example 9
Source File: ImportUITest.java From netbeans with Apache License 2.0 | 4 votes |
public void testCommitStep() throws Exception { MessageHandler mh = new MessageHandler("Committing"); log.addHandler(mh); // TestKit.showStatusLabels(); TestKit.closeProject(PROJECT_NAME); if (TestKit.getOsName().indexOf("Mac") > -1) { new NewProjectWizardOperator().invoke().close(); } new EventTool().waitNoEvent(2000); new File(TMP_PATH).mkdirs(); RepositoryMaintenance.deleteFolder(new File(TMP_PATH + File.separator + REPO_PATH)); RepositoryMaintenance.createRepository(TMP_PATH + File.separator + REPO_PATH); RepositoryMaintenance.loadRepositoryFromFile(TMP_PATH + File.separator + REPO_PATH, getDataDir().getCanonicalPath() + File.separator + "repo_dump"); projectPath = TestKit.prepareProject("Java", "Java Application", PROJECT_NAME); comOperator = new Operator.DefaultStringComparator(true, true); oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator(); Node node = new ProjectsTabOperator().getProjectRootNode(PROJECT_NAME); Operator.setDefaultStringComparator(comOperator); new EventTool().waitNoEvent(2000); ImportWizardOperator iwo = ImportWizardOperator.invoke(node); Operator.setDefaultStringComparator(oldOperator); new EventTool().waitNoEvent(2000); RepositoryStepOperator rso = new RepositoryStepOperator(); //rso.verify(); new EventTool().waitNoEvent(3000); rso.setRepositoryURL(RepositoryStepOperator.ITEM_FILE + RepositoryMaintenance.changeFileSeparator(TMP_PATH + File.separator + REPO_PATH, false)); rso.next(); new EventTool().waitNoEvent(2000); FolderToImportStepOperator ftiso = new FolderToImportStepOperator(); ftiso.setRepositoryFolder("trunk/Import" + PROJECT_NAME); ftiso.setImportMessage("initial import"); ftiso.next(); new EventTool().waitNoEvent(2000); CommitStepOperator cso = new CommitStepOperator(); cso.verify(); new EventTool().waitNoEvent(2000); JTableOperator table = cso.tabFiles(); TableModel model = table.getModel(); new EventTool().waitNoEvent(2000); String[] expected = {"genfiles.properties", "build-impl.xml", "JavaApp.java", "manifest.mf", "src", "project.xml", PROJECT_NAME.toLowerCase(), "nbproject", "project.properties", "test", "build.xml"}; String[] actual = new String[model.getRowCount()]; for (int i = 0; i < actual.length; i++) { actual[i] = model.getValueAt(i, 1).toString(); } assertEquals("Incorrect count of records for addition!!!", 10, model.getRowCount()); // assertEquals("Some records were omitted from addition", 10, TestKit.compareThem(expected, actual, false)); //try to change commit actions cso.selectCommitAction("project.xml", "Add As Text"); cso.selectCommitAction("project.xml", "Add As Binary"); cso.selectCommitAction("project.xml", "Exclude from Commit"); //cso.selectCommitAction("test", "Exclude Recursively"); //cso.selectCommitAction("test", "Include Recursively"); iwo.cancel(); TestKit.closeProject(PROJECT_NAME); }
Example 10
Source File: KeyMapOperator.java From netbeans with Apache License 2.0 | 4 votes |
public TableModel getActionsTableModel() { JTableOperator tab = actionsTable(); return tab.getModel(); }
Example 11
Source File: CommitUiTest.java From netbeans with Apache License 2.0 | 4 votes |
public void testInvokeCloseCommit() throws Exception { long timeout = JemmyProperties.getCurrentTimeout("ComponentOperator.WaitComponentTimeout"); // try { // JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 30000); // } finally { // JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", timeout); // } // // timeout = JemmyProperties.getCurrentTimeout("DialogWaiter.WaitDialogTimeout"); // try { // JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 30000); // } finally { // JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", timeout); // } try { if (TestKit.getOsName().indexOf("Mac") > -1) NewProjectWizardOperator.invoke().close(); TestKit.loadOpenProject(PROJECT_NAME, getDataDir()); new EventTool().waitNoEvent(3000); TestKit.createNewElements(PROJECT_NAME, "xx", "NewClass"); TestKit.createNewElement(PROJECT_NAME, "xx", "NewClass2"); TestKit.createNewElement(PROJECT_NAME, "xx", "NewClass3"); Node packNode = new Node(new SourcePackagesNode(PROJECT_NAME), "xx"); CommitOperator co = CommitOperator.invoke(packNode); new EventTool().waitNoEvent(2000); co.selectCommitAction("NewClass.java", "Commit"); new EventTool().waitNoEvent(500); co.selectCommitAction("NewClass.java", "Commit"); new EventTool().waitNoEvent(500); co.selectCommitAction("NewClass.java", "Exclude from Commit"); new EventTool().waitNoEvent(500); co.selectCommitAction(2, "Commit"); new EventTool().waitNoEvent(500); co.selectCommitAction(2, "Commit"); new EventTool().waitNoEvent(500); co.selectCommitAction(2, "Exclude from Commit"); new EventTool().waitNoEvent(500); JTableOperator table = co.tabFiles(); TableModel model = table.getModel(); String[] expected = {"NewClass.java", "NewClass2.java", "NewClass3.java"}; String[] actual = new String[model.getRowCount()]; for (int i = 0; i < model.getRowCount(); i++) { actual[i] = model.getValueAt(i, 0).toString(); } int result = TestKit.compareThem(expected, actual, false); assertEquals("Commit table doesn't contain all files!!!", expected.length, result); co.verify(); co.cancel(); //TestKit.removeAllData(PROJECT_NAME); TestKit.closeProject(PROJECT_NAME); } catch (Exception e) { TestKit.closeProject(PROJECT_NAME); throw new Exception("Test failed: " + e); } }