Java Code Examples for org.netbeans.jemmy.operators.JTextFieldOperator#clearText()

The following examples show how to use org.netbeans.jemmy.operators.JTextFieldOperator#clearText() . 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: NewFileWizardsTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void puTest(String prjRoot, String name) throws Exception {
    Project p = J2eeProjectSupport.getProject(new File(projectLocation), prjRoot);
    NewFileWizardOperator nfwo = WizardUtils.createNewFile(p,
            "Persistence", "Persistence Unit");
    JTextFieldOperator jtfo = new JTextFieldOperator(nfwo, 0);
    jtfo.clearText();
    jtfo.typeText(name);
    JComboBoxOperator jcbo = new JComboBoxOperator(nfwo, 1);
    jcbo.selectItem("jdbc/sample");
    nfwo.finish();
    nfwo.waitClosed();
    List<File> files = new ArrayList<File>();
    File prjDir = new File(new File(projectLocation), prjRoot).getCanonicalFile();
    files.add(new File(prjDir, "src/conf/persistence.xml"));
    checkFiles(files);
}
 
Example 2
Source File: GeneralPHP.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void setPHPIndentation(int initialIndentation, int contIndentation, int arrayDeclarationIndentation) {
    JDialogOperator window = selectPHPFromEditorOptions(1, getPlatform());

    //categories - check if they are all present
    JComboBoxOperator category = new JComboBoxOperator(window, 1);
    category.selectItem("Tabs And Indents");

    JTextFieldOperator initialIndentTextField = new JTextFieldOperator(window, 1);
    initialIndentTextField.clearText();
    initialIndentTextField.enterText(
            String.valueOf(initialIndentation));

    JTextFieldOperator contIndentTextField = new JTextFieldOperator(window, 2);
    contIndentTextField.clearText();
    contIndentTextField.enterText(
            String.valueOf(contIndentation));

    JTextFieldOperator arrayDeclarationIndentTextField = new JTextFieldOperator(window, 1);
    arrayDeclarationIndentTextField.clearText();
    arrayDeclarationIndentTextField.enterText(
            String.valueOf(arrayDeclarationIndentation));


}
 
Example 3
Source File: TestUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Use New Project wizard to generate FX project of given type and name.
 * 
 * @param projectType
 * @param projectName
 * @param workDirPath 
 */
public static void createJavaFX2Project(String projectType, String projectName, String workDirPath) {
    NewProjectWizardOperator npwop = NewProjectWizardOperator.invoke();
    npwop.selectCategory(JAVAFX_PROJECT_CATEGORY);
    npwop.selectProject(projectType);
    npwop.next();

    new EventTool().waitNoEvent(2000);

    JTextFieldOperator projectNameField = new JTextFieldOperator(npwop, 0);
    projectNameField.clearText();
    projectNameField.typeText(projectName);

    JTextFieldOperator projectLocation = new JTextFieldOperator(npwop, 1);
    projectLocation.clearText();
    projectLocation.typeText(workDirPath + File.separator
            + Calendar.getInstance().getTimeInMillis());

    new EventTool().waitNoEvent(2000);

    npwop.finish();

    new EventTool().waitNoEvent(5000); //wait for complete project creation, nodes it Projects View must be populated
}
 
Example 4
Source File: TestUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static void createJavaFX2FXMLFile(String fileType, String projectName, String fileName) {
    NewFileWizardOperator nfwo = newJavaFX2FileTemplateSelection(fileType, projectName);
    //fxml name
    JTextFieldOperator fxmlName = new JTextFieldOperator(nfwo, 0);
    fxmlName.clearText();
    fxmlName.typeText(fileName);
    nfwo.next();
    //fxml controller        
    JCheckBoxOperator useCtrlr = new JCheckBoxOperator(nfwo, 0);
    useCtrlr.clickMouse();
    nfwo.next();
    //fxml css
    JCheckBoxOperator useCSS = new JCheckBoxOperator(nfwo, 0);
    useCSS.clickMouse();
    nfwo.finish();

    new EventTool().waitNoEvent(2000);
}
 
Example 5
Source File: Utilities.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** 
 * This method create new Java Application project
 */

