Search in sources :

Example 26 with HorizontalPanel

use of org.apache.jmeter.gui.util.HorizontalPanel in project jmeter by apache.

the class HtmlExtractorGui method makeExtractorPanel.

private Component makeExtractorPanel() {
    JPanel panel = new HorizontalPanel();
    //$NON-NLS-1$
    panel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("html_extractor_type")));
    DefaultComboBoxModel<String> m = new DefaultComboBoxModel<>();
    for (String s : HtmlExtractor.getImplementations()) {
        m.addElement(s);
    }
    m.addElement(USE_DEFAULT_EXTRACTOR_IMPL);
    extractorImplName = new JComboBox<>(m);
    extractorImplName.setSelectedItem(HtmlExtractor.DEFAULT_EXTRACTOR);
    // $NON-NLS-1$
    JLabel label2 = new JLabel(JMeterUtils.getResString("html_extractor_type"));
    label2.setLabelFor(extractorImplName);
    panel.add(label2);
    panel.add(extractorImplName);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) HorizontalPanel(org.apache.jmeter.gui.util.HorizontalPanel) JLabel(javax.swing.JLabel) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel)

Example 27 with HorizontalPanel

use of org.apache.jmeter.gui.util.HorizontalPanel in project jmeter by apache.

the class TableVisualizer method init.

