Search in sources :

Example 36 with JTable

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

the class SimpleConfigGui method createTablePanel.

/**
     * Create a GUI panel containing the table of configuration parameters.
     *
     * @return a GUI panel containing the parameter table
     */
private Component createTablePanel() {
    tableModel = new PowerTableModel(new String[] { COLUMN_NAMES_0, COLUMN_NAMES_1 }, new Class[] { String.class, String.class });
    table = new JTable(tableModel);
    JMeterUtils.applyHiDPI(table);
    table.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    return makeScrollPane(table);
}
Also used : PowerTableModel(org.apache.jmeter.gui.util.PowerTableModel) JTable(javax.swing.JTable) HeaderAsPropertyRenderer(org.apache.jmeter.gui.util.HeaderAsPropertyRenderer)

Example 37 with JTable

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

the class StatGraphVisualizer method init.

/**
     * Main visualizer setup.
     */
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);
    Border margin2 = new EmptyBorder(10, 10, 5, 10);
    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(makeTitlePanel());
    myJTable = new JTable(model);
    myJTable.setRowSorter(new ObjectTableSorter(model).fixLastRow());
    JMeterUtils.applyHiDPI(myJTable);
    // Fix centering of titles
    HeaderAsPropertyRendererWrapper.setupDefaultRenderer(myJTable, getColumnsMsgParameters());
    myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
    RendererUtils.applyRenderers(myJTable, getRenderers());
    myScrollPane = new JScrollPane(myJTable);
    settingsPane = new VerticalPanel();
    settingsPane.setBorder(margin2);
    graphPanel = new AxisGraph();
    graphPanel.setPreferredSize(new Dimension(defaultWidth, defaultHeight));
    settingsPane.add(createGraphActionsPane());
    settingsPane.add(createGraphColumnPane());
    settingsPane.add(createGraphTitlePane());
    settingsPane.add(createGraphDimensionPane());
    JPanel axisPane = new JPanel(new BorderLayout());
    axisPane.add(createGraphXAxisPane(), BorderLayout.WEST);
    axisPane.add(createGraphYAxisPane(), BorderLayout.CENTER);
    settingsPane.add(axisPane);
    settingsPane.add(createLegendPane());
    //$NON-NLS-1$
    tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_settings"), settingsPane);
    //$NON-NLS-1$
    tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_graph"), graphPanel);
    // If clic on the Graph tab, make the graph (without apply interval or filter)
    tabbedGraph.addChangeListener(changeEvent -> {
        JTabbedPane srcTab = (JTabbedPane) changeEvent.getSource();
        int index = srcTab.getSelectedIndex();
        if (srcTab.getTitleAt(index).equals(JMeterUtils.getResString("aggregate_graph_tab_graph"))) {
            actionMakeGraph();
        }
    });
    spane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    spane.setOneTouchExpandable(true);
    spane.setLeftComponent(myScrollPane);
    spane.setRightComponent(tabbedGraph);
    spane.setResizeWeight(.2);
    // see bug jdk 4131528
    spane.setBorder(null);
    spane.setContinuousLayout(true);
    this.add(mainPanel, BorderLayout.NORTH);
    this.add(spane, BorderLayout.CENTER);
    new Timer(REFRESH_PERIOD, e -> {
        synchronized (lock) {
            while (!newRows.isEmpty()) {
                model.insertRow(newRows.pop(), model.getRowCount() - 1);
            }
        }
        model.fireTableDataChanged();
    }).start();
}
Also used : JScrollPane(javax.swing.JScrollPane) Color(java.awt.Color) VerticalPanel(org.apache.jmeter.gui.util.VerticalPanel) UIManager(javax.swing.UIManager) Format(java.text.Format) NumberRenderer(org.apache.jorphan.gui.NumberRenderer) LoggerFactory(org.slf4j.LoggerFactory) SampleResult(org.apache.jmeter.samplers.SampleResult) TableCellRenderer(javax.swing.table.TableCellRenderer) ActionRouter(org.apache.jmeter.gui.action.ActionRouter) Border(javax.swing.border.Border) Matcher(java.util.regex.Matcher) GuiUtils(org.apache.jorphan.gui.GuiUtils) Map(java.util.Map) JFileChooser(javax.swing.JFileChooser) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) Timer(javax.swing.Timer) PatternSyntaxException(java.util.regex.PatternSyntaxException) Font(java.awt.Font) ObjectTableSorter(org.apache.jorphan.gui.ObjectTableSorter) RendererUtils(org.apache.jorphan.gui.RendererUtils) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) CSVSaveService(org.apache.jmeter.save.CSVSaveService) BorderFactory(javax.swing.BorderFactory) Box(javax.swing.Box) ActionNames(org.apache.jmeter.gui.action.ActionNames) FilePanel(org.apache.jmeter.gui.util.FilePanel) Dimension(java.awt.Dimension) List(java.util.List) AbstractVisualizer(org.apache.jmeter.visualizers.gui.AbstractVisualizer) JCheckBox(javax.swing.JCheckBox) JTable(javax.swing.JTable) EmptyBorder(javax.swing.border.EmptyBorder) Pattern(java.util.regex.Pattern) JPanel(javax.swing.JPanel) JColorChooser(javax.swing.JColorChooser) JMeterUtils(org.apache.jmeter.util.JMeterUtils) ActionListener(java.awt.event.ActionListener) JSplitPane(javax.swing.JSplitPane) JTextField(javax.swing.JTextField) FileDialoger(org.apache.jmeter.gui.util.FileDialoger) ArrayUtils(org.apache.commons.lang3.ArrayUtils) Deque(java.util.Deque) SwingConstants(javax.swing.SwingConstants) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) SaveGraphics(org.apache.jmeter.gui.action.SaveGraphics) RateRenderer(org.apache.jorphan.gui.RateRenderer) Charset(java.nio.charset.Charset) JTabbedPane(javax.swing.JTabbedPane) JLabeledTextField(org.apache.jorphan.gui.JLabeledTextField) OutputStreamWriter(java.io.OutputStreamWriter) HeaderAsPropertyRendererWrapper(org.apache.jmeter.gui.util.HeaderAsPropertyRendererWrapper) BoxLayout(javax.swing.BoxLayout) JComponent(javax.swing.JComponent) FlowLayout(java.awt.FlowLayout) Clearable(org.apache.jmeter.samplers.Clearable) JButton(javax.swing.JButton) Functor(org.apache.jorphan.reflect.Functor) Logger(org.slf4j.Logger) DecimalFormat(java.text.DecimalFormat) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) JOptionPane(javax.swing.JOptionPane) ActionEvent(java.awt.event.ActionEvent) ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque) JScrollPane(javax.swing.JScrollPane) JLabel(javax.swing.JLabel) ObjectTableModel(org.apache.jorphan.gui.ObjectTableModel) JPanel(javax.swing.JPanel) BoxLayout(javax.swing.BoxLayout) JTabbedPane(javax.swing.JTabbedPane) Dimension(java.awt.Dimension) VerticalPanel(org.apache.jmeter.gui.util.VerticalPanel) BorderLayout(java.awt.BorderLayout) Timer(javax.swing.Timer) JTable(javax.swing.JTable) ObjectTableSorter(org.apache.jorphan.gui.ObjectTableSorter) EmptyBorder(javax.swing.border.EmptyBorder) JSplitPane(javax.swing.JSplitPane) Border(javax.swing.border.Border) EmptyBorder(javax.swing.border.EmptyBorder)