public static String createNewProject(String projectName, String dataProjectName, String workdirpath){
    NewProjectWizardOperator nfwo = NewProjectWizardOperator.invoke();
    nfwo.selectCategory(projectName);
    nfwo.selectProject("Java Application");
    nfwo.next();
    
    JTextFieldOperator tfo_name = new JTextFieldOperator(nfwo, 0);
    tfo_name.clearText();
    tfo_name.typeText(dataProjectName);
    
    JTextFieldOperator tfo1_location = new JTextFieldOperator(nfwo, 1);
    
    tfo1_location.clearText();
    tfo1_location.typeText(workdirpath);
    
    JButtonOperator bo = new JButtonOperator(nfwo, "Finish");
    //bo.getSource().requestFocus();
    bo.push();
    return dataProjectName;
}
 
Example 6
Source File: SetUpDerbyDatabaseTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Sets db server path and database folder path */
public void testSetupDbPaths() {
    String derbyHomeDirPath = null;
    String dbDirPath = null;
    
    try {
        derbyHomeDirPath = getDerbyHomeDir();
        dbDirPath = getTempDerbyDbDir();
    } catch (Exception e){
        fail(e.getMessage());
    }
    
    if (derbyHomeDirPath != null && dbDirPath != null) {
        // invoke and catch db settings dialog
        new ActionNoBlock(DB_SETTINGS_MENU, null).perform(); // NOI18N
        DialogOperator op = new DialogOperator(DB_SETTINGS_DIALOG_TITLE);
        
        // setup derby db home 
        JTextFieldOperator derbyHomeOp = new JTextFieldOperator(op,1);
        derbyHomeOp.clearText();
        derbyHomeOp.typeText(derbyHomeDirPath);
        
        // setup database folder
        JTextFieldOperator dbPathOp = new JTextFieldOperator(op,0);
        dbPathOp.clearText();
        dbPathOp.typeText(dbDirPath);
        
        // close settings dialog
        new JButtonOperator(op,"OK").clickMouse(); // NOI18N
    }
}
 
Example 7
Source File: CreateNewIndexedProperty.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** testType method */
public void testType() {
    RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
    
    Node repositoryRootNode = explorerOperator.getRootNode();
    Node patternsNode = new Node(repositoryRootNode, sampleDir+"|"+NAME_TEST_FILE+"|"+"class "+NAME_TEST_FILE+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "Patterns"));
    patternsNode.select();
    patternsNode.performPopupActionNoBlock(Bundle.getString("org.openide.src.nodes.Bundle", "LAB_Add")+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "MENU_CREATE_IDXPROPERTY"));
    String dialogTitle = Bundle.getString("org.netbeans.modules.beans.Bundle", "CTL_TITLE_NewIdxProperty");
    NbDialogOperator nbDialogOperator = new NbDialogOperator(dialogTitle);

    JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);       
    jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);        
    
    JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
    jComboBoxOperator.typeText(TYPE_WRONG);
    
    nbDialogOperator.ok();

    new EventTool().waitNoEvent(3000);

    new NbDialogOperator("Error").ok();
                          
    jTextFieldOperator.clearText();
    jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
    jComboBoxOperator.clearText();
    jComboBoxOperator.setSelectedItem("Double");
                   
    nbDialogOperator.ok();

    new JavaNode(repositoryRootNode, sampleDir + "|" + NAME_TEST_FILE).open();

    EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
    ref(eo.getText());
    compareReferenceFiles();                       
}
 
Example 8
Source File: CreateNewNonIndexedProperty.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** testName method */
public void testName() {
    RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
    
    Node repositoryRootNode = explorerOperator.getRootNode();
    Node patternsNode = new Node(repositoryRootNode, sampleDir+"|"+NAME_TEST_FILE+"|"+"class "+NAME_TEST_FILE+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "Patterns"));
    patternsNode.select();
    patternsNode.performPopupActionNoBlock(Bundle.getString("org.openide.src.nodes.Bundle", "LAB_Add")+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "MENU_CREATE_PROPERTY"));
    String dialogTitle = Bundle.getString("org.netbeans.modules.beans.Bundle", "CTL_TITLE_NewProperty");
    NbDialogOperator nbDialogOperator = new NbDialogOperator(dialogTitle);

    JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);       
    jTextFieldOperator.typeText(NAME_WRONG);        

    JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
    jComboBoxOperator.setSelectedItem("String");
    
    nbDialogOperator.ok();

    new EventTool().waitNoEvent(3000);

    new NbDialogOperator("Error").ok();
                          
    jTextFieldOperator.clearText();
    jTextFieldOperator.typeText(NAME_NON_INDEX_PROPERTY);
    
    jComboBoxOperator.setSelectedItem("String");
                   
    nbDialogOperator.ok();

    new JavaNode(repositoryRootNode, sampleDir + "|" + NAME_TEST_FILE).open();

    EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
    ref(eo.getText());
    compareReferenceFiles();                               
}
 