private void init() {
    // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    this.setLayout(new BorderLayout());
    // MAIN PANEL
    JPanel mainPanel = new JPanel();
    Border margin = new EmptyBorder(10, 10, 5, 10);
    mainPanel.setBorder(margin);
    mainPanel.setLayout(new VerticalLayout(5, VerticalLayout.BOTH));
    // NAME
    mainPanel.add(makeTitlePanel());
    // Set up the table itself
    table = new JTable(model);
    table.setRowSorter(new ObjectTableSorter(model).setValueComparator(5, Comparator.nullsFirst((ImageIcon o1, ImageIcon o2) -> {
        if (o1 == o2) {
            return 0;
        }
        if (o1 == imageSuccess) {
            return -1;
        }
        if (o1 == imageFailure) {
            return 1;
        }
        throw new IllegalArgumentException("Only success and failure images can be compared");
    })));
    JMeterUtils.applyHiDPI(table);
    HeaderAsPropertyRendererWrapper.setupDefaultRenderer(table);
    RendererUtils.applyRenderers(table, RENDERERS);
    tableScrollPanel = new JScrollPane(table);
    tableScrollPanel.setViewportBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    //$NON-NLS-1$
    autoscroll = new JCheckBox(JMeterUtils.getResString("view_results_autoscroll"));
    //$NON-NLS-1$
    childSamples = new JCheckBox(JMeterUtils.getResString("view_results_childsamples"));
    // Set up footer of table which displays numerics of the graphs
    JPanel dataPanel = new JPanel();
    // $NON-NLS-1$
    JLabel dataLabel = new JLabel(JMeterUtils.getResString("graph_results_latest_sample"));
    dataLabel.setForeground(Color.black);
    dataField = new JTextField(5);
    dataField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    dataField.setEditable(false);
    dataField.setForeground(Color.black);
    dataField.setBackground(getBackground());
    dataPanel.add(dataLabel);
    dataPanel.add(dataField);
    JPanel averagePanel = new JPanel();
    // $NON-NLS-1$
    JLabel averageLabel = new JLabel(JMeterUtils.getResString("graph_results_average"));
    averageLabel.setForeground(Color.blue);
    averageField = new JTextField(5);
    averageField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    averageField.setEditable(false);
    averageField.setForeground(Color.blue);
    averageField.setBackground(getBackground());
    averagePanel.add(averageLabel);
    averagePanel.add(averageField);
    JPanel deviationPanel = new JPanel();
    // $NON-NLS-1$
    JLabel deviationLabel = new JLabel(JMeterUtils.getResString("graph_results_deviation"));
    deviationLabel.setForeground(Color.red);
    deviationField = new JTextField(5);
    deviationField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    deviationField.setEditable(false);
    deviationField.setForeground(Color.red);
    deviationField.setBackground(getBackground());
    deviationPanel.add(deviationLabel);
    deviationPanel.add(deviationField);
    JPanel noSamplesPanel = new JPanel();
    // $NON-NLS-1$
    JLabel noSamplesLabel = new JLabel(JMeterUtils.getResString("graph_results_no_samples"));
    noSamplesField = new JTextField(8);
    noSamplesField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    noSamplesField.setEditable(false);
    noSamplesField.setForeground(Color.black);
    noSamplesField.setBackground(getBackground());
    noSamplesPanel.add(noSamplesLabel);
    noSamplesPanel.add(noSamplesField);
    JPanel tableInfoPanel = new JPanel();
    tableInfoPanel.setLayout(new FlowLayout());
    tableInfoPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    tableInfoPanel.add(noSamplesPanel);
    tableInfoPanel.add(dataPanel);
    tableInfoPanel.add(averagePanel);
    tableInfoPanel.add(deviationPanel);
    JPanel tableControlsPanel = new JPanel(new BorderLayout());
    tableControlsPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    JPanel jp = new HorizontalPanel();
    jp.add(autoscroll);
    jp.add(childSamples);
    tableControlsPanel.add(jp, BorderLayout.WEST);
    tableControlsPanel.add(tableInfoPanel, BorderLayout.CENTER);
    // Set up the table with footer
    JPanel tablePanel = new JPanel();
    tablePanel.setLayout(new BorderLayout());
    tablePanel.add(tableScrollPanel, BorderLayout.CENTER);
    tablePanel.add(tableControlsPanel, BorderLayout.SOUTH);
    // Add the main panel and the graph
    this.add(mainPanel, BorderLayout.NORTH);
    this.add(tablePanel, BorderLayout.CENTER);
    new Timer(REFRESH_PERIOD, e -> collectNewSamples()).start();
}
Also used : JScrollPane(javax.swing.JScrollPane) Color(java.awt.Color) JMeterUtils(org.apache.jmeter.util.JMeterUtils) Format(java.text.Format) JTextField(javax.swing.JTextField) Calculator(org.apache.jmeter.util.Calculator) SimpleDateFormat(java.text.SimpleDateFormat) SampleResult(org.apache.jmeter.samplers.SampleResult) Deque(java.util.Deque) TableCellRenderer(javax.swing.table.TableCellRenderer) HorizontalPanel(org.apache.jmeter.gui.util.HorizontalPanel) Border(javax.swing.border.Border) VerticalLayout(org.apache.jorphan.gui.layout.VerticalLayout) ImageIcon(javax.swing.ImageIcon) BorderLayout(java.awt.BorderLayout) HeaderAsPropertyRendererWrapper(org.apache.jmeter.gui.util.HeaderAsPropertyRendererWrapper) Timer(javax.swing.Timer) FlowLayout(java.awt.FlowLayout) Clearable(org.apache.jmeter.samplers.Clearable) Functor(org.apache.jorphan.reflect.Functor) ObjectTableSorter(org.apache.jorphan.gui.ObjectTableSorter) RendererUtils(org.apache.jorphan.gui.RendererUtils) BorderFactory(javax.swing.BorderFactory) ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque) JScrollPane(javax.swing.JScrollPane) JMeter(org.apache.jmeter.JMeter) AbstractVisualizer(org.apache.jmeter.visualizers.gui.AbstractVisualizer) JLabel(javax.swing.JLabel) JCheckBox(javax.swing.JCheckBox) JTable(javax.swing.JTable) EmptyBorder(javax.swing.border.EmptyBorder) ObjectTableModel(org.apache.jorphan.gui.ObjectTableModel) RightAlignRenderer(org.apache.jorphan.gui.RightAlignRenderer) Comparator(java.util.Comparator) JPanel(javax.swing.JPanel) JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) FlowLayout(java.awt.FlowLayout) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) JCheckBox(javax.swing.JCheckBox) BorderLayout(java.awt.BorderLayout) Timer(javax.swing.Timer) JTable(javax.swing.JTable) HorizontalPanel(org.apache.jmeter.gui.util.HorizontalPanel) VerticalLayout(org.apache.jorphan.gui.layout.VerticalLayout) ObjectTableSorter(org.apache.jorphan.gui.ObjectTableSorter) EmptyBorder(javax.swing.border.EmptyBorder) Border(javax.swing.border.Border) EmptyBorder(javax.swing.border.EmptyBorder)

