Search in sources :

Example 21 with JRadioButton

use of javax.swing.JRadioButton in project jmeter by apache.

the class AssertionGui method createTypePanel.

/**
     * Create a panel allowing the user to choose what type of test should be
     * performed.
     *
     * @return a new panel for selecting the type of assertion test
     */
private JPanel createTypePanel() {
    JPanel panel = new JPanel();
    //$NON-NLS-1$
    panel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("assertion_pattern_match_rules")));
    ButtonGroup group = new ButtonGroup();
    //$NON-NLS-1$
    containsBox = new JRadioButton(JMeterUtils.getResString("assertion_contains"));
    group.add(containsBox);
    containsBox.setSelected(true);
    panel.add(containsBox);
    //$NON-NLS-1$
    matchesBox = new JRadioButton(JMeterUtils.getResString("assertion_matches"));
    group.add(matchesBox);
    panel.add(matchesBox);
    //$NON-NLS-1$
    equalsBox = new JRadioButton(JMeterUtils.getResString("assertion_equals"));
    group.add(equalsBox);
    panel.add(equalsBox);
    //$NON-NLS-1$
    substringBox = new JRadioButton(JMeterUtils.getResString("assertion_substring"));
    group.add(substringBox);
    panel.add(substringBox);
    //$NON-NLS-1$
    notBox = new JCheckBox(JMeterUtils.getResString("assertion_not"));
    panel.add(notBox);
    //$NON-NLS-1$
    orBox = new JCheckBox(JMeterUtils.getResString("assertion_or"));
    panel.add(orBox);
    return panel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ButtonGroup(javax.swing.ButtonGroup)

Example 22 with JRadioButton

use of javax.swing.JRadioButton in project jmeter by apache.

the class AssertionGui method createFieldPanel.

/**
     * Create a panel allowing the user to choose which response field should be
     * tested.
     *
     * @return a new panel for selecting the response field
     */
private JPanel createFieldPanel() {
    //$NON-NLS-1$
    responseStringButton = new JRadioButton(JMeterUtils.getResString("assertion_text_resp"));
    //$NON-NLS-1$
    responseAsDocumentButton = new JRadioButton(JMeterUtils.getResString("assertion_text_document"));
    //$NON-NLS-1$
    urlButton = new JRadioButton(JMeterUtils.getResString("assertion_url_samp"));
    //$NON-NLS-1$
    responseCodeButton = new JRadioButton(JMeterUtils.getResString("assertion_code_resp"));
    //$NON-NLS-1$
    responseMessageButton = new JRadioButton(JMeterUtils.getResString("assertion_message_resp"));
    //$NON-NLS-1$
    responseHeadersButton = new JRadioButton(JMeterUtils.getResString("assertion_headers"));
    //$NON-NLS-1$
    requestHeadersButton = new JRadioButton(JMeterUtils.getResString("assertion_req_headers"));
    ButtonGroup group = new ButtonGroup();
    group.add(responseStringButton);
    group.add(responseAsDocumentButton);
    group.add(urlButton);
    group.add(responseCodeButton);
    group.add(responseMessageButton);
    group.add(requestHeadersButton);
    group.add(responseHeadersButton);
    responseStringButton.setSelected(true);
    //$NON-NLS-1$
    assumeSuccess = new JCheckBox(JMeterUtils.getResString("assertion_assume_success"));
    GridBagLayout gridBagLayout = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    initConstraints(gbc);
    JPanel panel = new JPanel(gridBagLayout);
    //$NON-NLS-1$
    panel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("assertion_resp_field")));
    addField(panel, responseStringButton, gbc);
    addField(panel, responseCodeButton, gbc);
    addField(panel, responseMessageButton, gbc);
    addField(panel, responseHeadersButton, gbc);
    resetContraints(gbc);
    addField(panel, requestHeadersButton, gbc);
    addField(panel, urlButton, gbc);
    addField(panel, responseAsDocumentButton, gbc);
    addField(panel, assumeSuccess, gbc);
    return panel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) JRadioButton(javax.swing.JRadioButton) GridBagLayout(java.awt.GridBagLayout) ButtonGroup(javax.swing.ButtonGroup)

Example 23 with JRadioButton

use of javax.swing.JRadioButton in project jmeter by apache.

