Java Code Examples for javax.swing.JCheckBox#doClick()

The following examples show how to use javax.swing.JCheckBox#doClick() . 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: EnableApiTask.java    From IBC with GNU General Public License v3.0 6 votes vote down vote up
@Override public void run() {
    try {
        Utils.logToConsole("Doing ENABLEAPI configuration");
        
        if (!Utils.selectConfigSection(configDialog, new String[] {"API","Settings"}))
            // older versions of TWS don't have the Settings node below the API node
            Utils.selectConfigSection(configDialog, new String[] {"API"});

        JCheckBox cb = SwingUtils.findCheckBox(configDialog, "Enable ActiveX and Socket Clients");
        if (cb == null) throw new IbcException("could not find Enable ActiveX checkbox");

        if (!cb.isSelected()) {
            cb.doClick();
            SwingUtils.clickButton(configDialog, "OK");
            Utils.logToConsole("TWS has been configured to accept API connections");
            mChannel.writeAck("configured");
        } else {
            Utils.logToConsole("TWS is already configured to accept API connections");
            mChannel.writeAck("already configured");
        }
    } catch (IbcException e) {
        Utils.logError("CommandServer: " + e.getMessage());
        mChannel.writeNack(e.getMessage());
    }
}
 
Example 2
Source File: EnableApiTask.java    From ib-controller with GNU General Public License v3.0 6 votes vote down vote up
@Override public void run() {
    try {
        Utils.logToConsole("Doing ENABLEAPI configuration");
        
        if (!Utils.selectConfigSection(configDialog, new String[] {"API","Settings"}))
            // older versions of TWS don't have the Settings node below the API node
            Utils.selectConfigSection(configDialog, new String[] {"API"});

        JCheckBox cb = SwingUtils.findCheckBox(configDialog, "Enable ActiveX and Socket Clients");
        if (cb == null) throw new IBControllerException("could not find Enable ActiveX checkbox");

        if (!cb.isSelected()) {
            cb.doClick();
            SwingUtils.clickButton(configDialog, "OK");
            Utils.logToConsole("TWS has been configured to accept API connections");
            mChannel.writeAck("configured");
        } else {
            Utils.logToConsole("TWS is already configured to accept API connections");
            mChannel.writeAck("already configured");
        }
    } catch (IBControllerException e) {
        Utils.logError("IBControllerServer: " + e.getMessage());
        mChannel.writeNack(e.getMessage());
    }
}
 
Example 3
Source File: OperationsHistoryPanel.java    From thunderstorm with GNU General Public License v3.0 5 votes vote down vote up
public void undoOrRedoLastOperation() {
    if(!stack.isEmpty()) {
        JCheckBox chb = stack.get(stack.size() - 1).chb;
        if(chb != null) {
            chb.doClick();
        }
    }
}
 
Example 4
Source File: PerfIDEValidation.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Test creation of java project. 
 * - open New Project wizard from main menu (File|New Project)
 * - select Java Application project from Standard category
 * - in the next panel type project name and project location in
 * - finish the wizard
 * - wait until project appears in projects view
 * - wait classpath scanning finished
 */
