jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1825829 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/action/ src/core/org/apache/jmeter/gui/tree/ xdocs/
Date Sun, 04 Mar 2018 18:00:54 GMT
Author: pmouawad
Date: Sun Mar  4 18:00:53 2018
New Revision: 1825829

URL: http://svn.apache.org/viewvc?rev=1825829&view=rev
Log:
Bug 62156 - Search Feature : Distinguish between node that matches search and node that contains
a child that matches search
Bugzilla Id: 62156

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/ResetSearchCommand.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeDialog.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterCellRenderer.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/ResetSearchCommand.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/ResetSearchCommand.java?rev=1825829&r1=1825828&r2=1825829&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/ResetSearchCommand.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/ResetSearchCommand.java Sun Mar  4
18:00:53 2018
@@ -51,7 +51,10 @@ public class ResetSearchCommand extends
                     .filter(node -> node.getUserObject() instanceof Searchable)
                     .map(JMeterTreeNode::getPathToThreadGroup)
                     .flatMap(Collection::stream)
-                    .forEach(matchingNode ->  matchingNode.setMarkedBySearch(false));
+                    .forEach(matchingNode ->  {
+                        matchingNode.setMarkedBySearch(false);
+                        matchingNode.setChildrenNodesHaveMatched(false);
+                    });
         } finally {
             guiPackage.endUndoTransaction();
         }

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeDialog.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeDialog.java?rev=1825829&r1=1825828&r2=1825829&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeDialog.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/SearchTreeDialog.java Sun Mar  4 18:00:53
2018
@@ -234,12 +234,11 @@ public class SearchTreeDialog extends JD
             for (JMeterTreeNode jMeterTreeNode : jMeterTreeModel.getNodesOfType(Searchable.class))
{
                 try {
                     Searchable searchable = (Searchable) jMeterTreeNode.getUserObject();
-                    List<JMeterTreeNode> matchingNodes = jMeterTreeNode.getPathToThreadGroup();
                     List<String> searchableTokens = searchable.getSearchableTokens();
                     boolean result = searcher.search(searchableTokens);
                     if (result) {
                         numberOfMatches++;
-                        nodes.addAll(matchingNodes);
+                        nodes.add(jMeterTreeNode);
                     }
                 } catch (Exception ex) {
                     logger.error("Error occurred searching for word:"+ wordToSearch+ " in
node:"+jMeterTreeNode.getName(), ex);
@@ -247,7 +246,6 @@ public class SearchTreeDialog extends JD
             }
             GuiPackage guiInstance = GuiPackage.getInstance();
             JTree jTree = guiInstance.getMainFrame().getTree();
-    
             for (JMeterTreeNode jMeterTreeNode : nodes) {
                 jMeterTreeNode.setMarkedBySearch(true);
                 if (expand) {
@@ -307,8 +305,7 @@ public class SearchTreeDialog extends JD
                     }
                     totalReplaced += numberOfReplacements;
                     if (numberOfReplacements > 0) {
-                        List<JMeterTreeNode> matchingNodes = jMeterTreeNode.getPathToThreadGroup();
-                        nodes.addAll(matchingNodes);
+                        nodes.add(jMeterTreeNode);
                     }
                 }
             } catch (Exception ex) {

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterCellRenderer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterCellRenderer.java?rev=1825829&r1=1825828&r2=1825829&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterCellRenderer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterCellRenderer.java Sun Mar  4 18:00:53
2018
@@ -41,7 +41,7 @@ public class JMeterCellRenderer extends
     private static final String BLANK = StringUtils.repeat(' ', DEFAULT_LENGTH);
 
     private static final Border RED_BORDER = BorderFactory.createLineBorder(Color.red);
-
+    private static final Border BLUE_BORDER = BorderFactory.createLineBorder(Color.blue);
     public JMeterCellRenderer() {
     }
 
@@ -74,8 +74,9 @@ public class JMeterCellRenderer extends
         this.setEnabled(enabled);
         if(node.isMarkedBySearch()) {
             setBorder(RED_BORDER);
-        }
-        else {
+        } else if (node.isChildrenMarkedBySearch()) {
+            setBorder(BLUE_BORDER);
+        } else {
             setBorder(null);
         }
         return this;

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java?rev=1825829&r1=1825828&r2=1825829&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeNode.java Sun Mar  4 18:00:53
2018
@@ -51,6 +51,8 @@ public class JMeterTreeNode extends Defa
 
     private boolean markedBySearch;
 
+    private boolean childrenMarkedBySearch;
+
     public JMeterTreeNode() {// Allow serializable test to work
         // TODO: is the serializable test necessary now that JMeterTreeNode is
         // no longer a GUI component?
@@ -87,6 +89,16 @@ public class JMeterTreeNode extends Defa
     }
     
     /**
+     * One of the children of this node have matched a search
+     */
+    public void setChildrenNodesHaveMatched(boolean tagged) {
+        if (childrenMarkedBySearch == tagged) {
+            return;
+        }
+        this.childrenMarkedBySearch = tagged;
+        treeModel.nodeChanged(this);
+    }
+    /**
      * Tag Node as result of a search
      * @param tagged The flag to be used for tagging
      */
@@ -95,6 +107,14 @@ public class JMeterTreeNode extends Defa
             return;
         }
         this.markedBySearch = tagged;
+        List<JMeterTreeNode> nodesToParent = getPathToThreadGroup();
+        for (JMeterTreeNode jMeterTreeNode : nodesToParent) {
+            // Ignore me
+            if(jMeterTreeNode != this) {
+                jMeterTreeNode.setChildrenNodesHaveMatched(true);
+            }
+        }
+
         treeModel.nodeChanged(this);
     }
     
@@ -105,6 +125,13 @@ public class JMeterTreeNode extends Defa
     public boolean isMarkedBySearch() {
         return this.markedBySearch;
     }
+    
+    /**
+     * Node has children marked by search
+     */
+    public boolean isChildrenMarkedBySearch() {
+        return this.childrenMarkedBySearch;
+    }
 
     public ImageIcon getIcon() {
         return getIcon(true);

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1825829&r1=1825828&r2=1825829&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun Mar  4 18:00:53 2018
@@ -119,6 +119,8 @@ this behaviour, set <code>httpclient.res
 <h3>General</h3>
 <ul>
   <li><bug>62128</bug>Try to guess <code>JMETER_HOME</code>
correctly, when <code>jmeter.bat</code> is called from a batch file in another
directory. Contributed by logox01 (logox01 at gmx.at)</li>
+  <li><bug>62155</bug>Search Feature: Make Search text field get focus</li>
+  <li><bug>62156</bug>Search Feature : Distinguish between node that matches
search and node that contains a child that matches search</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>
@@ -178,7 +180,6 @@ this behaviour, set <code>httpclient.res
   <li><pr>377</pr>Small fix of the docs. Contributed by Peter Doornbosch
(peter.doornbosch at luminis.eu)</li>
   <li><bug>62124</bug>Recording templates : Add more exclusions and use
Transaction Name by default</li>
   <li><bug>62127</bug>Store filename as String instead of File in FileEditor.
This will prevent conversion of filenames from unix style path separators to Windows style
when used for example in CSV Data Set Config.</li>
-  <li><bug>62155</bug>Search Feature: Make Search text field get focus</li>
 </ul>
 
  <!--  =================== Thanks =================== -->



Mime
View raw message