the class AbstractThreadGroupGui method createOnErrorPanel.

private JPanel createOnErrorPanel() {
    JPanel panel = new JPanel();
    // $NON-NLS-1$
    panel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("sampler_on_error_action")));
    ButtonGroup group = new ButtonGroup();
    // $NON-NLS-1$
    continueBox = new JRadioButton(JMeterUtils.getResString("sampler_on_error_continue"));
    group.add(continueBox);
    panel.add(continueBox);
    // $NON-NLS-1$
    startNextLoop = new JRadioButton(JMeterUtils.getResString("sampler_on_error_start_next_loop"));
    group.add(startNextLoop);
    panel.add(startNextLoop);
    // $NON-NLS-1$
    stopThrdBox = new JRadioButton(JMeterUtils.getResString("sampler_on_error_stop_thread"));
    group.add(stopThrdBox);
    panel.add(stopThrdBox);
    // $NON-NLS-1$
    stopTestBox = new JRadioButton(JMeterUtils.getResString("sampler_on_error_stop_test"));
    group.add(stopTestBox);
    panel.add(stopTestBox);
    // $NON-NLS-1$
    stopTestNowBox = new JRadioButton(JMeterUtils.getResString("sampler_on_error_stop_test_now"));
    group.add(stopTestNowBox);
    panel.add(stopTestNowBox);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ButtonGroup(javax.swing.ButtonGroup)

Example 24 with JRadioButton

use of javax.swing.JRadioButton in project jmeter by apache.

the class TestActionGui method init.

private void init() {
    // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
    setBorder(makeBorder());
    add(makeTitlePanel());
    // Target
    HorizontalPanel targetPanel = new HorizontalPanel();
    targetPanel.add(new JLabel(targetLabel));
    DefaultComboBoxModel<String> targetModel = new DefaultComboBoxModel<>();
    targetModel.addElement(threadTarget);
    targetModel.addElement(testTarget);
    targetBox = new JComboBox<>(targetModel);
    targetBox.addActionListener(evt -> {
        if (((String) targetBox.getSelectedItem()).equals(threadTarget)) {
            target = TestAction.THREAD;
        } else {
            target = TestAction.TEST;
        }
    });
    targetPanel.add(targetBox);
    add(targetPanel);
    // Action
    HorizontalPanel actionPanel = new HorizontalPanel();
    ButtonGroup actionButtons = new ButtonGroup();
    pauseButton = new JRadioButton(pauseAction, true);
    pauseButton.addChangeListener(evt -> {
        if (pauseButton.isSelected()) {
            action = TestAction.PAUSE;
            durationField.setEnabled(true);
            targetBox.setEnabled(true);
        }
    });
    stopButton = new JRadioButton(stopAction, false);
    stopButton.addChangeListener(evt -> {
        if (stopButton.isSelected()) {
            action = TestAction.STOP;
            durationField.setEnabled(false);
            targetBox.setEnabled(true);
        }
    });
    stopNowButton = new JRadioButton(stopNowAction, false);
    stopNowButton.addChangeListener(evt -> {
        if (stopNowButton.isSelected()) {
            action = TestAction.STOP_NOW;
            durationField.setEnabled(false);
            targetBox.setEnabled(true);
        }
    });
    restartNextLoopButton = new JRadioButton(restartNextLoopAction, false);
    restartNextLoopButton.addChangeListener(evt -> {
        if (restartNextLoopButton.isSelected()) {
            action = TestAction.RESTART_NEXT_LOOP;
            durationField.setEnabled(false);
            targetBox.setSelectedIndex(TestAction.THREAD);
            targetBox.setEnabled(false);
        }
    });
    actionButtons.add(pauseButton);
    actionButtons.add(stopButton);
    actionButtons.add(stopNowButton);
    actionButtons.add(restartNextLoopButton);
    actionPanel.add(new JLabel(actionLabel));
    actionPanel.add(pauseButton);
    actionPanel.add(stopButton);
    actionPanel.add(stopNowButton);
    actionPanel.add(restartNextLoopButton);
    add(actionPanel);
    // Duration
    HorizontalPanel durationPanel = new HorizontalPanel();
    durationField = new JTextField(15);
    // $NON-NLS-1$
    durationField.setText("");
    durationPanel.add(new JLabel(durationLabel));
    durationPanel.add(durationField);
    add(durationPanel);
}
Also used : JRadioButton(javax.swing.JRadioButton) ButtonGroup(javax.swing.ButtonGroup) HorizontalPanel(org.apache.jmeter.gui.util.HorizontalPanel) VerticalLayout(org.apache.jorphan.gui.layout.VerticalLayout) JLabel(javax.swing.JLabel) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) JTextField(javax.swing.JTextField)