public void testNewJavaProject() {
    NewProjectWizardOperator.invoke().cancel();
    NewProjectWizardOperator npwo = NewProjectWizardOperator.invoke();
    // "Standard"
    String standardLabel = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.wizards.Bundle", "Templates/Project/Standard");
    npwo.selectCategory(standardLabel);
    // "Java Application"
    String javaApplicationLabel = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.wizards.Bundle", "template_app");
    npwo.selectProject(javaApplicationLabel);
    npwo.next();
    NewJavaProjectNameLocationStepOperator npnlso = new NewJavaProjectNameLocationStepOperator();
    npnlso.txtProjectName().setText(SAMPLE_PROJECT_NAME);
    npnlso.txtProjectLocation().setText(System.getProperty("netbeans.user")); // NOI18N
    npnlso.btFinish().pushNoBlock();
    npnlso.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 120000);
    npnlso.waitClosed();
    // wait project appear in projects view
    new ProjectsTabOperator().getProjectRootNode(SAMPLE_PROJECT_NAME);

    //disable the compile on save:
    ProjectsTabOperator.invoke().getProjectRootNode(SAMPLE_PROJECT_NAME).properties();
    // "Project Properties"
    String projectPropertiesTitle = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.customizer.Bundle", "LBL_Customizer_Title");
    NbDialogOperator propertiesDialogOper = new NbDialogOperator(projectPropertiesTitle);
    // select "Compile" category
    String buildCategoryTitle = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.customizer.Bundle", "LBL_Config_BuildCategory");
    String compileCategoryTitle = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.customizer.Bundle", "LBL_Config_Build");
    new Node(new Node(new JTreeOperator(propertiesDialogOper), buildCategoryTitle), compileCategoryTitle).select();
    // actually disable the quick run:
    String compileOnSaveLabel = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.customizer.Bundle", "CustomizerCompile.CompileOnSave");
    JCheckBox cb = JCheckBoxOperator.waitJCheckBox((Container) propertiesDialogOper.getSource(), compileOnSaveLabel, true, true);
    if (cb.isSelected()) {
        cb.doClick();
    }
    // confirm properties dialog
    propertiesDialogOper.ok();

    // wait classpath scanning finished
    PerfWatchProjects.waitScanFinished();
}
 
Example 5
Source File: IDEValidation.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Test creation of java project. 
 * - open New Project wizard from main menu (File|New Project)
 * - select Java Application project from Standard category
 * - in the next panel type project name and project location in
 * - finish the wizard
 * - wait until project appears in projects view
 * - wait classpath scanning finished
 */
public void testNewProject() {
    NewProjectWizardOperator.invoke().cancel();
    NewProjectWizardOperator npwo = NewProjectWizardOperator.invoke();
    // "Standard"
    String standardLabel = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.wizards.Bundle", "Templates/Project/Standard");
    npwo.selectCategory(standardLabel);
    // "Java Application"
    String javaApplicationLabel = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.wizards.Bundle", "template_app");
    npwo.selectProject(javaApplicationLabel);
    npwo.next();
    NewJavaProjectNameLocationStepOperator npnlso = new NewJavaProjectNameLocationStepOperator();
    npnlso.txtProjectName().setText(SAMPLE_PROJECT_NAME);
    npnlso.txtProjectLocation().setText(System.getProperty("netbeans.user")); // NOI18N
    npnlso.btFinish().pushNoBlock();
    npnlso.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 120000);
    npnlso.waitClosed();
    // wait project appear in projects view
    new ProjectsTabOperator().getProjectRootNode(SAMPLE_PROJECT_NAME);

    //disable the compile on save:
    ProjectsTabOperator.invoke().getProjectRootNode(SAMPLE_PROJECT_NAME).properties();
    // "Project Properties"
    String projectPropertiesTitle = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.customizer.Bundle", "LBL_Customizer_Title");
    NbDialogOperator propertiesDialogOper = new NbDialogOperator(projectPropertiesTitle);
    // select "Compile" category
    String buildCategoryTitle = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.customizer.Bundle", "LBL_Config_BuildCategory");
    String compileCategoryTitle = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.customizer.Bundle", "LBL_Config_Build");
    new Node(new Node(new JTreeOperator(propertiesDialogOper), buildCategoryTitle), compileCategoryTitle).select();
    // actually disable the quick run:
    String compileOnSaveLabel = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.ui.customizer.Bundle", "CustomizerCompile.CompileOnSave");
    JCheckBox cb = JCheckBoxOperator.waitJCheckBox((Container) propertiesDialogOper.getSource(), compileOnSaveLabel, true, true);
    if (cb.isSelected()) {
        cb.doClick();
    }
    // confirm properties dialog
    propertiesDialogOper.ok();

    // wait classpath scanning finished
    WatchProjects.waitScanFinished();
}