use of org.apache.jmeter.gui.util.PowerTableModel 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);
}
use of org.apache.jmeter.gui.util.PowerTableModel 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;
}
use of org.apache.jmeter.gui.util.PowerTableModel in project jmeter by apache.
the class CookiePanel method init.
/**
* Shows the main cookie configuration panel.
*/
private void init() {
// WARNING: called from ctor so must not be overridden (i.e. must be private or final)
tableModel = new PowerTableModel(COLUMN_RESOURCE_NAMES, columnClasses);
clearEachIteration = //$NON-NLS-1$
new JCheckBox(JMeterUtils.getResString("clear_cookies_per_iter"), false);
policy = new JLabeledChoice(//$NON-NLS-1$
JMeterUtils.getResString("cookie_manager_policy"), new HC4CookieHandler().getPolicies());
setLayout(new BorderLayout());
setBorder(makeBorder());
JPanel northPanel = new JPanel();
northPanel.setLayout(new VerticalLayout(5, VerticalLayout.BOTH));
northPanel.add(makeTitlePanel());
JPanel optionsPane = new JPanel();
optionsPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), // $NON-NLS-1$
JMeterUtils.getResString("cookie_options")));
optionsPane.setLayout(new VerticalLayout(5, VerticalLayout.BOTH));
optionsPane.add(clearEachIteration);
JPanel policyTypePane = new JPanel();
policyTypePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
policyTypePane.add(policy);
optionsPane.add(policyTypePane);
northPanel.add(optionsPane);
add(northPanel, BorderLayout.NORTH);
add(createCookieTablePanel(), BorderLayout.CENTER);
}
use of org.apache.jmeter.gui.util.PowerTableModel in project jmeter by apache.
the class ProxyControlGui method addSuggestedExcludes.
/**
* Add suggested excludes to exclude table
* @param table {@link JTable}
*/
protected void addSuggestedExcludes(JTable table) {
GuiUtils.stopTableEditing(table);
int rowCount = table.getRowCount();
PowerTableModel model = null;
// $NON-NLS-1$
String[] exclusions = SUGGESTED_EXCLUSIONS.split(";");
if (exclusions.length > 0) {
model = (PowerTableModel) table.getModel();
if (model != null) {
for (String clipboardLine : exclusions) {
model.addRow(new Object[] { clipboardLine });
}
if (table.getRowCount() > rowCount) {
// Highlight (select) the appropriate rows.
int rowToSelect = model.getRowCount() - 1;
table.setRowSelectionInterval(rowCount, rowToSelect);
}
}
}
}
use of org.apache.jmeter.gui.util.PowerTableModel in project jmeter by apache.
the class ProxyControlGui method addFromClipboard.
/**
* Add values from the clipboard to table
* @param table {@link JTable}
*/
protected void addFromClipboard(JTable table) {
GuiUtils.stopTableEditing(table);
int rowCount = table.getRowCount();
PowerTableModel model = null;
try {
String clipboardContent = GuiUtils.getPastedText();
if (clipboardContent != null) {
String[] clipboardLines = clipboardContent.split(NEW_LINE);
for (String clipboardLine : clipboardLines) {
model = (PowerTableModel) table.getModel();
model.addRow(new Object[] { clipboardLine });
}
if (table.getRowCount() > rowCount) {
if (model != null) {
// Highlight (select) the appropriate rows.
int rowToSelect = model.getRowCount() - 1;
table.setRowSelectionInterval(rowCount, rowToSelect);
}
}
}
} catch (IOException ioe) {
JOptionPane.showMessageDialog(this, // $NON-NLS-1$
JMeterUtils.getResString("proxy_daemon_error_read_args") + "\n" + // $NON-NLS-1$ $NON-NLS-2$
ioe.getLocalizedMessage(), // $NON-NLS-1$ $NON-NLS-2$
JMeterUtils.getResString("error_title"), JOptionPane.ERROR_MESSAGE);
} catch (UnsupportedFlavorException ufe) {
JOptionPane.showMessageDialog(this, // $NON-NLS-1$
JMeterUtils.getResString("proxy_daemon_error_not_retrieve") + SPACE + DataFlavor.stringFlavor.getHumanPresentableName() + SPACE + // $NON-NLS-1$
JMeterUtils.getResString("proxy_daemon_error_from_clipboard") + // $NON-NLS-1$
ufe.getLocalizedMessage(), // $NON-NLS-1$
JMeterUtils.getResString("error_title"), JOptionPane.ERROR_MESSAGE);
}
}
Aggregations