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 64638 - JSON JMESPath Assertion / JSON Assertion: Opening GUI shows a horizontal scrollbar that keeps sliding
Date Sun, 02 Aug 2020 17:10:25 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 c037ee5  Bug 64638 - JSON JMESPath Assertion / JSON Assertion: Opening GUI shows
a horizontal scrollbar that keeps sliding
c037ee5 is described below

commit c037ee577a03a895de1b5e0163b34db01e6eb4ac
Author: pmouawad <p.mouawad@ubik-ingenierie.com>
AuthorDate: Sun Aug 2 19:09:41 2020 +0200

    Bug 64638 - JSON JMESPath Assertion / JSON Assertion: Opening GUI shows
    a horizontal scrollbar that keeps sliding
    
    
    Fix issue and rework UI
---
 .../assertions/gui/JSONPathAssertionGui.java       | 63 +++++++++++++---------
 .../jmespath/gui/JMESPathAssertionGui.java         | 43 +++++++++++----
 xdocs/changes.xml                                  |  1 +
 3 files changed, 71 insertions(+), 36 deletions(-)

diff --git a/src/components/src/main/java/org/apache/jmeter/assertions/gui/JSONPathAssertionGui.java
b/src/components/src/main/java/org/apache/jmeter/assertions/gui/JSONPathAssertionGui.java
index e3b0b3e..3c9efeb 100644
--- a/src/components/src/main/java/org/apache/jmeter/assertions/gui/JSONPathAssertionGui.java
+++ b/src/components/src/main/java/org/apache/jmeter/assertions/gui/JSONPathAssertionGui.java
@@ -19,19 +19,21 @@ package org.apache.jmeter.assertions.gui;
 
 import java.awt.BorderLayout;
 
-import javax.swing.BorderFactory;
 import javax.swing.JCheckBox;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
 import org.apache.jmeter.assertions.JSONPathAssertion;
 import org.apache.jmeter.gui.GUIMenuSortOrder;
 import org.apache.jmeter.gui.TestElementMetadata;
