Committed by
Gerrit Code Review
ONOS-3182 Fix highlight of updated paths through though delay
Change-Id: I3d33ed6340aa75ed8c31b7440c5cba81131b7168
Showing
1 changed file
with
12 additions
and
3 deletions
... | @@ -49,7 +49,7 @@ import java.util.List; | ... | @@ -49,7 +49,7 @@ import java.util.List; |
49 | import java.util.Set; | 49 | import java.util.Set; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | - * Skeletal ONOS UI Topology-Overlay message handler. | 52 | + * ONOS UI PathPainter Topology-Overlay message handler. |
53 | */ | 53 | */ |
54 | public class PathPainterTopovMessageHandler extends UiMessageHandler { | 54 | public class PathPainterTopovMessageHandler extends UiMessageHandler { |
55 | 55 | ||
... | @@ -69,12 +69,16 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { | ... | @@ -69,12 +69,16 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { |
69 | private static final String ENDSTATION = "endstation"; | 69 | private static final String ENDSTATION = "endstation"; |
70 | public static final String DST = "Dst"; | 70 | public static final String DST = "Dst"; |
71 | public static final String SRC = "Src"; | 71 | public static final String SRC = "Src"; |
72 | - private static LinkWeight linkData; | 72 | + // Delay for showHighlights event processing on GUI client side to |
73 | + // account for addLink animation. | ||
74 | + public static final int DELAY_MS = 1100; | ||
73 | 75 | ||
74 | private final TopologyListener topologyListener = new InternalTopologyListener(); | 76 | private final TopologyListener topologyListener = new InternalTopologyListener(); |
75 | 77 | ||
76 | private Set<Link> allPathLinks; | 78 | private Set<Link> allPathLinks; |
77 | private boolean listenersRemoved; | 79 | private boolean listenersRemoved; |
80 | + private LinkWeight linkData; | ||
81 | + private int highlightDelay; | ||
78 | 82 | ||
79 | private enum Mode { | 83 | private enum Mode { |
80 | SHORTEST, DISJOINT, GEODATA, SRLG, INVALID | 84 | SHORTEST, DISJOINT, GEODATA, SRLG, INVALID |
... | @@ -204,7 +208,6 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { | ... | @@ -204,7 +208,6 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { |
204 | } | 208 | } |
205 | 209 | ||
206 | 210 | ||
207 | - | ||
208 | private final class NextPathHandler extends RequestHandler { | 211 | private final class NextPathHandler extends RequestHandler { |
209 | public NextPathHandler() { | 212 | public NextPathHandler() { |
210 | super(PAINTER_NEXT_PATH); | 213 | super(PAINTER_NEXT_PATH); |
... | @@ -326,6 +329,9 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { | ... | @@ -326,6 +329,9 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { |
326 | ImmutableSet.of() : ImmutableSet.copyOf(paths.get(pathIndex).links()); | 329 | ImmutableSet.of() : ImmutableSet.copyOf(paths.get(pathIndex).links()); |
327 | } | 330 | } |
328 | Highlights highlights = new Highlights(); | 331 | Highlights highlights = new Highlights(); |
332 | + if (highlightDelay > 0) { | ||
333 | + highlights.delay(highlightDelay); | ||
334 | + } | ||
329 | for (PathLink plink : linkMap.biLinks()) { | 335 | for (PathLink plink : linkMap.biLinks()) { |
330 | plink.computeHilight(selectedPathLinks, allPathLinks); | 336 | plink.computeHilight(selectedPathLinks, allPathLinks); |
331 | highlights.add(plink.highlight(null)); | 337 | highlights.add(plink.highlight(null)); |
... | @@ -370,6 +376,7 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { | ... | @@ -370,6 +376,7 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { |
370 | listenersRemoved = false; | 376 | listenersRemoved = false; |
371 | topologyService.addListener(topologyListener); | 377 | topologyService.addListener(topologyListener); |
372 | } | 378 | } |
379 | + | ||
373 | private synchronized void removeListeners() { | 380 | private synchronized void removeListeners() { |
374 | if (!listenersRemoved) { | 381 | if (!listenersRemoved) { |
375 | listenersRemoved = true; | 382 | listenersRemoved = true; |
... | @@ -381,7 +388,9 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { | ... | @@ -381,7 +388,9 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { |
381 | private class InternalTopologyListener implements TopologyListener { | 388 | private class InternalTopologyListener implements TopologyListener { |
382 | @Override | 389 | @Override |
383 | public void event(TopologyEvent event) { | 390 | public void event(TopologyEvent event) { |
391 | + highlightDelay = DELAY_MS; | ||
384 | findAndSendPaths(currentMode); | 392 | findAndSendPaths(currentMode); |
393 | + highlightDelay = 0; | ||
385 | } | 394 | } |
386 | } | 395 | } |
387 | 396 | ... | ... |
-
Please register or login to post a comment