Example 28 with HorizontalPanel

use of org.apache.jmeter.gui.util.HorizontalPanel in project jmeter by apache.

the class BackendListenerGui method createClassnamePanel.

/**
     * Create a panel with GUI components allowing the user to select a test
     * class.
     *
     * @return a panel containing the relevant components
     */
private JPanel createClassnamePanel() {
    List<String> possibleClasses = new ArrayList<>();
    try {
        // Find all the classes which implement the BackendListenerClient
        // interface.
        possibleClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] { BackendListenerClient.class });
        // Remove the BackendListener class from the list since it only
        // implements the interface for error conditions.
        possibleClasses.remove(BackendListener.class.getName() + "$ErrorBackendListenerClient");
    } catch (Exception e) {
        log.debug("Exception getting interfaces.", e);
    }
    // $NON-NLS-1$
    JLabel label = new JLabel(JMeterUtils.getResString("backend_listener_classname"));
    classnameCombo = new JComboBox<>(possibleClasses.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
    classnameCombo.addActionListener(this);
    classnameCombo.setEditable(false);
    label.setLabelFor(classnameCombo);
    HorizontalPanel classNamePanel = new HorizontalPanel();
    classNamePanel.add(label);
    classNamePanel.add(classnameCombo);
    queueSize = new JTextField(BackendListener.DEFAULT_QUEUE_SIZE, 5);
    //$NON-NLS-1$
    queueSize.setName("Queue Size");
    // $NON-NLS-1$
    JLabel queueSizeLabel = new JLabel(JMeterUtils.getResString("backend_listener_queue_size"));
    queueSizeLabel.setLabelFor(queueSize);
    HorizontalPanel queueSizePanel = new HorizontalPanel();
    queueSizePanel.add(queueSizeLabel, BorderLayout.WEST);
    queueSizePanel.add(queueSize);
    JPanel panel = new JPanel(new BorderLayout(0, 5));
    panel.add(classNamePanel, BorderLayout.NORTH);
    panel.add(queueSizePanel, BorderLayout.CENTER);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) ArrayList(java.util.ArrayList) HorizontalPanel(org.apache.jmeter.gui.util.HorizontalPanel) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField)

Example 29 with HorizontalPanel

use of org.apache.jmeter.gui.util.HorizontalPanel in project jmeter by apache.

the class HttpTestSampleGui method createSourceAddrPanel.

protected JPanel createSourceAddrPanel() {
    final JPanel sourceAddrPanel = new HorizontalPanel();
    sourceAddrPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString(// $NON-NLS-1$
    "web_testing_source_ip")));
    // Add a new field source ip address (for HC implementations only)
    //default: IP/Hostname
    sourceIpType.setSelectedIndex(HTTPSamplerBase.SourceType.HOSTNAME.ordinal());
    sourceAddrPanel.add(sourceIpType);
    sourceIpAddr = new JTextField();
    sourceAddrPanel.add(sourceIpAddr);
    return sourceAddrPanel;
}
Also used : JPanel(javax.swing.JPanel) HorizontalPanel(org.apache.jmeter.gui.util.HorizontalPanel) JTextField(javax.swing.JTextField)

Example 30 with HorizontalPanel

use of org.apache.jmeter.gui.util.HorizontalPanel in project jmeter by apache.

the class MailReaderSamplerGui method init.

/*
     * Helper method to set up the GUI screen
     */
