jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject [jmeter] branch master updated: Bug 64843 - Tree: Don't propagate the state (enable/disabled) of current element to children
Date Fri, 23 Oct 2020 14:00:19 GMT
This is an automated email from the ASF dual-hosted git repository.

pmouawad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 4de138c  Bug 64843 - Tree: Don't propagate the state (enable/disabled) of current
element to children
4de138c is described below

commit 4de138c40f8102bbfdf89e614a8b52581f56431e
Author: pmouawad <p.mouawad@ubik-ingenierie.com>
AuthorDate: Fri Oct 23 14:42:58 2020 +0200

    Bug 64843 - Tree: Don't propagate the state (enable/disabled) of current element to children
---
 .../apache/jmeter/gui/action/EnableComponent.java  | 25 ----------------------
 .../apache/jmeter/gui/tree/JMeterCellRenderer.java | 15 -------------
 2 files changed, 40 deletions(-)

diff --git a/src/core/src/main/java/org/apache/jmeter/gui/action/EnableComponent.java b/src/core/src/main/java/org/apache/jmeter/gui/action/EnableComponent.java
index 34f39aa..fbf205c 100644
--- a/src/core/src/main/java/org/apache/jmeter/gui/action/EnableComponent.java
+++ b/src/core/src/main/java/org/apache/jmeter/gui/action/EnableComponent.java
@@ -18,13 +18,9 @@
 package org.apache.jmeter.gui.action;
 
 import java.awt.event.ActionEvent;
-import java.util.ArrayDeque;
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
-import javax.swing.tree.TreeNode;
-
 import org.apache.jmeter.gui.GuiPackage;
 import org.apache.jmeter.gui.tree.JMeterTreeNode;
 import org.slf4j.Logger;
@@ -54,15 +50,12 @@ public class EnableComponent extends AbstractAction {
         if (e.getActionCommand().equals(ActionNames.ENABLE)) {
             log.debug("enabling currently selected gui objects");
             enableComponents(nodes, true);
-            triggerChildrenRender(nodes);
         } else if (e.getActionCommand().equals(ActionNames.DISABLE)) {
             log.debug("disabling currently selected gui objects");
             enableComponents(nodes, false);
-            triggerChildrenRender(nodes);
         } else if (e.getActionCommand().equals(ActionNames.TOGGLE)) {
             log.debug("toggling currently selected gui objects");
             toggleComponents(nodes);
-            triggerChildrenRender(nodes);
         }
     }
 
@@ -83,24 +76,6 @@ public class EnableComponent extends AbstractAction {
         }
     }
 
-    private void triggerChildrenRender(JMeterTreeNode[] nodes) {
-        Set<TreeNode> visited = new HashSet<>();
-        ArrayDeque<TreeNode> queue = new ArrayDeque<>(Arrays.asList(nodes));
-        while (!queue.isEmpty()) {
-            final TreeNode next = queue.poll();
-            if (!visited.add(next)) {
-                continue;
-            }
-            if (next instanceof JMeterTreeNode) {
-                // Trigger render
-                ((JMeterTreeNode) next).nameChanged();
-            }
-            for (int i = 0; i < next.getChildCount(); i++) {
-                queue.add(next.getChildAt(i));
-            }
-        }
-    }
-
     /**
      * @see org.apache.jmeter.gui.action.Command#getActionNames()
      */
diff --git a/src/core/src/main/java/org/apache/jmeter/gui/tree/JMeterCellRenderer.java b/src/core/src/main/java/org/apache/jmeter/gui/tree/JMeterCellRenderer.java
index 55b3cbe..c0f5f2c 100644
--- a/src/core/src/main/java/org/apache/jmeter/gui/tree/JMeterCellRenderer.java
+++ b/src/core/src/main/java/org/apache/jmeter/gui/tree/JMeterCellRenderer.java
@@ -25,10 +25,8 @@ import javax.swing.ImageIcon;
 import javax.swing.JTree;
 import javax.swing.border.Border;
 import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.TreeNode;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.jmeter.control.TestFragmentController;
 import org.apache.jorphan.util.JOrphanUtils;
 
 /**
@@ -54,19 +52,6 @@ public class JMeterCellRenderer extends DefaultTreeCellRenderer {
                 JOrphanUtils.isBlank(node.getName()) ? BLANK : node.getName(),
                         sel, expanded, leaf, row, p_hasFocus);
         boolean enabled = node.isEnabled();
-        // Even in case the node itself is not disabled, we render it as disabled if
-        // one of its parents is in fact disabled.
-        for (TreeNode parent = node.getParent(); parent != null && enabled; parent
= parent.getParent()) {
-            if (parent instanceof JMeterTreeNode) {
-                JMeterTreeNode jMeterTreeNode = (JMeterTreeNode) parent;
-                if (jMeterTreeNode.getTestElement() instanceof TestFragmentController) {
-                    // TestFragment is always disabled, so we don't want to mark everything
below
-                    // with pale
-                    break;
-                }
-                enabled = jMeterTreeNode.isEnabled();
-            }
-        }
         ImageIcon ic = node.getIcon(enabled);
         if (ic != null) {
             if (enabled) {


Mime
View raw message