jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject [jmeter] branch master updated: Bug 64283 - XPath2 Extractor: Improve UX
Date Sun, 29 Mar 2020 14:01:53 GMT
This is an automated email from the ASF dual-hosted git repository.

pmouawad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 4028452  Bug 64283 - XPath2 Extractor: Improve UX
4028452 is described below

commit 4028452cc64614cd185efc7bd60eb11f2e6a1bcc
Author: pmouawad <p.mouawad@ubik-ingenierie.com>
AuthorDate: Sun Mar 29 16:01:41 2020 +0200

    Bug 64283 - XPath2 Extractor: Improve UX
---
 .../jmeter/extractor/gui/XPath2ExtractorGui.java   | 101 +++++++--------------
 .../apache/jmeter/resources/messages.properties    |   1 +
 .../apache/jmeter/resources/messages_fr.properties |   1 +
 xdocs/changes.xml                                  |   1 +
 4 files changed, 38 insertions(+), 66 deletions(-)

diff --git a/src/components/src/main/java/org/apache/jmeter/extractor/gui/XPath2ExtractorGui.java
b/src/components/src/main/java/org/apache/jmeter/extractor/gui/XPath2ExtractorGui.java
index 34fa017..d869897 100644
--- a/src/components/src/main/java/org/apache/jmeter/extractor/gui/XPath2ExtractorGui.java
+++ b/src/components/src/main/java/org/apache/jmeter/extractor/gui/XPath2ExtractorGui.java
@@ -18,15 +18,11 @@
 package org.apache.jmeter.extractor.gui;
 
 import java.awt.BorderLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.util.List;
 
-import javax.swing.Box;
+import javax.swing.BorderFactory;
 import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
 import javax.swing.JPanel;
+import javax.swing.JTextField;
 
 import org.apache.jmeter.extractor.XPath2Extractor;
 import org.apache.jmeter.gui.TestElementMetadata;
@@ -35,7 +31,8 @@ import org.apache.jmeter.gui.util.JTextScrollPane;
 import org.apache.jmeter.processor.gui.AbstractPostProcessorGui;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