-import org.apache.jmeter.gui.util.VerticalPanel;
+import org.apache.jmeter.gui.util.JSyntaxTextArea;
+import org.apache.jmeter.gui.util.JTextScrollPane;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
-import org.apache.jorphan.gui.JLabeledTextArea;
-import org.apache.jorphan.gui.JLabeledTextField;
+
+import net.miginfocom.swing.MigLayout;
 
 /**
  * Java class representing GUI for the {@link JSONPathAssertion} component in JMeter
@@ -50,8 +52,8 @@ public class JSONPathAssertionGui extends AbstractAssertionGui implements
Change
     private static final String JSON_ASSERTION_INVERT = "json_assertion_invert";
     private static final String JSON_ASSERTION_TITLE = "json_assertion_title";
 
-    protected JLabeledTextField jsonPath = null;
-    protected JLabeledTextArea jsonValue = null;
+    protected JTextField jsonPath = null;
+    protected JSyntaxTextArea jsonValue = null;
     protected JCheckBox jsonValidation = null;
     protected JCheckBox expectNull = null;
     protected JCheckBox invert = null;
@@ -66,31 +68,40 @@ public class JSONPathAssertionGui extends AbstractAssertionGui implements
Change
         setBorder(makeBorder());
         add(makeTitlePanel(), BorderLayout.NORTH);
 
-        VerticalPanel panel = new VerticalPanel();
-        panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
-
-        initFields();
+        JPanel panel = buildPanel();
+        add(panel, BorderLayout.CENTER);
 
         jsonValidation.addChangeListener(this);
         expectNull.addChangeListener(this);
-
-        panel.add(jsonPath);
-        panel.add(jsonValidation);
-        panel.add(isRegex);
-        panel.add(jsonValue);
-        panel.add(expectNull);
-        panel.add(invert);
-
-        add(panel, BorderLayout.CENTER);
     }
 
-    protected void initFields() {
-        jsonPath =  new JLabeledTextField(JMeterUtils.getResString(JSON_ASSERTION_PATH));
-        jsonValue = new JLabeledTextArea(JMeterUtils.getResString(JSON_ASSERTION_EXPECTED_VALUE));
-        jsonValidation = new JCheckBox(JMeterUtils.getResString(JSON_ASSERTION_VALIDATION));
-        expectNull = new JCheckBox(JMeterUtils.getResString(JSON_ASSERTION_NULL));
-        invert = new JCheckBox(JMeterUtils.getResString(JSON_ASSERTION_INVERT));
-        isRegex = new JCheckBox(JMeterUtils.getResString(JSON_ASSERTION_REGEX));
+    protected JPanel buildPanel() {
+        JPanel panel = new JPanel(new MigLayout("fillx, wrap 2, insets 0", "[][fill,grow]"));
+
+        jsonPath =  new JTextField();
+        panel.add(JMeterUtils.labelFor(jsonPath, JSON_ASSERTION_PATH));
+        panel.add(jsonPath, "span, growx");
+
+        jsonValidation = new JCheckBox();
+        panel.add(JMeterUtils.labelFor(jsonValidation, JSON_ASSERTION_VALIDATION));
+        panel.add(jsonValidation, "span");
+
+        isRegex = new JCheckBox();
+        panel.add(JMeterUtils.labelFor(isRegex, JSON_ASSERTION_REGEX));
+        panel.add(isRegex, "span");
+
+        jsonValue =  JSyntaxTextArea.getInstance(5, 60);
+        panel.add(JMeterUtils.labelFor(jsonValue, JSON_ASSERTION_EXPECTED_VALUE));
+        panel.add(JTextScrollPane.getInstance(jsonValue));
+
+        expectNull = new JCheckBox();
+        panel.add(JMeterUtils.labelFor(expectNull, JSON_ASSERTION_NULL));
+        panel.add(expectNull, "span");
+        
+        invert = new JCheckBox();
+        panel.add(JMeterUtils.labelFor(invert, JSON_ASSERTION_INVERT));
+        panel.add(invert, "span");
+        return panel;
     }
 
     @Override
diff --git a/src/components/src/main/java/org/apache/jmeter/assertions/jmespath/gui/JMESPathAssertionGui.java
b/src/components/src/main/java/org/apache/jmeter/assertions/jmespath/gui/JMESPathAssertionGui.java
index 68cd049..dfdefea 100644
--- a/src/components/src/main/java/org/apache/jmeter/assertions/jmespath/gui/JMESPathAssertionGui.java
+++ b/src/components/src/main/java/org/apache/jmeter/assertions/jmespath/gui/JMESPathAssertionGui.java
@@ -18,14 +18,18 @@
 package org.apache.jmeter.assertions.jmespath.gui;
 
 import javax.swing.JCheckBox;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
 
 import org.apache.jmeter.assertions.gui.JSONPathAssertionGui;
 import org.apache.jmeter.assertions.jmespath.JMESPathAssertion;
 import org.apache.jmeter.gui.TestElementMetadata;
+import org.apache.jmeter.gui.util.JSyntaxTextArea;
+import org.apache.jmeter.gui.util.JTextScrollPane;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
-import org.apache.jorphan.gui.JLabeledTextArea;
-import org.apache.jorphan.gui.JLabeledTextField;
+
+import net.miginfocom.swing.MigLayout;
 
 /**
  * Java class representing GUI for the {@link JMESPathAssertion} component in
@@ -56,14 +60,33 @@ public class JMESPathAssertionGui extends JSONPathAssertionGui {
     }
 
     @Override
-    protected final void initFields() {
-        // get the superclass fields and set their name to current component fields.
-        super.jsonPath = new JLabeledTextField(JMeterUtils.getResString(JMES_ASSERTION_PATH));
-        super.jsonValue = new JLabeledTextArea(JMeterUtils.getResString(JMES_ASSERTION_EXPECTED_VALUE));
-        super.jsonValidation = new JCheckBox(JMeterUtils.getResString(JMES_ASSERTION_VALIDATION));
-        super.expectNull = new JCheckBox(JMeterUtils.getResString(JMES_ASSERTION_NULL));
-        super.invert = new JCheckBox(JMeterUtils.getResString(JMES_ASSERTION_INVERT));
-        super.isRegex = new JCheckBox(JMeterUtils.getResString(JMES_ASSERTION_REGEX));
+    protected JPanel buildPanel() {
+        JPanel panel = new JPanel(new MigLayout("fillx, wrap 2, insets 0", "[][fill,grow]"));
+
+        jsonPath =  new JTextField();
+        panel.add(JMeterUtils.labelFor(jsonPath, JMES_ASSERTION_PATH));
+        panel.add(jsonPath, "span, growx");
+
+        jsonValidation = new JCheckBox();
+        panel.add(JMeterUtils.labelFor(jsonValidation, JMES_ASSERTION_VALIDATION));
+        panel.add(jsonValidation, "span");
+
+        isRegex = new JCheckBox();
+        panel.add(JMeterUtils.labelFor(isRegex, JMES_ASSERTION_REGEX));
+        panel.add(isRegex, "span");
+
+        jsonValue =  JSyntaxTextArea.getInstance(5, 60);
+        panel.add(JMeterUtils.labelFor(jsonValue, JMES_ASSERTION_EXPECTED_VALUE));
+        panel.add(JTextScrollPane.getInstance(jsonValue));
+
+        expectNull = new JCheckBox();
+        panel.add(JMeterUtils.labelFor(expectNull, JMES_ASSERTION_NULL));
+        panel.add(expectNull, "span");
+        
+        invert = new JCheckBox();
+        panel.add(JMeterUtils.labelFor(invert, JMES_ASSERTION_INVERT));
+        panel.add(invert, "span");
+        return panel;
     }
 
     /**
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index e2cf4e6..e06248c 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -150,6 +150,7 @@ Summary
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>
 <ul>
+    <li><bug>64638</bug>JSON JMESPath Assertion / JSON Assertion: Opening
GUI shows a horizontal scrollbar that keeps sliding</li>
 </ul>
 
 <h3>Functions</h3>


Mime
View raw message