jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1683017 - in /jmeter/trunk: build.xml src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java
Date Mon, 01 Jun 2015 22:41:12 GMT
Author: sebb
Date: Mon Jun  1 22:41:11 2015
New Revision: 1683017

URL: http://svn.apache.org/r1683017
Log:
Tab police

Modified:
    jmeter/trunk/build.xml
    jmeter/trunk/src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java

Modified: jmeter/trunk/build.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/build.xml?rev=1683017&r1=1683016&r2=1683017&view=diff
==============================================================================
--- jmeter/trunk/build.xml (original)
+++ jmeter/trunk/build.xml Mon Jun  1 22:41:11 2015
@@ -443,8 +443,8 @@
     <pathelement location="${lib.dir}/${commons-logging.jar}"/>
     <pathelement location="${lib.dir}/${commons-math3.jar}"/>
     <pathelement location="${lib.dir}/${commons-net.jar}"/>
-  	<pathelement location="${lib.dir}/${commons-pool2.jar}"/>
-  	<pathelement location="${lib.dir}/${dnsjava.jar}"/>
+    <pathelement location="${lib.dir}/${commons-pool2.jar}"/>
+    <pathelement location="${lib.dir}/${dnsjava.jar}"/>
     <pathelement location="${lib.dir}/${excalibur-datasource.jar}"/>
     <pathelement location="${lib.dir}/${excalibur-instrument.jar}"/>
     <pathelement location="${lib.dir}/${excalibur-logger.jar}"/>
@@ -2260,11 +2260,11 @@ run JMeter unless all the JMeter jars ar
     <copy todir="${dest.docs}/css">
       <fileset dir="${src.css}"/>
     </copy>
-  	<!-- 
-  	Note: it's vital that the Javadoc files are excluded from any fixes applied here.
-  	Any fixes to Javadoc files need to be done in the docs-api target only.
-  	Otherwise the output from the build will depend on which is done first.
-  	-->
+    <!-- 
+    Note: it's vital that the Javadoc files are excluded from any fixes applied here.
+    Any fixes to Javadoc files need to be done in the docs-api target only.
+    Otherwise the output from the build will depend on which is done first.
+    -->
     <echo level="info">Fixing EOL</echo>
     <fixcrlf encoding="iso-8859-1" srcdir="${dest.docs}/" includes="**/*.html" excludes="api/**"
fixlast="false"/>
     <echo level="info">Removing unnecessary &lt;/br> tags</echo>
@@ -2550,7 +2550,7 @@ run JMeter unless all the JMeter jars ar
           <param name="batchtest.variable" value="sample_variables"/>
           <param name="batchtest.value" value="REFERENCE,JSESSIONID"/>
       </antcall>
-  	
+
       <antcall target="batchtest">
           <param name="batchtest.name" value="Bug56811"/>
       </antcall>
@@ -2820,7 +2820,7 @@ run JMeter unless all the JMeter jars ar
         <process_jarfile jarname="commons-logging"/>
         <process_jarfile jarname="commons-math3"/>
         <process_jarfile jarname="commons-net"/>
-    	<process_jarfile jarname="commons-pool2"/>
+        <process_jarfile jarname="commons-pool2"/>
         <process_jarfile jarname="dnsjava"/>
         <process_jarfile jarname="excalibur-datasource"/>
         <process_jarfile jarname="excalibur-instrument"/>
@@ -2965,7 +2965,7 @@ run JMeter unless all the JMeter jars ar
         </checkstyle>
 
     </target>
-  
+
     <target name="sign_dist"
       description="Sign release artifacts in dist and dist/maven.  Usage: ant sign_dist -Dgpg.keyname=key-id
[-Dgpg.secretKeyring=path-to-keyring]      ">
       <scriptdef name="gpg" language="beanshell">

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=1683017&r1=1683016&r2=1683017&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 Mon
Jun  1 22:41:11 2015
@@ -66,7 +66,7 @@ import org.apache.jorphan.gui.layout.Ver
  *
  */
 public class ModuleControllerGui extends AbstractControllerGui implements ActionListener
{
-	/**
+    /**
      * 
      */
     private static final long serialVersionUID = -4195441608252523573L;
@@ -103,10 +103,10 @@ public class ModuleControllerGui extends
      * Initializes the gui panel for the ModuleController instance.
      */
     public ModuleControllerGui() {
-		moduleToRunTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode());
-		moduleToRunTreeNodes = new JTree(moduleToRunTreeModel);
-		moduleToRunTreeNodes.setCellRenderer(new ModuleControllerCellRenderer());
-		
+        moduleToRunTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode());
+        moduleToRunTreeNodes = new JTree(moduleToRunTreeModel);
+        moduleToRunTreeNodes.setCellRenderer(new ModuleControllerCellRenderer());
+
         warningLabel = new JLabel(""); // $NON-NLS-1$
         init();
     }