-import org.apache.jorphan.gui.JLabeledTextField;
+
+import net.miginfocom.swing.MigLayout;
 
 /**
  * GUI for XPath2Extractor class.
@@ -46,16 +43,13 @@ public class XPath2ExtractorGui extends AbstractPostProcessorGui{ // NOSONAR
Ign
 
     private static final long serialVersionUID = 1L;
 
-    private final JLabeledTextField defaultField = new JLabeledTextField(
-            JMeterUtils.getResString("default_value_field"));//$NON-NLS-1$
+    private final JTextField defaultField = new JTextField(25);
 
-    private final JLabeledTextField xpathQueryField = new JLabeledTextField(
-            JMeterUtils.getResString("xpath_extractor_query"));//$NON-NLS-1$
+    private final JTextField xpathQueryField = new JTextField(30);
 
-    private final JLabeledTextField matchNumberField = new JLabeledTextField(
-            JMeterUtils.getResString("match_num_field"));//$NON-NLS-1$
+    private final JTextField matchNumberField = new JTextField();
 
-    private final JLabeledTextField refNameField = new JLabeledTextField(JMeterUtils.getResString("ref_name_field"));//$NON-NLS-1$
+    private final JTextField refNameField = new JTextField(25);
 
     // Should we return fragment as text, rather than text of fragment?
     private JCheckBox getFragment;
@@ -123,64 +117,39 @@ public class XPath2ExtractorGui extends AbstractPostProcessorGui{ //
NOSONAR Ign
     private void init() { // WARNING: called from ctor so must not be overridden (i.e. must
be private or final)
         setLayout(new BorderLayout());
         setBorder(makeBorder());
-        Box box = Box.createVerticalBox();
-        box.add(makeTitlePanel());
-        box.add(createScopePanel(true, true, true));
-        box.add(makeParameterPanel());
-        add(box, BorderLayout.NORTH);
+
+        add(makeTitlePanel(), BorderLayout.NORTH);
+        add(makeParameterPanel(), BorderLayout.CENTER);
     }
 
     private JPanel makeParameterPanel() {
-        JPanel panel = new JPanel(new GridBagLayout());
-        GridBagConstraints gbc = new GridBagConstraints();
-        initConstraints(gbc);
-        addField(panel, refNameField, gbc);
-        resetContraints(gbc);
-        addField(panel, xpathQueryField, gbc);
-        resetContraints(gbc);
-        addField(panel, matchNumberField, gbc);
-        resetContraints(gbc);
-        addField(panel, defaultField, gbc);
-        resetContraints(gbc);
-        panel.add(new JLabel(JMeterUtils.getResString("xpath_extractor_user_namespaces")),
gbc.clone());
-        gbc.gridx++;
-        gbc.weightx = 1;
-        gbc.fill = GridBagConstraints.HORIZONTAL;
-        namespacesTA = JSyntaxTextArea.getInstance(5, 80);
-        panel.add(JTextScrollPane.getInstance(namespacesTA, true), gbc.clone());
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(createScopePanel(true, true, true), BorderLayout.NORTH);
+        
+        JPanel panel = new JPanel(new MigLayout("fillx, wrap 2", "[][fill,grow]"));
+        panel.setBorder(BorderFactory.createTitledBorder(
+                JMeterUtils.getResString("xpath2_extractor_properties")));
 
-        resetContraints(gbc);
-        gbc.gridwidth = 2;
-        getFragment = new JCheckBox(JMeterUtils.getResString("xpath_extractor_fragment"));//$NON-NLS-1$
-        panel.add(getFragment, gbc.clone());
-        return panel;
-    }
+        panel.add(JMeterUtils.labelFor(refNameField, "ref_name_field"));
+        panel.add(refNameField);
 
-    private void addField(JPanel panel, JLabeledTextField field, GridBagConstraints gbc)
{
-        List<JComponent> item = field.getComponentList();
-        panel.add(item.get(0), gbc.clone());
-        gbc.gridx++;
-        gbc.weightx = 1;
-        gbc.fill = GridBagConstraints.HORIZONTAL;
-        panel.add(item.get(1), gbc.clone());
-    }
+        panel.add(JMeterUtils.labelFor(xpathQueryField, "xpath_extractor_query"));
+        panel.add(xpathQueryField);
 
-    private void resetContraints(GridBagConstraints gbc) {
-        gbc.gridx = 0;
-        gbc.gridy++;
-        gbc.weightx = 0;
-        gbc.gridwidth = 1;
-        gbc.fill = GridBagConstraints.NONE;
-    }
+        panel.add(JMeterUtils.labelFor(matchNumberField, "match_num_field"));
+        panel.add(matchNumberField);
+
+        panel.add(JMeterUtils.labelFor(defaultField, "default_value_field"));
+        panel.add(defaultField);
 
-    private void initConstraints(GridBagConstraints gbc) {
-        gbc.anchor = GridBagConstraints.NORTHWEST;
-        gbc.fill = GridBagConstraints.NONE;
-        gbc.gridheight = 1;
-        gbc.gridwidth = 1;
-        gbc.gridx = 0;
-        gbc.gridy = 0;
-        gbc.weightx = 0;
-        gbc.weighty = 0;
+        namespacesTA = JSyntaxTextArea.getInstance(5, 80);
+        JTextScrollPane namespaceJSP = JTextScrollPane.getInstance(namespacesTA, true);
+        panel.add(JMeterUtils.labelFor(namespaceJSP, "xpath_extractor_user_namespaces"));
+        panel.add(namespaceJSP);
+
+        getFragment = new JCheckBox(JMeterUtils.getResString("xpath_extractor_fragment"));//$NON-NLS-1$
+        panel.add(getFragment, "span 2");
+        mainPanel.add(panel, BorderLayout.CENTER);
+        return mainPanel;
     }
 }
diff --git a/src/core/src/main/resources/org/apache/jmeter/resources/messages.properties b/src/core/src/main/resources/org/apache/jmeter/resources/messages.properties
index 662149e..feccfc7 100644
--- a/src/core/src/main/resources/org/apache/jmeter/resources/messages.properties
+++ b/src/core/src/main/resources/org/apache/jmeter/resources/messages.properties
@@ -1512,6 +1512,7 @@ xpath_tester_title=XPath Tester
 xpath_tidy_quiet=Quiet
 xpath_tidy_report_errors=Report errors
 xpath_tidy_show_warnings=Show warnings
+xpath2_extractor_properties=Extraction properties
 xpath2_extractor_title=XPath2 Extractor
 xpath2_extractor_empty_query=Empty XPath expression !
 xpath2_extractor_match_number_failure=MatchNumber out of bonds \:
diff --git a/src/core/src/main/resources/org/apache/jmeter/resources/messages_fr.properties
b/src/core/src/main/resources/org/apache/jmeter/resources/messages_fr.properties
index a09d15f..5dab3c4 100644
--- a/src/core/src/main/resources/org/apache/jmeter/resources/messages_fr.properties
+++ b/src/core/src/main/resources/org/apache/jmeter/resources/messages_fr.properties
@@ -1501,6 +1501,7 @@ xpath_tester_title=Testeur XPath
 xpath_tidy_quiet=Silencieux
 xpath_tidy_report_errors=Rapporter les erreurs
 xpath_tidy_show_warnings=Afficher les alertes
+xpath2_extractor_properties=Propriétés d'extraction
 xpath2_extractor_title=Extracteur XPath2
 xpath2_extractor_empty_query=Expression XPath vide !
 xpath2_extractor_match_number_failure=Correspondance hors de portée :
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index c948c13..9a7bab0 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -132,6 +132,7 @@ For instance: log viewer, JSR223 code editor were not previously scaled
with zoo
 <ul>
     <li><bug>64091</bug>Precise Throughput Timer schedule generation is
improved significantly (e.g. 2 seconds for 10M samples)</li>
     <li><bug>64281</bug>Counter Config: Improve UX</li>
+    <li><bug>64283</bug>XPath2 Extractor: Improve UX</li>
 </ul>
 
 <h3>Functions</h3>


Mime
View raw message