GUI -- Fixed a defect where showTraffic was sending redundant link classes.
Change-Id: I7fd1385cc6e200f1b61930e218cc82041084e0a7
Showing
1 changed file
with
10 additions
and
3 deletions
... | @@ -656,7 +656,7 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { | ... | @@ -656,7 +656,7 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { |
656 | Map<String, ObjectNode> pathNodes = new HashMap<>(); | 656 | Map<String, ObjectNode> pathNodes = new HashMap<>(); |
657 | for (BiLink biLink : biLinks.values()) { | 657 | for (BiLink biLink : biLinks.values()) { |
658 | boolean hasTraffic = biLink.hasTraffic; | 658 | boolean hasTraffic = biLink.hasTraffic; |
659 | - String tc = (biLink.classes + (hasTraffic ? " animated" : "")).trim(); | 659 | + String tc = (biLink.classes() + (hasTraffic ? " animated" : "")).trim(); |
660 | ObjectNode pathNode = pathNodes.get(tc); | 660 | ObjectNode pathNode = pathNodes.get(tc); |
661 | if (pathNode == null) { | 661 | if (pathNode == null) { |
662 | pathNode = mapper.createObjectNode() | 662 | pathNode = mapper.createObjectNode() |
... | @@ -830,7 +830,8 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { | ... | @@ -830,7 +830,8 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { |
830 | public Link two; | 830 | public Link two; |
831 | public boolean hasTraffic = false; | 831 | public boolean hasTraffic = false; |
832 | public long bytes = 0; | 832 | public long bytes = 0; |
833 | - public String classes = ""; | 833 | + |
834 | + private Set<String> classes = new HashSet<>(); | ||
834 | 835 | ||
835 | BiLink(LinkKey key, Link link) { | 836 | BiLink(LinkKey key, Link link) { |
836 | this.key = key; | 837 | this.key = key; |
... | @@ -849,7 +850,13 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { | ... | @@ -849,7 +850,13 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { |
849 | } | 850 | } |
850 | 851 | ||
851 | void addClass(String trafficClass) { | 852 | void addClass(String trafficClass) { |
852 | - classes = classes + " " + trafficClass; | 853 | + classes.add(trafficClass); |
854 | + } | ||
855 | + | ||
856 | + String classes() { | ||
857 | + StringBuilder sb = new StringBuilder(); | ||
858 | + classes.forEach(c -> sb.append(c).append(" ")); | ||
859 | + return sb.toString().trim(); | ||
853 | } | 860 | } |
854 | } | 861 | } |
855 | 862 | ... | ... |
-
Please register or login to post a comment