@@ -167,14 +167,14 @@ public class ModuleControllerGui extends
         JMeterTreeNode tn = null;
         DefaultMutableTreeNode lastSelected = (DefaultMutableTreeNode) this.moduleToRunTreeNodes.getLastSelectedPathComponent();

         if (lastSelected != null && lastSelected.getUserObject() instanceof JMeterTreeNode)
{
-        	tn = (JMeterTreeNode) lastSelected.getUserObject();
+            tn = (JMeterTreeNode) lastSelected.getUserObject();
         }
         if (tn != null) {
             selected = tn;
             //prevent from selecting thread group or test plan elements
             if (selected != null 
-            		&& !(selected.getTestElement() instanceof AbstractThreadGroup)
-            		&& !(selected.getTestElement() instanceof TestPlan)) {
+                    && !(selected.getTestElement() instanceof AbstractThreadGroup)
+                    && !(selected.getTestElement() instanceof TestPlan)) {
                 ((ModuleController) element).setSelectedNode(selected);
             }
         }
@@ -227,7 +227,7 @@ public class ModuleControllerGui extends
         
         JPanel treePanel = new JPanel();
         treePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
-		treePanel.add(moduleToRunTreeNodes);
+        treePanel.add(moduleToRunTreeNodes);
         add(treePanel);
     }
 
@@ -241,126 +241,126 @@ public class ModuleControllerGui extends
      * 
      * @return path of a found element 
      */
-	private TreeNode[] findPathInTreeModel(int level, TreeNode[] testPlanPath, DefaultMutableTreeNode
parent)
-	{
-		if(level >= testPlanPath.length) {
-			return EMPTY_TREE_NODES;
-		}
-		int childCount = parent.getChildCount();
-		JMeterTreeNode searchedTreeNode = 
-		        (JMeterTreeNode) testPlanPath[level];
-
-		for (int i = 0; i < childCount; i++) {
-			DefaultMutableTreeNode child = (DefaultMutableTreeNode) parent.getChildAt(i);
-			JMeterTreeNode childUserObj = (JMeterTreeNode) child.getUserObject();
-
-			if(!childUserObj.equals(searchedTreeNode)){
-				continue;
-			} else {
-				if(level == (testPlanPath.length - 1)){
-					return child.getPath();
-				} else {
-					return findPathInTreeModel(level+1, testPlanPath, child);
-				}
-			}
-		}
-		return EMPTY_TREE_NODES;
-	}
-	
-	/**
-	 * Expand module to run tree to selected JMeterTreeNode and set selection path to it
-	 * @param selected - referenced module to run
-	 */
-	private void focusSelectedOnTree(JMeterTreeNode selected)
-	{
-		TreeNode[] path = selected.getPath();
-		TreeNode[] filteredPath = new TreeNode[path.length-1];
-		
-		//ignore first element of path - WorkBench, (why WorkBench is appearing in the path ???)
-		for(int i = 1; i < path.length; i++){
-			filteredPath[i-1] = path[i];
-		}
-		
-		DefaultMutableTreeNode root = (DefaultMutableTreeNode) moduleToRunTreeNodes.getModel().getRoot();
-		//treepath of test plan tree and module to run tree cannot be compared directly - moduleToRunTreeModel.getPathToRoot()
-		//custom method for finding an JMeterTreeNode element in DefaultMutableTreeNode have to
be used 
-		TreeNode[] dmtnPath = this.findPathInTreeModel(1, filteredPath, root);
-		if (dmtnPath.length>0) {
-			TreePath treePath = new TreePath(dmtnPath);
-			moduleToRunTreeNodes.setSelectionPath(treePath);
-			moduleToRunTreeNodes.scrollPathToVisible(treePath);
-		}
-	}
+    private TreeNode[] findPathInTreeModel(int level, TreeNode[] testPlanPath, DefaultMutableTreeNode
parent)
+    {
+        if(level >= testPlanPath.length) {
+            return EMPTY_TREE_NODES;
+        }
+        int childCount = parent.getChildCount();
+        JMeterTreeNode searchedTreeNode = 
+                (JMeterTreeNode) testPlanPath[level];
+
+        for (int i = 0; i < childCount; i++) {
+            DefaultMutableTreeNode child = (DefaultMutableTreeNode) parent.getChildAt(i);
+            JMeterTreeNode childUserObj = (JMeterTreeNode) child.getUserObject();
+
+            if(!childUserObj.equals(searchedTreeNode)){
+                continue;
+            } else {
+                if(level == (testPlanPath.length - 1)){
+                    return child.getPath();
+                } else {
+                    return findPathInTreeModel(level+1, testPlanPath, child);
+                }
+            }
+        }
+        return EMPTY_TREE_NODES;
+    }
+    
+    /**
+     * Expand module to run tree to selected JMeterTreeNode and set selection path to it
+     * @param selected - referenced module to run
+     */
+    private void focusSelectedOnTree(JMeterTreeNode selected)
+    {
+        TreeNode[] path = selected.getPath();
+        TreeNode[] filteredPath = new TreeNode[path.length-1];
+        
+        //ignore first element of path - WorkBench, (why WorkBench is appearing in the path
???)
+        for(int i = 1; i < path.length; i++){
+            filteredPath[i-1] = path[i];
+        }
+        
+        DefaultMutableTreeNode root = (DefaultMutableTreeNode) moduleToRunTreeNodes.getModel().getRoot();
+        //treepath of test plan tree and module to run tree cannot be compared directly -
moduleToRunTreeModel.getPathToRoot()
+        //custom method for finding an JMeterTreeNode element in DefaultMutableTreeNode have
to be used 
+        TreeNode[] dmtnPath = this.findPathInTreeModel(1, filteredPath, root);
+        if (dmtnPath.length>0) {
+            TreePath treePath = new TreePath(dmtnPath);
+            moduleToRunTreeNodes.setSelectionPath(treePath);
+            moduleToRunTreeNodes.scrollPathToVisible(treePath);
+        }
+    }
     