Example 9
Source File: CreateNewNonIndexedProperty.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** testType method */ 
public void testType() {

    RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
    
    
    Node repositoryRootNode = explorerOperator.getRootNode();
    Node patternsNode = new Node(repositoryRootNode, sampleDir+"|"+NAME_TEST_FILE+"|"+"class "+NAME_TEST_FILE+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "Patterns"));
    patternsNode.select();
    patternsNode.performPopupActionNoBlock(Bundle.getString("org.openide.src.nodes.Bundle", "LAB_Add")+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "MENU_CREATE_PROPERTY"));
    String dialogTitle = Bundle.getString("org.netbeans.modules.beans.Bundle", "CTL_TITLE_NewProperty");
    NbDialogOperator nbDialogOperator = new NbDialogOperator(dialogTitle);

    JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);       
    jTextFieldOperator.typeText(NAME_NON_INDEX_PROPERTY);
    
    JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
    jComboBoxOperator.typeText(TYPE_WRONG);
    nbDialogOperator.ok();

    new EventTool().waitNoEvent(3000);
    new NbDialogOperator("Error").ok();

    jTextFieldOperator.clearText();
    jTextFieldOperator.typeText(NAME_NON_INDEX_PROPERTY);
    jComboBoxOperator.clearText();
    jComboBoxOperator.setSelectedItem("Double");
                   
    nbDialogOperator.ok();
    new JavaNode(repositoryRootNode, sampleDir + "|" + NAME_TEST_FILE).open();

    EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
    ref(eo.getText());
    compareReferenceFiles();                               
                                   
}
 
Example 10
Source File: WizardsTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Test new project wizard using generic WizardOperator. */
public void testGenericWizards() {
    // open new project wizard
    NewProjectWizardOperator npwo = NewProjectWizardOperator.invoke();
    npwo.selectCategory("Java Web");
    npwo.selectProject("Web Application");
    npwo.next();
    // create operator for next page
    WizardOperator wo = new WizardOperator("Web Application");
    JTextFieldOperator txtName = new JTextFieldOperator((JTextField) new JLabelOperator(wo, "Project Name:").getLabelFor());
    txtName.clearText();
    txtName.typeText("MyApp");
    wo.cancel();
}
 
Example 11
Source File: TestUtils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void createJavaFX2File(String fileType, String projectName, String fileName) {
    NewFileWizardOperator nfwo = newJavaFX2FileTemplateSelection(fileType, projectName);

    JTextFieldOperator fileNameField = new JTextFieldOperator(nfwo, 0);
    fileNameField.clearText();
    fileNameField.typeText(fileName);

    nfwo.finish();

    new EventTool().waitNoEvent(2000);        
}
 
Example 12
Source File: RefactoringRename.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ComponentOperator open(){
        String rename_to, rename_from = rename;
        
        // jEdit project
        log("Opening project jEdit");
        ProjectsTabOperator.invoke();
        CommonUtilities.waitProjectOpenedScanFinished(System.getProperty("xtest.tmpdir")+ java.io.File.separator +"jEdit41");
        CommonUtilities.waitForPendingBackgroundTasks();
        
        // find existing node
        Node packagenode = new Node(new SourcePackagesNode("jEdit"), "org.gjt.sp.jedit");
        String[] children = packagenode.getChildren();
        for(int i=0; i<children.length; i++) {
            if(children[i].startsWith(rename)){
                rename_from = children[i];
                break;
            }
        }
        
        log(" Trying to rename file "+rename_from);
        
        //generate name for new node
/*        String number = "1";
        if(rename_from.equalsIgnoreCase(rename+".java")) {
            rename_to = rename + number;
        } else {
            number = rename_from.substring(rename.length(),rename_from.indexOf('.'));
            rename_to = rename + (Integer.parseInt(number) + 1);
        }
*/
	rename_to=rename+CommonUtilities.getTimeIndex();
        
        // invoke Rename
        Node filenode = new Node(packagenode, rename_from);
        filenode.callPopup().pushMenuNoBlock("Refactor|Rename..."); // NOI18N
        NbDialogOperator renamedialog = new NbDialogOperator("Rename "); // NOI18N
        JTextFieldOperator txtfNewName = new JTextFieldOperator(renamedialog);
        JButtonOperator btnRefactor = new JButtonOperator(renamedialog,"Refactor"); // NOI18N
        
        // if the project exists, try to generate new name
        rename_to = rename_to+"1";
        log("    ... rename to  " + rename_to);
        txtfNewName.clearText();
        txtfNewName.typeText(rename_to);
        
        new JCheckBoxOperator(renamedialog,"Apply Rename on Comments").changeSelection(true); // NOI18N
        btnRefactor.push();
        
        MainWindowOperator.getDefault().waitStatusText("Save All finished"); // NOI18N
        
        rename_to = rename_from;
	return null;
    }
 
