jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1416222 - in /jmeter/trunk: src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java src/core/org/apache/jmeter/resources/messages.properties src/core/org/apache/jmeter/resources/messages_fr.properties xdocs/changes.xml
Date Sun, 02 Dec 2012 18:18:43 GMT
Author: pmouawad
Date: Sun Dec  2 18:18:42 2012
New Revision: 1416222

URL: http://svn.apache.org/viewvc?rev=1416222&view=rev
Log:
Bug 54155 - ModuleController : Add a shortcut button to unfold the tree up to referenced controller
and highlight it
Bugzilla Id: 54155

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java?rev=1416222&r1=1416221&r2=1416222&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java Sun
Dec  2 18:18:42 2012
@@ -18,16 +18,22 @@
 
 package org.apache.jmeter.control.gui;
 
-import java.awt.FlowLayout;
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.util.Collection;
 import java.util.Iterator;
 
+import javax.swing.BoxLayout;
 import javax.swing.DefaultComboBoxModel;
+import javax.swing.JButton;
 import javax.swing.JComboBox;
 import javax.swing.JLabel;
 import javax.swing.JMenu;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
+import javax.swing.JTree;
+import javax.swing.tree.TreePath;
 
 import org.apache.jmeter.control.Controller;
 import org.apache.jmeter.control.ModuleController;
@@ -46,7 +52,7 @@ import org.apache.jorphan.gui.layout.Ver
  * ModuleController Gui.
  *
  */
-public class ModuleControllerGui extends AbstractControllerGui
+public class ModuleControllerGui extends AbstractControllerGui implements ActionListener
 // implements UnsharedComponent
 {
 
@@ -60,6 +66,8 @@ public class ModuleControllerGui extends
 
     private final JLabel warningLabel;
 
+    private JButton expandButton;
+
     /**
      * Initializes the gui panel for the ModuleController instance.
      */
@@ -167,18 +175,22 @@ public class ModuleControllerGui extends
         add(makeTitlePanel());
 
         // DROP-DOWN MENU
-        JPanel modulesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 5));
+        JPanel modulesPanel = new JPanel();
+        modulesPanel.setLayout(new BoxLayout(modulesPanel, BoxLayout.Y_AXIS));
         JLabel nodesLabel = new JLabel(JMeterUtils.getResString("module_controller_module_to_run"));
// $NON-NLS-1$
-        modulesPanel.add(nodesLabel);
+        modulesPanel.add(nodesLabel, BorderLayout.NORTH);
         nodesLabel.setLabelFor(nodes);
         reinitialize();
-        modulesPanel.add(nodes);
-        modulesPanel.add(warningLabel);
+        modulesPanel.add(nodes, BorderLayout.CENTER);
+        modulesPanel.add(warningLabel, BorderLayout.EAST);
+        
+        expandButton = new JButton(JMeterUtils.getResString("expand")); //$NON-NLS-1$
+        expandButton.addActionListener(this);
+        modulesPanel.add(expandButton, BorderLayout.SOUTH);
         add(modulesPanel);
     }
 
     private void reinitialize() {
-        TreeNodeWrapper current;
         nodesModel.removeAllElements();
         GuiPackage gp = GuiPackage.getInstance();
         JMeterTreeNode root;
@@ -187,6 +199,7 @@ public class ModuleControllerGui extends
             buildNodesModel(root, "", 0); // $NON-NLS-1$
         }
         if (selected != null) {
+            TreeNodeWrapper current;
             for (int i = 0; i < nodesModel.getSize(); i++) {
                 current = (TreeNodeWrapper) nodesModel.getElementAt(i);
                 if (current.getTreeNode() != null && current.getTreeNode().equals(selected))
{
@@ -228,4 +241,29 @@ public class ModuleControllerGui extends
             }
         }
     }
+
+    @Override
+    public void actionPerformed(ActionEvent e) {
+        if(e.getSource()==expandButton) {
+            JMeterTreeNode currentSelectedNode = null;
+            TreeNodeWrapper tnw = (TreeNodeWrapper) nodesModel.getSelectedItem();
+            if (tnw != null && tnw.getTreeNode() != null) {
+                currentSelectedNode = tnw.getTreeNode();
+            }
+            if (currentSelectedNode != null) {
+                expandToSelectNode(currentSelectedNode);
+            }
+            return;
+        } 
+    }
+
+    /**
+     * @param selected JMeterTreeNode tree node to expand
+     */
+    protected void expandToSelectNode(JMeterTreeNode selected) {
+        GuiPackage guiInstance = GuiPackage.getInstance();
+        JTree jTree = guiInstance.getMainFrame().getTree();
+        jTree.expandPath(new TreePath(selected.getPath()));
+        selected.setMarkedBySearch(true);
+    }
 }
\ No newline at end of file

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1416222&r1=1416221&r2=1416222&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Sun Dec  2 18:18:42
2012
@@ -262,6 +262,7 @@ evalvar_name_param=Name of variable
 example_data=Sample Data
 example_title=Example Sampler
 exit=Exit
+expand=Expand
 expected_return_code_title=Expected Return Code: 
 expiration=Expiration
 field_name=Field name

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=1416222&r1=1416221&r2=1416222&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties Sun Dec  2 18:18:42
2012
@@ -256,6 +256,7 @@ evalvar_name_param=Nom de variable
 example_data=Exemple de donn\u00E9e
 example_title=Echantillon exemple
 exit=Quitter
+expand=D\u00E9plier
 expected_return_code_title=Code retour attendu \: 
 expiration=Expiration
 field_name=Nom du champ

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1416222&r1=1416221&r2=1416222&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Dec  2 18:18:42 2012
@@ -212,6 +212,7 @@ to the elements View Results Tree, Asser
 <li><bugzilla>46677</bugzilla> - Copying Test Elements between test plans</li>
 <li><bugzilla>54204</bugzilla> - Result Status Action Handler : Add start
next thread loop option</li>
 <li><bugzilla>54232</bugzilla> - Search Feature : Add a button to search
and expand results</li>
+<li><bugzilla>54155</bugzilla> - ModuleController : Add a shortcut button
to unfold the tree up to referenced controller and highlight it</li>
 </ul>
 
 <h2>Non-functional changes</h2>



Mime
View raw message