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 4c1e1e6  Bug 64277 - ForEach Controller: Improve UX
4c1e1e6 is described below

commit 4c1e1e6c27f162913312129abfbb3e2a43281900
Author: pmouawad <p.moua...@ubik-ingenierie.com>
AuthorDate: Sun Mar 29 00:12:55 2020 +0100

    Bug 64277 - ForEach Controller: Improve UX
---
 src/components/build.gradle.kts                    |  1 +
 .../jmeter/control/gui/ForeachControlPanel.java    | 46 +++++++---------------
 xdocs/changes.xml                                  |  1 +
 3 files changed, 17 insertions(+), 31 deletions(-)

diff --git a/src/components/build.gradle.kts b/src/components/build.gradle.kts
index f4a6377..be2ed36 100644
--- a/src/components/build.gradle.kts
+++ b/src/components/build.gradle.kts
@@ -61,6 +61,7 @@ dependencies {
     implementation("org.apache.commons:commons-text") {
         because("StringEscapeUtils")
     }
+    implementation("com.miglayout:miglayout-swing")
     // we use bcmail for compilation only, and bcmail is not shipped in the 
release
     compileOnly("org.bouncycastle:bcmail-jdk15on")
     compileOnly("org.bouncycastle:bcpkix-jdk15on")
diff --git 
a/src/components/src/main/java/org/apache/jmeter/control/gui/ForeachControlPanel.java
 
b/src/components/src/main/java/org/apache/jmeter/control/gui/ForeachControlPanel.java
index 229d43b..ca0c4d6 100644
--- 
a/src/components/src/main/java/org/apache/jmeter/control/gui/ForeachControlPanel.java
+++ 
b/src/components/src/main/java/org/apache/jmeter/control/gui/ForeachControlPanel.java
@@ -19,17 +19,18 @@ package org.apache.jmeter.control.gui;
 
 import java.awt.BorderLayout;
 
+import javax.swing.BorderFactory;
 import javax.swing.JCheckBox;
-import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 
 import org.apache.jmeter.control.ForeachController;
 import org.apache.jmeter.gui.TestElementMetadata;
-import org.apache.jmeter.gui.util.VerticalPanel;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
 
+import net.miginfocom.swing.MigLayout;
+
 /**
  * The user interface for a foreach controller which specifies that its
  * sub-components should be executed some number of times in a loop. This
@@ -190,53 +191,36 @@ public class ForeachControlPanel extends 
AbstractControllerGui {
      * @return a GUI panel containing the loop count components
      */
     private JPanel createLoopCountPanel() {
-        VerticalPanel loopPanel = new VerticalPanel();
-
-        // LOOP LABEL
-        JLabel inputValLabel = new 
JLabel(JMeterUtils.getResString("foreach_input")); // $NON-NLS-1$
-        JLabel startIndexLabel = new 
JLabel(JMeterUtils.getResString("foreach_start_index")); // $NON-NLS-1$
-        JLabel endIndexLabel = new 
JLabel(JMeterUtils.getResString("foreach_end_index")); // $NON-NLS-1$
-        JLabel returnValLabel = new 
JLabel(JMeterUtils.getResString("foreach_output")); // $NON-NLS-1$
+        JPanel loopPanel = new JPanel(new MigLayout("fillx, wrap 2", 
"[][fill,grow]"));
+        loopPanel.setBorder(BorderFactory.createEtchedBorder()); // $NON-NLS-1$
 
         // TEXT FIELD
-        JPanel inputValSubPanel = new JPanel(new BorderLayout(5, 0));
         inputVal = new JTextField("", 5); // $NON-NLS-1$
+        loopPanel.add(JMeterUtils.labelFor(inputVal, "foreach_input"));
         inputVal.setName(INPUT_VAL_NAME);
-        inputValLabel.setLabelFor(inputVal);
-        inputValSubPanel.add(inputValLabel, BorderLayout.WEST);
-        inputValSubPanel.add(inputVal, BorderLayout.CENTER);
+        loopPanel.add(inputVal);
 
         // TEXT FIELD
-        JPanel startIndexSubPanel = new JPanel(new BorderLayout(5, 0));
         startIndex = new JTextField("", 5); // $NON-NLS-1$
+        loopPanel.add(JMeterUtils.labelFor(startIndex, "foreach_start_index"));
         startIndex.setName(START_INDEX_NAME);
-        startIndexLabel.setLabelFor(startIndex);
-        startIndexSubPanel.add(startIndexLabel, BorderLayout.WEST);
-        startIndexSubPanel.add(startIndex, BorderLayout.CENTER);
+        loopPanel.add(startIndex);
 
         // TEXT FIELD
-        JPanel endIndexSubPanel = new JPanel(new BorderLayout(5, 0));
         endIndex = new JTextField("", 5); // $NON-NLS-1$
+        loopPanel.add(JMeterUtils.labelFor(endIndex, "foreach_end_index"));
         endIndex.setName(END_INDEX_NAME);
-        endIndexLabel.setLabelFor(endIndex);
-        endIndexSubPanel.add(endIndexLabel, BorderLayout.WEST);
-        endIndexSubPanel.add(endIndex, BorderLayout.CENTER);
-
+        loopPanel.add(endIndex);
+        
         // TEXT FIELD
-        JPanel returnValSubPanel = new JPanel(new BorderLayout(5, 0));
         returnVal = new JTextField("", 5); // $NON-NLS-1$
+        loopPanel.add(JMeterUtils.labelFor(returnVal, "foreach_output"));
         returnVal.setName(RETURN_VAL_NAME);
-        returnValLabel.setLabelFor(returnVal);
-        returnValSubPanel.add(returnValLabel, BorderLayout.WEST);
-        returnValSubPanel.add(returnVal, BorderLayout.CENTER);
+        loopPanel.add(returnVal);
 
         // Checkbox
         useSeparator = new 
JCheckBox(JMeterUtils.getResString("foreach_use_separator"), true); // 
$NON-NLS-1$
-        loopPanel.add(inputValSubPanel);
-        loopPanel.add(startIndexSubPanel);
-        loopPanel.add(endIndexSubPanel);
-        loopPanel.add(returnValSubPanel);
-        loopPanel.add(useSeparator);
+        loopPanel.add(useSeparator, "span 2");
 
         return loopPanel;
     }
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 3794ab2..f652130 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -152,6 +152,7 @@ For instance: log viewer, JSR223 code editor were not 
previously scaled with zoo
   <li><bug>64148</bug>Use gray icons for disabled elements in the tree, 
display subtree as gray</li>
   <li><bug>64198</bug>Allow spaces in <code>${...}</code> expressions around 
functions.</li>
   <li><bug>64276</bug>Search popup: Improve UX</li>
+  <li><bug>64277</bug>ForEach Controller: Improve UX</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>

Reply via email to