Example 38 with JTable

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

the class CookiePanel method createCookieTablePanel.

public JPanel createCookieTablePanel() {
    // create the JTable that holds one cookie per row
    cookieTable = new JTable(tableModel);
    JMeterUtils.applyHiDPI(cookieTable);
    cookieTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    cookieTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    cookieTable.setPreferredScrollableViewportSize(new Dimension(100, 70));
    JPanel buttonPanel = createButtonPanel();
    JPanel panel = new JPanel(new BorderLayout(0, 5));
    panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString(//$NON-NLS-1$
    "cookies_stored")));
    panel.add(new JScrollPane(cookieTable), BorderLayout.CENTER);
    panel.add(buttonPanel, BorderLayout.SOUTH);
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) HeaderAsPropertyRenderer(org.apache.jmeter.gui.util.HeaderAsPropertyRenderer) Dimension(java.awt.Dimension)

Example 39 with JTable

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

the class AssertionGui method createStringPanel.

/**
     * Create a panel allowing the user to supply a list of string patterns to
     * test against.
     *
     * @return a new panel for adding string patterns
     */
private JPanel createStringPanel() {
    tableModel = new PowerTableModel(new String[] { COL_RESOURCE_NAME }, new Class[] { String.class });
    stringTable = new JTable(tableModel);
    stringTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    stringTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    JMeterUtils.applyHiDPI(stringTable);
    TextAreaCellRenderer renderer = new TextAreaCellRenderer();
    stringTable.setRowHeight(renderer.getPreferredHeight());
    stringTable.setDefaultRenderer(String.class, renderer);
    stringTable.setDefaultEditor(String.class, new TextAreaTableCellEditor());
    stringTable.setPreferredScrollableViewportSize(new Dimension(100, 70));
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    //$NON-NLS-1$
    panel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("assertion_patterns_to_test")));
    panel.add(new JScrollPane(stringTable), BorderLayout.CENTER);
    panel.add(createButtonPanel(), BorderLayout.SOUTH);
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) PowerTableModel(org.apache.jmeter.gui.util.PowerTableModel) JTable(javax.swing.JTable) HeaderAsPropertyRenderer(org.apache.jmeter.gui.util.HeaderAsPropertyRenderer) TextAreaTableCellEditor(org.apache.jmeter.gui.util.TextAreaTableCellEditor) Dimension(java.awt.Dimension) TextAreaCellRenderer(org.apache.jmeter.gui.util.TextAreaCellRenderer)

