jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1532713 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/MainFrame.java src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java src/core/org/apache/jmeter/gui/util/JMeterToolBar.java xdocs/changes.xml
Date Wed, 16 Oct 2013 10:52:25 GMT
Author: pmouawad
Date: Wed Oct 16 10:52:24 2013
New Revision: 1532713

URL: http://svn.apache.org/r1532713
Log:
Bug 55657 - Remote and Local Stop/Shutdown buttons state does not take into account local
/ remote status 
Bugzilla Id: 55657

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterToolBar.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java?rev=1532713&r1=1532712&r2=1532713&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java Wed Oct 16 10:52:24 2013
@@ -104,7 +104,7 @@ public class MainFrame extends JFrame im
 
     // This is used to keep track of local (non-remote) tests
     // The name is chosen to be an unlikely host-name
-    private static final String LOCAL = "*local*"; // $NON-NLS-1$
+    public static final String LOCAL = "*local*"; // $NON-NLS-1$
 
     // The application name
     private static final String DEFAULT_APP_NAME = "Apache JMeter"; // $NON-NLS-1$
@@ -407,7 +407,11 @@ public class MainFrame extends JFrame im
         activeThreads.setText("0"); // $NON-NLS-1$
         totalThreads.setText("0"); // $NON-NLS-1$
         menuBar.setRunning(true, host);
-        toolbar.setTestStarted(true);
+        if(LOCAL.equals(host)) {
+            toolbar.setLocalTestStarted(true);
+        } else {
+            toolbar.setRemoteTestStarted(true);
+        }
     }
 
     /**
@@ -436,7 +440,11 @@ public class MainFrame extends JFrame im
             JMeterContextService.endTest();
         }
         menuBar.setRunning(false, host);
-        toolbar.setTestStarted(false);
+        if(LOCAL.equals(host)) {
+            toolbar.setLocalTestStarted(false);
+        } else {
+            toolbar.setRemoteTestStarted(false);
+        }
         if (stoppingMessage != null) {
             stoppingMessage.dispose();
             stoppingMessage = null;

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java?rev=1532713&r1=1532712&r2=1532713&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java Wed Oct 16 10:52:24
2013
@@ -583,7 +583,9 @@ public class JMeterMenuBar extends JMenu
     
     public void setRunning(boolean running, String host) {
         log.info("setRunning(" + running + "," + host + ")");
-
+        if(org.apache.jmeter.gui.MainFrame.LOCAL.equals(host)) {
+            return;
+        }
         Iterator<JMenuItem> iter = remote_engine_start.iterator();
         Iterator<JMenuItem> iter2 = remote_engine_stop.iterator();
         Iterator<JMenuItem> iter3 = remote_engine_exit.iterator();

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterToolBar.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterToolBar.java?rev=1532713&r1=1532712&r2=1532713&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterToolBar.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterToolBar.java Wed Oct 16 10:52:24
2013
@@ -93,7 +93,7 @@ public class JMeterToolBar extends JTool
                     toolBar.add(makeButtonItemRes(iconToolbarBean));
                 }
             }
-            toolBar.setTestStarted(false);
+            toolBar.initButtonsState();
         }
     }
     
@@ -184,7 +184,8 @@ public class JMeterToolBar extends JTool
      * Change state of buttons
      * @param started
      */
-    public void setTestStarted(boolean started) {
+    public void initButtonsState() {
+        final boolean started = false;
         Map<String, Boolean> buttonStates = new HashMap<String, Boolean>();
         buttonStates.put(ActionNames.ACTION_START,Boolean.valueOf(!started));
         buttonStates.put(ActionNames.ACTION_START_NO_TIMERS,Boolean.valueOf(!started));
@@ -204,4 +205,48 @@ public class JMeterToolBar extends JTool
             }
         }
     }
+    
+    
+    /**
+     * Change state of buttons on local test
+     * @param started
+     */
+    public void setLocalTestStarted(boolean started) {
+        Map<String, Boolean> buttonStates = new HashMap<String, Boolean>(3);
+        buttonStates.put(ActionNames.ACTION_START,Boolean.valueOf(!started));
+        buttonStates.put(ActionNames.ACTION_START_NO_TIMERS,Boolean.valueOf(!started));
+        buttonStates.put(ActionNames.ACTION_STOP,Boolean.valueOf(started));
+        buttonStates.put(ActionNames.ACTION_SHUTDOWN,Boolean.valueOf(started));
+        Component[] components = getComponents();
+        for (int i = 0; i < components.length; i++) {
+            if(components[i]instanceof JButton) {
+                JButton button = (JButton) components[i];
+                Boolean enabled = buttonStates.get(button.getActionCommand());
+                if(enabled != null) {
+                    button.setEnabled(enabled.booleanValue());
+                }
+            }
+        }
+    }
+    
+    /**
+     * Change state of buttons on remote test
+     * @param started
+     */
+    public void setRemoteTestStarted(boolean started) {
+        Map<String, Boolean> buttonStates = new HashMap<String, Boolean>(3);
+        buttonStates.put(ActionNames.REMOTE_START_ALL,Boolean.valueOf(!started));
+        buttonStates.put(ActionNames.REMOTE_STOP_ALL,Boolean.valueOf(started));
+        buttonStates.put(ActionNames.REMOTE_SHUT_ALL,Boolean.valueOf(started));
+        Component[] components = getComponents();
+        for (int i = 0; i < components.length; i++) {
+            if(components[i]instanceof JButton) {
+                JButton button = (JButton) components[i];
+                Boolean enabled = buttonStates.get(button.getActionCommand());
+                if(enabled != null) {
+                    button.setEnabled(enabled.booleanValue());
+                }
+            }
+        }
+    }
 }
\ No newline at end of file

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1532713&r1=1532712&r2=1532713&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Wed Oct 16 10:52:24 2013
@@ -420,6 +420,7 @@ If you use any plugin or third-party cod
 <li><bugzilla>55580</bugzilla> -  Help pane does not scroll to start for
&lt;a href="#"&gt; links</li>
 <li><bugzilla>55600</bugzilla> - JSyntaxTextArea : Strange behaviour on
first undo</li>
 <li><bugzilla>55655</bugzilla> - NullPointerException when Remote stopping
/shutdown all if one engine did not start correctly. Contributed by UBIK Load Pack (support
at ubikloadpack.com)</li>
+<li><bugzilla>55657</bugzilla> - Remote and Local Stop/Shutdown buttons
state does not take into account local / remote status </li>
 </ul>
 
 <!-- =================== Improvements =================== -->



Mime
View raw message