-	/**
-	 * 
-	 */
-	private void reinitialize() {
-		((DefaultMutableTreeNode) moduleToRunTreeModel.getRoot()).removeAllChildren();
-
-		GuiPackage gp = GuiPackage.getInstance();
-		JMeterTreeNode root;
-		if (gp != null) {
-			root = (JMeterTreeNode) GuiPackage.getInstance().getTreeModel().getRoot();
-			buildTreeNodeModel(root, 0, null);
-			moduleToRunTreeModel.nodeStructureChanged((TreeNode) moduleToRunTreeModel.getRoot());
-		}
-		if (selected != null) {			
-			//expand Module to run tree to selected node and set selection path to it
-			this.focusSelectedOnTree(selected);
-		}
-	}
-
-	/**
-	 * Recursively build module to run tree. Only 4 types of elements are allowed to be added:
-	 * - All controllers except ModuleController
-	 * - TestPlan
-	 * - TestFragmentController
-	 * - AbstractThreadGroup
-	 * 
-	 * @param node - element of test plan tree
-	 * @param level - level of element in a tree
-	 * @param parent
-	 */
-	private void buildTreeNodeModel(JMeterTreeNode node, int level,
-			DefaultMutableTreeNode parent) {
-
-		if (node != null) {
-			for (int i = 0; i < node.getChildCount(); i++) {
-				JMeterTreeNode cur = (JMeterTreeNode) node.getChildAt(i);
-				TestElement te = cur.getTestElement();
-
-				if (te instanceof Controller
-						&& !(te instanceof ModuleController) && level > 0) {
-					DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(cur);
-					parent.add(newNode);
-					buildTreeNodeModel(cur, level + 1, newNode);
-					
-				} else if (te instanceof TestFragmentController) {
-					DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(cur);
-					parent.add(newNode);
-					buildTreeNodeModel(cur, level + 1, newNode);
-				
-				} else if (te instanceof AbstractThreadGroup) {
-					DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(cur);
-					parent.add(newNode);
-					buildTreeNodeModel(cur, level + 1, newNode);
-				}
-
-				else if (te instanceof TestPlan) {
-					((DefaultMutableTreeNode) moduleToRunTreeModel.getRoot())
-							.setUserObject(cur);
-					buildTreeNodeModel(cur, level,
-							(DefaultMutableTreeNode) moduleToRunTreeModel.getRoot());
-				}
-			}
-		}
-	}
-
-	/**
-	 * Implementation of Expand button - moves focus to a test plan tree element referenced
by 
-	 * selected element in Module to run tree
-	 */
+    /**
+     * 
+     */
+    private void reinitialize() {
+        ((DefaultMutableTreeNode) moduleToRunTreeModel.getRoot()).removeAllChildren();
+
+        GuiPackage gp = GuiPackage.getInstance();
+        JMeterTreeNode root;
+        if (gp != null) {
+            root = (JMeterTreeNode) GuiPackage.getInstance().getTreeModel().getRoot();
+            buildTreeNodeModel(root, 0, null);
+            moduleToRunTreeModel.nodeStructureChanged((TreeNode) moduleToRunTreeModel.getRoot());
+        }
+        if (selected != null) {            
+            //expand Module to run tree to selected node and set selection path to it
+            this.focusSelectedOnTree(selected);
+        }
+    }
+
+    /**
+     * Recursively build module to run tree. Only 4 types of elements are allowed to be added:
+     * - All controllers except ModuleController
+     * - TestPlan
+     * - TestFragmentController
+     * - AbstractThreadGroup
+     * 
+     * @param node - element of test plan tree
+     * @param level - level of element in a tree
+     * @param parent
+     */
+    private void buildTreeNodeModel(JMeterTreeNode node, int level,
+            DefaultMutableTreeNode parent) {
+
+        if (node != null) {
+            for (int i = 0; i < node.getChildCount(); i++) {
+                JMeterTreeNode cur = (JMeterTreeNode) node.getChildAt(i);
+                TestElement te = cur.getTestElement();
+
+                if (te instanceof Controller
+                        && !(te instanceof ModuleController) && level >
0) {
+                    DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(cur);
+                    parent.add(newNode);
+                    buildTreeNodeModel(cur, level + 1, newNode);
+                    
+                } else if (te instanceof TestFragmentController) {
+                    DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(cur);
+                    parent.add(newNode);
+                    buildTreeNodeModel(cur, level + 1, newNode);
+                
+                } else if (te instanceof AbstractThreadGroup) {
+                    DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(cur);
+                    parent.add(newNode);
+                    buildTreeNodeModel(cur, level + 1, newNode);
+                }
+
+                else if (te instanceof TestPlan) {
+                    ((DefaultMutableTreeNode) moduleToRunTreeModel.getRoot())
+                            .setUserObject(cur);
+                    buildTreeNodeModel(cur, level,
+                            (DefaultMutableTreeNode) moduleToRunTreeModel.getRoot());
+                }
+            }
+        }
+    }
+
+    /**
+     * Implementation of Expand button - moves focus to a test plan tree element referenced
by 
+     * selected element in Module to run tree
+     */
     @Override
     public void actionPerformed(ActionEvent e) {
         if(e.getSource()==expandButton) {
@@ -368,16 +368,16 @@ public class ModuleControllerGui extends
             DefaultMutableTreeNode selected = (DefaultMutableTreeNode) 
                     this.moduleToRunTreeNodes.getLastSelectedPathComponent(); 
             if(selected != null && selected.getUserObject() instanceof JMeterTreeNode){
-            	tn = (JMeterTreeNode) selected.getUserObject();
+                tn = (JMeterTreeNode) selected.getUserObject();
             }
             if(tn != null){
-				TreePath treePath = new TreePath(tn.getPath());
-				//changing selection in a test plan tree
-				GuiPackage.getInstance().getTreeListener().getJTree()
-						.setSelectionPath(treePath);
-				//expanding tree to make referenced element visible in test plan tree
-				GuiPackage.getInstance().getTreeListener().getJTree()
-						.scrollPathToVisible(treePath);
+                TreePath treePath = new TreePath(tn.getPath());
+                //changing selection in a test plan tree
+                GuiPackage.getInstance().getTreeListener().getJTree()
+                        .setSelectionPath(treePath);
+                //expanding tree to make referenced element visible in test plan tree
+                GuiPackage.getInstance().getTreeListener().getJTree()
+                        .scrollPathToVisible(treePath);
             }
         } 
     }
