Author: sebb
Date: Fri May  4 03:14:30 2007
New Revision: 535151

URL: http://svn.apache.org/viewvc?view=rev&rev=535151
Log:
Bug 42325 - Implement the "clear" method for the LogicControllers

Modified:
    
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/IfControllerPanel.java
    
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/LoopControlPanel.java
    
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/RunTimeGui.java
    
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/WhileControllerGui.java

Modified: 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/IfControllerPanel.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/IfControllerPanel.java?view=diff&rev=535151&r1=535150&r2=535151
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/IfControllerPanel.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/IfControllerPanel.java
 Fri May  4 03:14:30 2007
@@ -38,12 +38,11 @@
  * standalone or embedded into some other component.
  * 
  * @author Cyrus Montakab
- * @version $Revision$ $Date$
  */
 
 public class IfControllerPanel extends AbstractControllerGui implements 
ActionListener {
 
-       private static final String CONDITION_LABEL = "if_controller_label";
+       private static final String CONDITION_LABEL = "if_controller_label"; // 
$NON-NLS-1$
 
        /**
         * A field allowing the user to specify the number of times the 
controller
@@ -59,7 +58,7 @@
        private boolean displayName = true;
 
        /** The name of the loops field component. */
-       private static final String CONDITION = "JS_Condition";
+       private static final String CONDITION = "JS_Condition"; // $NON-NLS-1$
 
        /**
         * Create a new LoopControlPanel as a standalone component.
@@ -118,10 +117,18 @@
                        if (theCondition.getText().length() > 0) {
                                ((IfController) 
controller).setCondition(theCondition.getText());
                        } else {
-                               ((IfController) controller).setCondition("");
+                               ((IfController) controller).setCondition(""); 
// $NON-NLS-1$
                        }
                }
        }
+    
+    /**
+     * Implements JMeterGUIComponent.clear
+     */
+    public void clear() {
+        super.clear();
+        theCondition.setText(""); // $NON-NLS-1$
+    }
 
        /**
         * Invoked when an action occurs. This implementation assumes that the
@@ -135,7 +142,7 @@
        }
 
        public String getLabelResource() {
-               return "if_controller_title";
+               return "if_controller_title"; // $NON-NLS-1$
        }
 
        /**
@@ -172,7 +179,7 @@
                conditionPanel.add(conditionLabel, BorderLayout.WEST);
 
                // TEXT FIELD
-               theCondition = new JTextField("");
+               theCondition = new JTextField(""); // $NON-NLS-1$
                theCondition.setName(CONDITION);
                conditionLabel.setLabelFor(theCondition);
                conditionPanel.add(theCondition, BorderLayout.CENTER);

Modified: 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/LoopControlPanel.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/LoopControlPanel.java?view=diff&rev=535151&r1=535150&r2=535151
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/LoopControlPanel.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/LoopControlPanel.java
 Fri May  4 03:14:30 2007
@@ -38,7 +38,6 @@
  * should be executed some number of times in a loop. This component can be 
used
  * standalone or embedded into some other component.
  * 
- * @version $Revision$ on $Date$
  */
 
 public class LoopControlPanel extends AbstractControllerGui implements 
ActionListener {
@@ -62,10 +61,10 @@
        private boolean displayName = true;
 
        /** The name of the infinite checkbox component. */
-       private static final String INFINITE = "Infinite Field";
+       private static final String INFINITE = "Infinite Field"; // $NON-NLS-1$
 
        /** The name of the loops field component. */
-       private static final String LOOPS = "Loops Field";
+       private static final String LOOPS = "Loops Field"; // $NON-NLS-1$
 
        /**
         * Create a new LoopControlPanel as a standalone component.
@@ -127,6 +126,16 @@
                }
        }
 
+    /**
+     * Implements JMeterGUIComponent.clear
+     */
+    public void clear() {
+        super.clear();
+        
+        loops.setText("1"); // $NON-NLS-1$
+        infinite.setSelected(false);
+    }
+
        /**
         * Invoked when an action occurs. This implementation assumes that the
         * target component is the infinite loops checkbox.
@@ -136,7 +145,7 @@
         */
        public void actionPerformed(ActionEvent event) {
                if (infinite.isSelected()) {
-                       loops.setText("");
+                       loops.setText(""); // $NON-NLS-1$
                        loops.setEnabled(false);
                } else {
                        loops.setEnabled(true);
@@ -145,7 +154,7 @@
        }
 
        public String getLabelResource() {
-               return "loop_controller_title";
+               return "loop_controller_title"; // $NON-NLS-1$
        }
 
        /**
@@ -184,19 +193,19 @@
                JPanel loopPanel = new JPanel(new BorderLayout(5, 0));
 
                // LOOP LABEL
-               JLabel loopsLabel = new 
JLabel(JMeterUtils.getResString("iterator_num"));
+               JLabel loopsLabel = new 
JLabel(JMeterUtils.getResString("iterator_num")); // $NON-NLS-1$
                loopPanel.add(loopsLabel, BorderLayout.WEST);
 
                JPanel loopSubPanel = new JPanel(new BorderLayout(5, 0));
 
                // TEXT FIELD
-               loops = new JTextField("1", 5);
+               loops = new JTextField("1", 5); // $NON-NLS-1$
                loops.setName(LOOPS);
                loopsLabel.setLabelFor(loops);
                loopSubPanel.add(loops, BorderLayout.CENTER);
 
                // FOREVER CHECKBOX
-               infinite = new JCheckBox(JMeterUtils.getResString("infinite"));
+               infinite = new JCheckBox(JMeterUtils.getResString("infinite")); 
// $NON-NLS-1$
                infinite.setActionCommand(INFINITE);
                infinite.addActionListener(this);
                loopSubPanel.add(infinite, BorderLayout.WEST);
@@ -220,7 +229,7 @@
         *            the String representation of the number of loops
         */
        private void setState(String loopCount) {
-               if (loopCount.startsWith("-")) {
+               if (loopCount.startsWith("-")) { // $NON-NLS-1$
                        setState(-1);
                } else {
                        loops.setText(loopCount);
@@ -241,11 +250,11 @@
                if (loopCount <= -1) {
                        infinite.setSelected(true);
                        loops.setEnabled(false);
-                       loops.setText("");
+                       loops.setText(""); // $NON-NLS-1$
                } else {
                        infinite.setSelected(false);
                        loops.setEnabled(true);
-                       loops.setText("" + loopCount);
+                       loops.setText(Integer.toString(loopCount));
                }
        }
 }

Modified: 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/RunTimeGui.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/RunTimeGui.java?view=diff&rev=535151&r1=535150&r2=535151
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/RunTimeGui.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/RunTimeGui.java
 Fri May  4 03:14:30 2007
@@ -113,6 +113,15 @@
                }
        }
 
+    /**
+     * Implements JMeterGUIComponent.clear
+     */
+    public void clear() {
+        super.clear();
+        
+        seconds.setText("1"); // $NON-NLS-1$
+    }
+
        /**
         * Invoked when an action occurs. This implementation assumes that the
         * target component is the infinite seconds checkbox.
@@ -125,7 +134,7 @@
        }
 
        public String getLabelResource() {
-               return "runtime_controller_title";
+               return "runtime_controller_title"; // $NON-NLS-1$
        }
 
        /**
@@ -164,13 +173,13 @@
                JPanel loopPanel = new JPanel(new BorderLayout(5, 0));
 
                // SECONDS LABEL
-               JLabel secondsLabel = new 
JLabel(JMeterUtils.getResString("runtime_seconds"));
+               JLabel secondsLabel = new 
JLabel(JMeterUtils.getResString("runtime_seconds")); // $NON-NLS-1$
                loopPanel.add(secondsLabel, BorderLayout.WEST);
 
                JPanel loopSubPanel = new JPanel(new BorderLayout(5, 0));
 
                // TEXT FIELD
-               seconds = new JTextField("60", 5);
+               seconds = new JTextField("1", 5); // $NON-NLS-1$
                secondsLabel.setLabelFor(seconds);
                loopSubPanel.add(seconds, BorderLayout.CENTER);
 
@@ -207,6 +216,6 @@
         */
        private void setState(long secsCount) {
                seconds.setEnabled(true);
-               seconds.setText("" + secsCount);
+               seconds.setText("" + secsCount); // $NON-NLS-1$
        }
 }

Modified: 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/WhileControllerGui.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/WhileControllerGui.java?view=diff&rev=535151&r1=535150&r2=535151
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/WhileControllerGui.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/gui/WhileControllerGui.java
 Fri May  4 03:14:30 2007
@@ -34,7 +34,7 @@
 
 public class WhileControllerGui extends AbstractControllerGui implements 
ActionListener {
 
-       private static final String CONDITION_LABEL = "while_controller_label";
+       private static final String CONDITION_LABEL = "while_controller_label"; 
// $NON-NLS-1$
 
        /**
         * A field allowing the user to specify the condition (not yet used).
@@ -42,7 +42,7 @@
        private JTextField theCondition;
 
        /** The name of the condition field component. */
-       private static final String CONDITION = "While_Condition";
+       private static final String CONDITION = "While_Condition"; // 
$NON-NLS-1$
 
        /**
         * Create a new LoopControlPanel as a standalone component.
@@ -86,11 +86,19 @@
                        if (theCondition.getText().length() > 0) {
                                ((WhileController) 
controller).setCondition(theCondition.getText());
                        } else {
-                               ((WhileController) controller).setCondition("");
+                               ((WhileController) 
controller).setCondition(""); // $NON-NLS-1$
                        }
                }
        }
 
+    /**
+     * Implements JMeterGUIComponent.clear
+     */
+    public void clear() {
+        super.clear();
+        theCondition.setText(""); // $NON-NLS-1$
+    }
+
        /**
         * Invoked when an action occurs. This implementation assumes that the
         * target component is the infinite loops checkbox.
@@ -103,7 +111,7 @@
        }
 
        public String getLabelResource() {
-               return "while_controller_title";
+               return "while_controller_title"; // $NON-NLS-1$
        }
 
        /**
@@ -133,8 +141,8 @@
                conditionPanel.add(conditionLabel, BorderLayout.WEST);
 
                // TEXT FIELD
-               theCondition = new JTextField(""); // This means exit if last 
sample
-                                                                               
        // failed
+               // This means exit if last sample failed
+               theCondition = new JTextField("");  // $NON-NLS-1$
                theCondition.setName(CONDITION);
                conditionLabel.setLabelFor(theCondition);
                conditionPanel.add(theCondition, BorderLayout.CENTER);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to