ASF Bugzilla – Attachment 37743 Details for
Bug 65152
OS Process Sampler - Cannot "Add from Clipboard" Command parameters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Use clipboard for parameters more properly
0001-Correct-usage-of-clipboard-in-systemsamplergui.patch (text/plain), 7.05 KB, created by
Felix Schumacher
on 2021-02-23 16:25:30 UTC
(
hide
)
Description:
Use clipboard for parameters more properly
Filename:
MIME Type:
Creator:
Felix Schumacher
Created:
2021-02-23 16:25:30 UTC
Size:
7.05 KB
patch
obsolete
>From b2bc12b02189f4f421665df1e2f226717d91716f Mon Sep 17 00:00:00 2001 >From: Felix Schumacher <felix.schumacher@internetallee.de> >Date: Sun, 21 Feb 2021 18:56:33 +0100 >Subject: [PATCH] Correct usage of clipboard in systemsamplergui > >--- > .../jmeter/config/gui/ArgumentsPanel.java | 42 +++++++++++++++++-- > .../protocol/system/gui/SystemSamplerGui.java | 16 ++++--- > 2 files changed, 45 insertions(+), 13 deletions(-) > >diff --git a/src/core/src/main/java/org/apache/jmeter/config/gui/ArgumentsPanel.java b/src/core/src/main/java/org/apache/jmeter/config/gui/ArgumentsPanel.java >index f71a81254e..8e95fef540 100644 >--- a/src/core/src/main/java/org/apache/jmeter/config/gui/ArgumentsPanel.java >+++ b/src/core/src/main/java/org/apache/jmeter/config/gui/ArgumentsPanel.java >@@ -29,6 +29,7 @@ import java.awt.event.ActionListener; > import java.io.IOException; > import java.util.Collection; > import java.util.Iterator; >+import java.util.function.Function; > > import javax.swing.BorderFactory; > import javax.swing.Box; >@@ -62,7 +63,7 @@ import org.apache.jorphan.reflect.Functor; > @TestElementMetadata(labelResource = "user_defined_variables") > public class ArgumentsPanel extends AbstractConfigGui implements ActionListener { > >- private static final long serialVersionUID = 240L; >+ private static final long serialVersionUID = 241L; > > /** The title label for this component. */ > private JLabel tableLabel; >@@ -107,6 +108,8 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener > /** Disable buttons :Detail, Add, Add from Clipboard, Delete, Up and Down*/ > private final boolean disableButtons; > >+ private final Function<String[], Argument> argCreator; >+ > /** Command for adding a row to the table. */ > private static final String ADD = "add"; // $NON-NLS-1$ > >@@ -175,7 +178,7 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener > * @param label the title for the component. > */ > public ArgumentsPanel(boolean disableButtons, String label) { >- this(label, null, false, false, null, disableButtons); >+ this(label, null, false, false, null, disableButtons, null); > } > > /** >@@ -195,7 +198,7 @@ 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, false); >+ this(label, bkg, enableUpDown, standalone, null, false, null); > } > > /** >@@ -207,7 +210,20 @@ 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); >+ this(label, bkg, enableUpDown, standalone, model, null); >+ } >+ >+ /** >+ * 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 argCreator function to create {@link Argument}s from Strings taken from clipboard >+ */ >+ public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model, Function<String[], Argument> argCreator) { >+ this(label, bkg, enableUpDown, standalone, model, false, argCreator); > } > > /** >@@ -220,12 +236,27 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener > * @param disableButtons Remove all buttons > */ > public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model, boolean disableButtons) { >+ this(label, bkg, enableUpDown, standalone, model, disableButtons, null); >+ } >+ >+ /** >+ * 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 >+ * @param argCreator function to create {@link Argument}s from Strings taken from clipboard >+ */ >+ public ArgumentsPanel(String label, Color bkg, boolean enableUpDown, boolean standalone, ObjectTableModel model, boolean disableButtons, Function<String[], Argument> argCreator) { > tableLabel = new JLabel(label); > this.enableUpDown = enableUpDown; > this.disableButtons = disableButtons; > this.background = bkg; > this.standalone = standalone; > this.tableModel = model; >+ this.argCreator = argCreator; > init(); > } > >@@ -584,6 +615,9 @@ public class ArgumentsPanel extends AbstractConfigGui implements ActionListener > } > > protected Argument createArgumentFromClipboard(String[] clipboardCols) { >+ if (argCreator != null) { >+ return argCreator.apply(clipboardCols); >+ } > Argument argument = makeNewArgument(); > argument.setName(clipboardCols[0]); > if (clipboardCols.length > 1) { >diff --git a/src/protocol/native/src/main/java/org/apache/jmeter/protocol/system/gui/SystemSamplerGui.java b/src/protocol/native/src/main/java/org/apache/jmeter/protocol/system/gui/SystemSamplerGui.java >index 6c884a531b..7b43e03364 100644 >--- a/src/protocol/native/src/main/java/org/apache/jmeter/protocol/system/gui/SystemSamplerGui.java >+++ b/src/protocol/native/src/main/java/org/apache/jmeter/protocol/system/gui/SystemSamplerGui.java >@@ -213,19 +213,17 @@ public class SystemSamplerGui extends AbstractSamplerGui implements ItemListener > return panel; > } > >- > /** > * @return JPanel Arguments Panel > */ > private JPanel makeArgumentsPanel() { >- argsPanel = new ArgumentsPanel(JMeterUtils.getResString("arguments_panel_title"), null, true, false , // $NON-NLS-1$ >- new ObjectTableModel(new String[] { ArgumentsPanel.COLUMN_RESOURCE_NAMES_1 }, >- Argument.class, >- new Functor[] { >- new Functor("getValue") }, // $NON-NLS-1$ >- new Functor[] { >- new Functor("setValue") }, // $NON-NLS-1$ >- new Class[] {String.class })); >+ final ObjectTableModel objectTableModel = new ObjectTableModel( >+ new String[] { ArgumentsPanel.COLUMN_RESOURCE_NAMES_1 }, Argument.class, >+ new Functor[] { new Functor("getValue") }, // $NON-NLS-1$ >+ new Functor[] { new Functor("setValue") }, // $NON-NLS-1$ >+ new Class[] { String.class }); >+ argsPanel = new ArgumentsPanel(JMeterUtils.getResString("arguments_panel_title"), null, true, false, // $NON-NLS-1$ >+ objectTableModel, cols -> new Argument("", cols[0])); > return argsPanel; > } > >-- >2.25.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 65152
:
37740
|
37743
|
37748
|
37757