Search in sources :

Example 1 with HeaderAsPropertyRenderer

use of org.apache.jmeter.gui.util.HeaderAsPropertyRenderer 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 2 with HeaderAsPropertyRenderer

use of org.apache.jmeter.gui.util.HeaderAsPropertyRenderer 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 3 with HeaderAsPropertyRenderer

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

the class UserParametersGui method clearGui.

/**
     * Implements JMeterGUIComponent.clearGui
     */
@Override
public void clearGui() {
    super.clearGui();
    initTableModel();
    paramTable.setModel(tableModel);
    HeaderAsPropertyRenderer defaultRenderer = new HeaderAsPropertyRenderer() {

        private static final long serialVersionUID = 240L;

        @Override
        protected String getText(Object value, int row, int column) {
            if (column >= 1) {
                // Don't process the NAME column
                String val = value.toString();
                if (val.startsWith(USER_COL_RESOURCE + UNDERSCORE)) {
                    return JMeterUtils.getResString(USER_COL_RESOURCE) + val.substring(val.indexOf(UNDERSCORE));
                }
            }
            return super.getText(value, row, column);
        }
    };
    paramTable.getTableHeader().setDefaultRenderer(defaultRenderer);
    perIterationCheck.setSelected(false);
}
Also used : HeaderAsPropertyRenderer(org.apache.jmeter.gui.util.HeaderAsPropertyRenderer)

Example 4 with HeaderAsPropertyRenderer

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

the class SamplerResultTab method createResponseMetadataPanel.

private Component createResponseMetadataPanel() {
    stats = new JTextPane();
    stats.setEditable(false);
    stats.setBackground(backGround);
    // Add styles to use for different types of status messages
    StyledDocument doc = (StyledDocument) stats.getDocument();
    Style style = doc.addStyle(STYLE_REDIRECT, null);
    StyleConstants.setForeground(style, REDIRECT_COLOR);
    style = doc.addStyle(STYLE_CLIENT_ERROR, null);
    StyleConstants.setForeground(style, CLIENT_ERROR_COLOR);
    style = doc.addStyle(STYLE_SERVER_ERROR, null);
    StyleConstants.setForeground(style, SERVER_ERROR_COLOR);
    paneRaw = GuiUtils.makeScrollPane(stats);
    paneRaw.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    // Set up the 1st table Result with empty headers
    tableResult = new JTable(resultModel);
    JMeterUtils.applyHiDPI(tableResult);
    // $NON-NLS-1$
    tableResult.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell"));
    tableResult.addMouseListener(new TextBoxDoubleClick(tableResult));
    setFirstColumnPreferredSize(tableResult);
    RendererUtils.applyRenderers(tableResult, RENDERERS_RESULT);
    // Set up the 2nd table 
    tableResHeaders = new JTable(resHeadersModel);
    JMeterUtils.applyHiDPI(tableResHeaders);
    // $NON-NLS-1$
    tableResHeaders.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell"));
    tableResHeaders.addMouseListener(new TextBoxDoubleClick(tableResHeaders));
    setFirstColumnPreferredSize(tableResHeaders);
    tableResHeaders.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    RendererUtils.applyRenderers(tableResHeaders, RENDERERS_HEADERS);
    // Set up the 3rd table 
    tableResFields = new JTable(resFieldsModel);
    JMeterUtils.applyHiDPI(tableResFields);
    // $NON-NLS-1$
    tableResFields.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell"));
    tableResFields.addMouseListener(new TextBoxDoubleClick(tableResFields));
    setFirstColumnPreferredSize(tableResFields);
    tableResFields.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    RendererUtils.applyRenderers(tableResFields, RENDERERS_FIELDS);
    // Prepare the Results tabbed pane
    tabbedResult = new JTabbedPane(SwingConstants.BOTTOM);
    // Create the split pane
    JSplitPane topSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, GuiUtils.makeScrollPane(tableResHeaders), GuiUtils.makeScrollPane(tableResFields));
    topSplit.setOneTouchExpandable(true);
    // set split ratio
    topSplit.setResizeWeight(0.80);
    // see bug jdk 4131528
    topSplit.setBorder(null);
    paneParsed = new JSplitPane(JSplitPane.VERTICAL_SPLIT, GuiUtils.makeScrollPane(tableResult), topSplit);
    paneParsed.setOneTouchExpandable(true);
    // set split ratio
    paneParsed.setResizeWeight(0.40);
    // see bug jdk 4131528
    paneParsed.setBorder(null);
    // setup bottom tabs, first Raw, second Parsed
    //$NON-NLS-1$
    tabbedResult.addTab(JMeterUtils.getResString("view_results_table_result_tab_raw"), paneRaw);
    //$NON-NLS-1$
    tabbedResult.addTab(JMeterUtils.getResString("view_results_table_result_tab_parsed"), paneParsed);
    // Hint to background color on bottom tabs (grey, not blue)
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(tabbedResult);
    return panel;
}
Also used : JTextPane(javax.swing.JTextPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) HeaderAsPropertyRenderer(org.apache.jmeter.gui.util.HeaderAsPropertyRenderer) JTabbedPane(javax.swing.JTabbedPane) StyledDocument(javax.swing.text.StyledDocument) Style(javax.swing.text.Style) TextBoxDoubleClick(org.apache.jmeter.gui.util.TextBoxDialoger.TextBoxDoubleClick) JSplitPane(javax.swing.JSplitPane)

Example 5 with HeaderAsPropertyRenderer

use of org.apache.jmeter.gui.util.HeaderAsPropertyRenderer 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)

Aggregations

HeaderAsPropertyRenderer (org.apache.jmeter.gui.util.HeaderAsPropertyRenderer)15 JTable (javax.swing.JTable)14 BorderLayout (java.awt.BorderLayout)9 JPanel (javax.swing.JPanel)9 Dimension (java.awt.Dimension)7 JScrollPane (javax.swing.JScrollPane)7 PowerTableModel (org.apache.jmeter.gui.util.PowerTableModel)4 TableColumn (javax.swing.table.TableColumn)3 JSplitPane (javax.swing.JSplitPane)2 TextBoxDoubleClick (org.apache.jmeter.gui.util.TextBoxDialoger.TextBoxDoubleClick)2 JTabbedPane (javax.swing.JTabbedPane)1 JTextPane (javax.swing.JTextPane)1 Style (javax.swing.text.Style)1 StyledDocument (javax.swing.text.StyledDocument)1 TextAreaCellRenderer (org.apache.jmeter.gui.util.TextAreaCellRenderer)1 TextAreaTableCellEditor (org.apache.jmeter.gui.util.TextAreaTableCellEditor)1