Example 13
Source File: OptionPaneDemoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void showComponentDialog(JFrameOperator jfo) throws Exception {
    // Case: Cancel
    callADialogAndClose(jfo, COMPONENT_BUTTON, COMPONENT_TITLE, COMPONENT_OP5);
    //TODO: wait for no dialog displayed

    // Case: Yes option selected
    {
        callADialogAndClose(jfo, COMPONENT_BUTTON, COMPONENT_TITLE, COMPONENT_OP1);
        checkMessage(COMPONENT_R1);
    }

    // Case: No option selected
    {
        callADialogAndClose(jfo, COMPONENT_BUTTON, COMPONENT_TITLE, COMPONENT_OP2);
        checkMessage(COMPONENT_R2);
    }

    // Case: Maybe option selected
    {
        callADialogAndClose(jfo, COMPONENT_BUTTON, COMPONENT_TITLE, COMPONENT_OP3);
        checkMessage(COMPONENT_R3);
    }

    // Case: Probably option selected
    {
        callADialogAndClose(jfo, COMPONENT_BUTTON, COMPONENT_TITLE, COMPONENT_OP4);
        checkMessage(COMPONENT_R4);
    }

    // Case TextField and ComboBox functional
    {
        new JButtonOperator(jfo, COMPONENT_BUTTON).push();

        JDialogOperator jdo = new JDialogOperator(COMPONENT_TITLE);

        JTextFieldOperator jto = new JTextFieldOperator(jdo);
        jto.clearText();
        jto.typeText(TEXT_TO_TYPE);
        jto.waitText(TEXT_TO_TYPE);

        JComboBoxOperator jcbo = new JComboBoxOperator(jdo);
        jcbo.selectItem(2);
        jcbo.waitItemSelected(2);

        new JButtonOperator(jdo, COMPONENT_OP5).push();
        jdo.waitClosed();
        //TODO: wait for no dialog displayed
    }
}
 
Example 14
Source File: CreateNewIndexedProperty.java    From netbeans with Apache License 2.0 3 votes vote down vote up
/** testName method */
public void testName() {
    RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
    
    Node repositoryRootNode = explorerOperator.getRootNode();
    Node patternsNode = new Node(repositoryRootNode, sampleDir+"|"+NAME_TEST_FILE+"|"+"class "+NAME_TEST_FILE+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "Patterns"));
    patternsNode.select();
    patternsNode.performPopupActionNoBlock(Bundle.getString("org.openide.src.nodes.Bundle", "LAB_Add")+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "MENU_CREATE_IDXPROPERTY"));
    String dialogTitle = Bundle.getString("org.netbeans.modules.beans.Bundle", "CTL_TITLE_NewIdxProperty");
    NbDialogOperator nbDialogOperator = new NbDialogOperator(dialogTitle);
    JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);

   
    jTextFieldOperator.typeText(NAME_WRONG);        
    
    JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
    jComboBoxOperator.setSelectedItem("String");
    
    nbDialogOperator.ok();

    new EventTool().waitNoEvent(3000);

    new NbDialogOperator("Error").ok();
                          
    jTextFieldOperator.clearText();
    jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
    
    jComboBoxOperator.setSelectedItem("String");
                   
    nbDialogOperator.ok();

    new JavaNode(repositoryRootNode, sampleDir + "|" + NAME_TEST_FILE).open();

    EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
    ref(eo.getText());
    compareReferenceFiles();               
}