@@ -398,30 +398,30 @@ public class ModuleControllerGui extends
      */
     private static class ModuleControllerCellRenderer extends DefaultTreeCellRenderer {
 
-		private static final long serialVersionUID = 1129098620102526299L;
-		
+        private static final long serialVersionUID = 1129098620102526299L;
+        
         /**
          * @see javax.swing.tree.DefaultTreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree,
java.lang.Object, boolean, boolean, boolean, int, boolean)
          */
-		@Override
+        @Override
         public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
boolean expanded,
                 boolean leaf, int row, boolean hasFocus) {
             JMeterTreeNode node = (JMeterTreeNode)((DefaultMutableTreeNode) value).getUserObject();
             if(node != null){
-	            super.getTreeCellRendererComponent(tree, node.getName(), selected, expanded,
leaf, row,
-	                    hasFocus);
-	            //print same icon as in test plan tree
-	            boolean enabled = node.isEnabled();
-	            ImageIcon icon = node.getIcon(enabled);
-	            if (icon != null) {
-	                if (enabled) {
-	                    setIcon(icon);
-	                } else {
-	                    setDisabledIcon(icon);
-	                }
-	            }
+                super.getTreeCellRendererComponent(tree, node.getName(), selected, expanded,
leaf, row,
+                        hasFocus);
+                //print same icon as in test plan tree
+                boolean enabled = node.isEnabled();
+                ImageIcon icon = node.getIcon(enabled);
+                if (icon != null) {
+                    if (enabled) {
+                        setIcon(icon);
+                    } else {
+                        setDisabledIcon(icon);
+                    }
+                }
             }
-	        return this;
+            return this;
         }
     }
 }



Mime
View raw message