Committed by
Gerrit Code Review
ONOS-3182 added swap functionality
Change-Id: Idc521a330c5bb3c0e0a47f66a90dfa95855e610f
Showing
4 changed files
with
33 additions
and
8 deletions
... | @@ -84,6 +84,7 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { | ... | @@ -84,6 +84,7 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { |
84 | return ImmutableSet.of( | 84 | return ImmutableSet.of( |
85 | new SetSrcHandler(), | 85 | new SetSrcHandler(), |
86 | new SetDstHandler(), | 86 | new SetDstHandler(), |
87 | + new SwapSrcDstHandler(), | ||
87 | new NextPathHandler(), | 88 | new NextPathHandler(), |
88 | new PrevPathHandler() | 89 | new PrevPathHandler() |
89 | ); | 90 | ); |
... | @@ -124,6 +125,20 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { | ... | @@ -124,6 +125,20 @@ public class PathPainterTopovMessageHandler extends UiMessageHandler { |
124 | } | 125 | } |
125 | } | 126 | } |
126 | 127 | ||
128 | + private final class SwapSrcDstHandler extends RequestHandler { | ||
129 | + public SwapSrcDstHandler() { | ||
130 | + super(PAINTER_SWAP_SRC_DST); | ||
131 | + } | ||
132 | + | ||
133 | + @Override | ||
134 | + public void process(long sid, ObjectNode payload) { | ||
135 | + ElementId temp = src; | ||
136 | + src = dst; | ||
137 | + dst = temp; | ||
138 | + findAndSendPaths(); | ||
139 | + } | ||
140 | + } | ||
141 | + | ||
127 | private final class NextPathHandler extends RequestHandler { | 142 | private final class NextPathHandler extends RequestHandler { |
128 | public NextPathHandler() { | 143 | public NextPathHandler() { |
129 | super(PAINTER_NEXT_PATH); | 144 | super(PAINTER_NEXT_PATH); | ... | ... |
... | @@ -28,6 +28,7 @@ | ... | @@ -28,6 +28,7 @@ |
28 | // constants | 28 | // constants |
29 | var srcMessage = 'ppTopovSetSrc', | 29 | var srcMessage = 'ppTopovSetSrc', |
30 | dstMessage = 'ppTopovSetDst', | 30 | dstMessage = 'ppTopovSetDst', |
31 | + swapMessage = 'ppTopovSwapSrcDst', | ||
31 | modeMessage = 'ppTopovSetMode', | 32 | modeMessage = 'ppTopovSetMode', |
32 | nextPathMessage = 'ppTopovNextPath', | 33 | nextPathMessage = 'ppTopovNextPath', |
33 | prevPathMessage = 'ppTopovPrevPath'; | 34 | prevPathMessage = 'ppTopovPrevPath'; |
... | @@ -58,11 +59,16 @@ | ... | @@ -58,11 +59,16 @@ |
58 | flash.flash('Destination node: ' + node.id); | 59 | flash.flash('Destination node: ' + node.id); |
59 | } | 60 | } |
60 | 61 | ||
61 | - function nextPath(node) { | 62 | + function swapSrcDst() { |
63 | + wss.sendEvent(swapMessage) | ||
64 | + flash.flash('Source and destination swap'); | ||
65 | + } | ||
66 | + | ||
67 | + function nextPath() { | ||
62 | wss.sendEvent(nextPathMessage); | 68 | wss.sendEvent(nextPathMessage); |
63 | } | 69 | } |
64 | 70 | ||
65 | - function prevPath(node) { | 71 | + function prevPath() { |
66 | wss.sendEvent(prevPathMessage); | 72 | wss.sendEvent(prevPathMessage); |
67 | } | 73 | } |
68 | 74 | ||
... | @@ -97,7 +103,8 @@ | ... | @@ -97,7 +103,8 @@ |
97 | setDst: setDst, | 103 | setDst: setDst, |
98 | setMode: setMode, | 104 | setMode: setMode, |
99 | nextPath: nextPath, | 105 | nextPath: nextPath, |
100 | - prevPath: prevPath | 106 | + prevPath: prevPath, |
107 | + swapSrcDst: swapSrcDst | ||
101 | }; | 108 | }; |
102 | }]); | 109 | }]); |
103 | }()); | 110 | }()); | ... | ... |
... | @@ -16,8 +16,7 @@ | ... | @@ -16,8 +16,7 @@ |
16 | var overlay = { | 16 | var overlay = { |
17 | // NOTE: this must match the ID defined in AppUiTopovOverlay | 17 | // NOTE: this must match the ID defined in AppUiTopovOverlay |
18 | overlayId: 'pp-overlay', | 18 | overlayId: 'pp-overlay', |
19 | - // FIXME: new icon for the overlay | 19 | + glyphId: 'topo', |
20 | - glyphId: '*star4', | ||
21 | tooltip: 'Path Painter Topo Overlay', | 20 | tooltip: 'Path Painter Topo Overlay', |
22 | 21 | ||
23 | // These glyphs get installed using the overlayId as a prefix. | 22 | // These glyphs get installed using the overlayId as a prefix. |
... | @@ -68,7 +67,6 @@ | ... | @@ -68,7 +67,6 @@ |
68 | // FIXME: use into [ and ] instead of 1 and 2 | 67 | // FIXME: use into [ and ] instead of 1 and 2 |
69 | // FIXME: new icons for src/dst | 68 | // FIXME: new icons for src/dst |
70 | // TODO: add keys for shortest paths & disjoint paths modes | 69 | // TODO: add keys for shortest paths & disjoint paths modes |
71 | - // TODO: add key for src/dst swap; with its own icon | ||
72 | keyBindings: { | 70 | keyBindings: { |
73 | 1: { | 71 | 1: { |
74 | cb: function () { pps.setSrc(selection); }, | 72 | cb: function () { pps.setSrc(selection); }, |
... | @@ -80,6 +78,11 @@ | ... | @@ -80,6 +78,11 @@ |
80 | tt: 'Set destination node', | 78 | tt: 'Set destination node', |
81 | gid: 'triangleDown' | 79 | gid: 'triangleDown' |
82 | }, | 80 | }, |
81 | + 3: { | ||
82 | + cb: function () { pps.swapSrcDst(); }, | ||
83 | + tt: 'Swap source and destination nodes', | ||
84 | + gid: 'refresh' | ||
85 | + }, | ||
83 | leftArrow: { | 86 | leftArrow: { |
84 | cb: function () { pps.prevPath(); }, | 87 | cb: function () { pps.prevPath(); }, |
85 | tt: 'Highlight previous path', | 88 | tt: 'Highlight previous path', |
... | @@ -92,7 +95,7 @@ | ... | @@ -92,7 +95,7 @@ |
92 | }, | 95 | }, |
93 | 96 | ||
94 | _keyOrder: [ | 97 | _keyOrder: [ |
95 | - '1', '2', 'leftArrow', 'rightArrow' | 98 | + '1', '2', '3', 'leftArrow', 'rightArrow' |
96 | ] | 99 | ] |
97 | }, | 100 | }, |
98 | 101 | ... | ... |
... | @@ -167,7 +167,7 @@ | ... | @@ -167,7 +167,7 @@ |
167 | 167 | ||
168 | // generate radio button set for overlays; start with 'none' | 168 | // generate radio button set for overlays; start with 'none' |
169 | var rset = [{ | 169 | var rset = [{ |
170 | - gid: 'topo', | 170 | + gid: 'unknown', |
171 | tooltip: 'No Overlay', | 171 | tooltip: 'No Overlay', |
172 | cb: function () { | 172 | cb: function () { |
173 | tov.tbSelection(null, switchOverlayActions); | 173 | tov.tbSelection(null, switchOverlayActions); | ... | ... |
-
Please register or login to post a comment