mirror of https://github.com/apache/jmeter.git
Bug 61593 - Remove Detail, Add, Add from Clipboard, Delete buttons in Function Helper GUI
git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1811449 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3559b615dd
commit
27ee12c4b3
|
|
@ -97,7 +97,11 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
|
|||
/** Button to show the detail of an argument*/
|
||||
private JButton showDetail;
|
||||
|
||||
/** Enable Up & Down buttons */
|
||||
private final boolean enableUpDown;
|
||||
|
||||
/** Disable buttons :Detail, Add, Add from Clipboard, Delete, Up & Down*/
|
||||
private final boolean disableButtons;
|
||||
|
||||
/** Command for adding a row to the table. */
|
||||
private static final String ADD = "add"; // $NON-NLS-1$
|
||||
|
|
@ -152,6 +156,17 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
|
|||
public ArgumentsPanel(String label, boolean enableUpDown) {
|
||||
this(label, null, enableUpDown, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ArgumentsPanel as an embedded component, using the specified
|
||||
* title.
|
||||
*
|
||||
* @param disableButtons Remove Edit all buttons
|
||||
* @param label the title for the component.
|
||||
*/
|
||||
public ArgumentsPanel(boolean disableButtons, String label) {
|
||||
this(label, null, false, false, null, disableButtons);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ArgumentsPanel with a border and color background
|
||||
|
|
@ -170,9 +185,9 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
|
|||
* @param standalone is standalone
|
||||
*/
|
||||
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone) {
|
||||
this(label, bkg, enableUpDown, standalone, null);
|
||||
this(label, bkg, enableUpDown, standalone, null, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new ArgumentsPanel with a border and color background
|
||||
* @param label text for label
|
||||
|
|
@ -182,8 +197,22 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
|
|||
* @param model the table model to use
|
||||
*/
|
||||
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model) {
|
||||
this(label, bkg, enableUpDown, standalone, model, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ArgumentsPanel with a border and color background
|
||||
* @param label text for label
|
||||
* @param bkg background colour
|
||||
* @param enableUpDown Add up/down buttons
|
||||
* @param standalone is standalone
|
||||
* @param model the table model to use
|
||||
* @param disableButtons Remove all buttons
|
||||
*/
|
||||
public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model, boolean disableButtons) {
|
||||
tableLabel = new JLabel(label);
|
||||
this.enableUpDown = enableUpDown;
|
||||
this.disableButtons = disableButtons;
|
||||
this.background = bkg;
|
||||
this.standalone = standalone;
|
||||
this.tableModel = model;
|
||||
|
|
@ -297,25 +326,27 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
|
|||
}
|
||||
|
||||
protected void checkButtonsStatus() {
|
||||
// Disable DELETE if there are no rows in the table to delete.
|
||||
if (tableModel.getRowCount() == 0) {
|
||||
delete.setEnabled(false);
|
||||
showDetail.setEnabled(false);
|
||||
} else {
|
||||
delete.setEnabled(true);
|
||||
showDetail.setEnabled(true);
|
||||
if (!disableButtons) {
|
||||
// Disable DELETE if there are no rows in the table to delete.
|
||||
if (tableModel.getRowCount() == 0) {
|
||||
delete.setEnabled(false);
|
||||
showDetail.setEnabled(false);
|
||||
} else {
|
||||
delete.setEnabled(true);
|
||||
showDetail.setEnabled(true);
|
||||
}
|
||||
if(enableUpDown) {
|
||||
if(tableModel.getRowCount()>1) {
|
||||
up.setEnabled(true);
|
||||
down.setEnabled(true);
|
||||
}
|
||||
else {
|
||||
up.setEnabled(false);
|
||||
down.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(enableUpDown) {
|
||||
if(tableModel.getRowCount()>1) {
|
||||
up.setEnabled(true);
|
||||
down.setEnabled(true);
|
||||
}
|
||||
else {
|
||||
up.setEnabled(false);
|
||||
down.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -340,20 +371,23 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
|
|||
*/
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String action = e.getActionCommand();
|
||||
if (action.equals(DELETE)) {
|
||||
deleteArgument();
|
||||
} else if (action.equals(ADD)) {
|
||||
addArgument();
|
||||
} else if (action.equals(ADD_FROM_CLIPBOARD)) {
|
||||
addFromClipboard();
|
||||
} else if (action.equals(UP)) {
|
||||
moveUp();
|
||||
} else if (action.equals(DOWN)) {
|
||||
moveDown();
|
||||
} else if (action.equals(DETAIL)) {
|
||||
showDetail();
|
||||
if (!disableButtons) {
|
||||
String action = e.getActionCommand();
|
||||
if (action.equals(DELETE)) {
|
||||
deleteArgument();
|
||||
} else if (action.equals(ADD)) {
|
||||
addArgument();
|
||||
} else if (action.equals(ADD_FROM_CLIPBOARD)) {
|
||||
addFromClipboard();
|
||||
} else if (action.equals(UP)) {
|
||||
moveUp();
|
||||
} else if (action.equals(DOWN)) {
|
||||
moveDown();
|
||||
} else if (action.equals(DETAIL)) {
|
||||
showDetail();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -645,14 +679,15 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
|
|||
* @return a GUI panel containing the buttons
|
||||
*/
|
||||
private JPanel makeButtonPanel() {
|
||||
|
||||
showDetail = new JButton(JMeterUtils.getResString("detail")); // $NON-NLS-1$
|
||||
showDetail.setActionCommand(DETAIL);
|
||||
showDetail.setEnabled(true);
|
||||
|
||||
|
||||
add = new JButton(JMeterUtils.getResString("add")); // $NON-NLS-1$
|
||||
add.setActionCommand(ADD);
|
||||
add.setEnabled(true);
|
||||
|
||||
|
||||
// A button for adding new arguments to the table from the clipboard
|
||||
JButton addFromClipboard = new JButton(JMeterUtils.getResString("add_from_clipboard")); // $NON-NLS-1$
|
||||
addFromClipboard.setActionCommand(ADD_FROM_CLIPBOARD);
|
||||
|
|
@ -661,10 +696,10 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
|
|||
delete = new JButton(JMeterUtils.getResString("delete")); // $NON-NLS-1$
|
||||
delete.setActionCommand(DELETE);
|
||||
|
||||
if(enableUpDown) {
|
||||
if (enableUpDown) {
|
||||
up = new JButton(JMeterUtils.getResString("up")); // $NON-NLS-1$
|
||||
up.setActionCommand(UP);
|
||||
|
||||
|
||||
down = new JButton(JMeterUtils.getResString("down")); // $NON-NLS-1$
|
||||
down.setActionCommand(DOWN);
|
||||
}
|
||||
|
|
@ -683,7 +718,7 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
|
|||
buttonPanel.add(add);
|
||||
buttonPanel.add(addFromClipboard);
|
||||
buttonPanel.add(delete);
|
||||
if(enableUpDown) {
|
||||
if (enableUpDown) {
|
||||
up.addActionListener(this);
|
||||
down.addActionListener(this);
|
||||
buttonPanel.add(up);
|
||||
|
|
@ -711,7 +746,9 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener
|
|||
p.add(makeMainPanel(), BorderLayout.CENTER);
|
||||
// Force a minimum table height of 70 pixels
|
||||
p.add(Box.createVerticalStrut(70), BorderLayout.WEST);
|
||||
p.add(makeButtonPanel(), BorderLayout.SOUTH);
|
||||
if (!disableButtons) {
|
||||
p.add(makeButtonPanel(), BorderLayout.SOUTH);
|
||||
}
|
||||
|
||||
if (standalone) {
|
||||
add(p, BorderLayout.CENTER);
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public class FunctionHelper extends JDialog implements ActionListener, ChangeLis
|
|||
}
|
||||
|
||||
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
|
||||
parameterPanel = new ArgumentsPanel(JMeterUtils.getResString("function_params"), false); //$NON-NLS-1$
|
||||
parameterPanel = new ArgumentsPanel(true,JMeterUtils.getResString("function_params")); //$NON-NLS-1$
|
||||
initializeFunctionList();
|
||||
this.getContentPane().setLayout(new BorderLayout(10, 10));
|
||||
JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
|
||||
|
|
@ -120,7 +120,7 @@ public class FunctionHelper extends JDialog implements ActionListener, ChangeLis
|
|||
JButton generateButton = new JButton(JMeterUtils.getResString("generate")); //$NON-NLS-1$
|
||||
generateButton.addActionListener(this);
|
||||
generatePanel.add(generateButton);
|
||||
resultTextArea = JSyntaxTextArea.getInstance(5,50);
|
||||
resultTextArea = JSyntaxTextArea.getInstance(5,60);
|
||||
resultTextArea.setToolTipText(JMeterUtils.getResString("function_helper_dialog_result_warn"));
|
||||
displayPanel.add(new JLabel(JMeterUtils.getResString("result_function")));
|
||||
displayPanel.add(JTextScrollPane.getInstance(resultTextArea));
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ Summary
|
|||
<h3>Functions</h3>
|
||||
<ul>
|
||||
<li><bug>61561</bug>Function helper dialog should display exception in result</li>
|
||||
<li><bug>61593</bug>Remove Detail, Add, Add from Clipboard, Delete buttons in Function Helper GUI</li>
|
||||
</ul>
|
||||
|
||||
<h3>I18N</h3>
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 26 KiB |
Loading…
Reference in New Issue