private void init() {
    // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    setLayout(new BorderLayout());
    setBorder(makeBorder());
    JPanel settingsPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = getConstraints();
    serverTypeBox = new JTextField(20);
    serverTypeBox.addActionListener(this);
    serverTypeBox.addFocusListener(this);
    addField(settingsPanel, serverTypeLabel, serverTypeBox, gbc);
    serverBox = new JTextField(20);
    addField(settingsPanel, serverLabel, serverBox, gbc);
    portBox = new JTextField(20);
    addField(settingsPanel, portLabel, portBox, gbc);
    usernameBox = new JTextField(20);
    addField(settingsPanel, accountLabel, usernameBox, gbc);
    passwordBox = new JPasswordField(20);
    addField(settingsPanel, passwordLabel, passwordBox, gbc);
    folderLabel = new JLabel(folderLabelStr);
    folderBox = new JTextField(INBOX, 20);
    addField(settingsPanel, folderLabel, folderBox, gbc);
    HorizontalPanel numMessagesPanel = new HorizontalPanel();
    numMessagesPanel.add(new JLabel(numMessagesLabel));
    ButtonGroup nmbg = new ButtonGroup();
    allMessagesButton = new JRadioButton(allMessagesLabel);
    allMessagesButton.addChangeListener(e -> {
        if (allMessagesButton.isSelected()) {
            someMessagesField.setEnabled(false);
        }
    });
    someMessagesButton = new JRadioButton();
    someMessagesButton.addChangeListener(e -> {
        if (someMessagesButton.isSelected()) {
            someMessagesField.setEnabled(true);
        }
    });
    nmbg.add(allMessagesButton);
    nmbg.add(someMessagesButton);
    someMessagesField = new JTextField(5);
    allMessagesButton.setSelected(true);
    numMessagesPanel.add(allMessagesButton);
    numMessagesPanel.add(someMessagesButton);
    numMessagesPanel.add(someMessagesField);
    headerOnlyBox = new JCheckBox(headerOnlyLabel);
    deleteBox = new JCheckBox(deleteLabel);
    storeMimeMessageBox = new JCheckBox(storeMime);
    securitySettingsPanel = new SecuritySettingsPanel();
    JPanel settings = new VerticalPanel();
    settings.add(Box.createVerticalStrut(5));
    settings.add(settingsPanel);
    settings.add(numMessagesPanel);
    settings.add(headerOnlyBox);
    settings.add(deleteBox);
    settings.add(storeMimeMessageBox);
    settings.add(securitySettingsPanel);
    add(makeTitlePanel(), BorderLayout.NORTH);
    add(settings, BorderLayout.CENTER);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) JRadioButton(javax.swing.JRadioButton) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) JCheckBox(javax.swing.JCheckBox) VerticalPanel(org.apache.jmeter.gui.util.VerticalPanel) BorderLayout(java.awt.BorderLayout) JPasswordField(javax.swing.JPasswordField) ButtonGroup(javax.swing.ButtonGroup) HorizontalPanel(org.apache.jmeter.gui.util.HorizontalPanel) SecuritySettingsPanel(org.apache.jmeter.protocol.smtp.sampler.gui.SecuritySettingsPanel)

Aggregations

HorizontalPanel (org.apache.jmeter.gui.util.HorizontalPanel)37 JPanel (javax.swing.JPanel)30 JLabel (javax.swing.JLabel)17 BorderLayout (java.awt.BorderLayout)15 JTextField (javax.swing.JTextField)15 VerticalPanel (org.apache.jmeter.gui.util.VerticalPanel)11 JCheckBox (javax.swing.JCheckBox)10 Dimension (java.awt.Dimension)6 JLabeledTextField (org.apache.jorphan.gui.JLabeledTextField)6 ButtonGroup (javax.swing.ButtonGroup)5 JRadioButton (javax.swing.JRadioButton)4 GridBagConstraints (java.awt.GridBagConstraints)3 GridBagLayout (java.awt.GridBagLayout)3 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)3 FlowLayout (java.awt.FlowLayout)2 JPasswordField (javax.swing.JPasswordField)2 JScrollPane (javax.swing.JScrollPane)2 JTabbedPane (javax.swing.JTabbedPane)2 Color (java.awt.Color)1 Format (java.text.Format)1