Example 40 with JTable

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

the class UserParametersGui method makeParameterPanel.

private JPanel makeParameterPanel() {
    // $NON-NLS-1$
    JLabel tableLabel = new JLabel(JMeterUtils.getResString("user_parameters_table"));
    initTableModel();
    paramTable = new JTable(tableModel);
    paramTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    paramTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    JMeterUtils.applyHiDPI(paramTable);
    paramPanel = new JPanel(new BorderLayout());
    paramPanel.add(tableLabel, BorderLayout.NORTH);
    JScrollPane scroll = new JScrollPane(paramTable);
    scroll.setPreferredSize(scroll.getMinimumSize());
    paramPanel.add(scroll, BorderLayout.CENTER);
    paramPanel.add(makeButtonPanel(), BorderLayout.SOUTH);
    return paramPanel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) JLabel(javax.swing.JLabel)

Aggregations

JTable (javax.swing.JTable)284 JScrollPane (javax.swing.JScrollPane)149 JPanel (javax.swing.JPanel)120 JLabel (javax.swing.JLabel)85 JButton (javax.swing.JButton)80 BorderLayout (java.awt.BorderLayout)77 Dimension (java.awt.Dimension)74 ActionEvent (java.awt.event.ActionEvent)53 BoxLayout (javax.swing.BoxLayout)52 TableColumn (javax.swing.table.TableColumn)50 ActionListener (java.awt.event.ActionListener)44 JTextField (javax.swing.JTextField)40 TableColumnModel (javax.swing.table.TableColumnModel)36 MouseEvent (java.awt.event.MouseEvent)34 Component (java.awt.Component)33 FlowLayout (java.awt.FlowLayout)32 JComboBox (javax.swing.JComboBox)28 GridBagLayout (java.awt.GridBagLayout)24 GridBagConstraints (java.awt.GridBagConstraints)23 Insets (java.awt.Insets)23