Example 25 with JRadioButton

use of javax.swing.JRadioButton in project jmeter by apache.

the class RegexExtractorGui method makeSourcePanel.

private JPanel makeSourcePanel() {
    JPanel panel = new JPanel();
    //$NON-NLS-1$
    panel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("regex_source")));
    //$NON-NLS-1$
    useBody = new JRadioButton(JMeterUtils.getResString("regex_src_body"));
    //$NON-NLS-1$
    useUnescapedBody = new JRadioButton(JMeterUtils.getResString("regex_src_body_unescaped"));
    //$NON-NLS-1$
    useBodyAsDocument = new JRadioButton(JMeterUtils.getResString("regex_src_body_as_document"));
    //$NON-NLS-1$
    useHeaders = new JRadioButton(JMeterUtils.getResString("regex_src_hdrs"));
    //$NON-NLS-1$
    useRequestHeaders = new JRadioButton(JMeterUtils.getResString("regex_src_hdrs_req"));
    //$NON-NLS-1$
    useURL = new JRadioButton(JMeterUtils.getResString("regex_src_url"));
    //$NON-NLS-1$
    useCode = new JRadioButton(JMeterUtils.getResString("assertion_code_resp"));
    //$NON-NLS-1$
    useMessage = new JRadioButton(JMeterUtils.getResString("assertion_message_resp"));
    group = new ButtonGroup();
    group.add(useBody);
    group.add(useUnescapedBody);
    group.add(useBodyAsDocument);
    group.add(useHeaders);
    group.add(useRequestHeaders);
    group.add(useURL);
    group.add(useCode);
    group.add(useMessage);
    panel.add(useBody);
    panel.add(useUnescapedBody);
    panel.add(useBodyAsDocument);
    panel.add(useHeaders);
    panel.add(useRequestHeaders);
    panel.add(useURL);
    panel.add(useCode);
    panel.add(useMessage);
    useBody.setSelected(true);
    // So we know which button is selected
    useBody.setActionCommand(RegexExtractor.USE_BODY);
    useUnescapedBody.setActionCommand(RegexExtractor.USE_BODY_UNESCAPED);
    useBodyAsDocument.setActionCommand(RegexExtractor.USE_BODY_AS_DOCUMENT);
    useHeaders.setActionCommand(RegexExtractor.USE_HDRS);
    useRequestHeaders.setActionCommand(RegexExtractor.USE_REQUEST_HDRS);
    useURL.setActionCommand(RegexExtractor.USE_URL);
    useCode.setActionCommand(RegexExtractor.USE_CODE);
    useMessage.setActionCommand(RegexExtractor.USE_MESSAGE);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ButtonGroup(javax.swing.ButtonGroup)

Aggregations

JRadioButton (javax.swing.JRadioButton)117 ButtonGroup (javax.swing.ButtonGroup)76 JPanel (javax.swing.JPanel)55 JLabel (javax.swing.JLabel)54 JButton (javax.swing.JButton)32 BoxLayout (javax.swing.BoxLayout)30 ActionEvent (java.awt.event.ActionEvent)29 JCheckBox (javax.swing.JCheckBox)29 ActionListener (java.awt.event.ActionListener)25 JTextField (javax.swing.JTextField)25 JScrollPane (javax.swing.JScrollPane)24 FlowLayout (java.awt.FlowLayout)17 GridBagLayout (java.awt.GridBagLayout)17 BorderLayout (java.awt.BorderLayout)16 GridBagConstraints (java.awt.GridBagConstraints)15 Insets (java.awt.Insets)11 JSpinner (javax.swing.JSpinner)11 JTable (javax.swing.JTable)11 Dimension (java.awt.Dimension)9 JComboBox (javax.swing.JComboBox)9