当前位置: 首页>>代码示例>>Java>>正文


Java JTableOperator.getModel方法代码示例

本文整理汇总了Java中org.netbeans.jemmy.operators.JTableOperator.getModel方法的典型用法代码示例。如果您正苦于以下问题:Java JTableOperator.getModel方法的具体用法?Java JTableOperator.getModel怎么用?Java JTableOperator.getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.jemmy.operators.JTableOperator的用法示例。


在下文中一共展示了JTableOperator.getModel方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unassignAlternativeShortcutToAction

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:KeyMapOperator.java

示例2: testAllAbbrev

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:AbbreviationsAddRemovePerformer.java

示例3: clickShortcutEllipsisButton

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
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());
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:KeyMapOperator.java

示例4: assignShortcutToAction

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:KeyMapOperator.java

示例5: assignAlternativeShortcutToAction

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:KeyMapOperator.java

示例6: selectProjectFromWS

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ProjectImporterTestCase.java

示例7: testInvokeCloseCommit

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:55,代码来源:CommitUiTest.java

示例8: testInvokeCloseCommit

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
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);
       // }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:76,代码来源:CommitUiTest.java

示例9: testCommitStep

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
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);

    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:65,代码来源:ImportUITest.java

示例10: getActionsTableModel

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
public TableModel getActionsTableModel() {
    JTableOperator tab = actionsTable();
    return tab.getModel();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:KeyMapOperator.java

示例11: testInvokeCloseCommit

import org.netbeans.jemmy.operators.JTableOperator; //导入方法依赖的package包/类
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);
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:61,代码来源:CommitUiTest.java


注:本文中的org.netbeans.jemmy.operators.JTableOperator.getModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。