Simon Hunt

ONOS-3738: implemented F1..F5 key bindings to topology overlay selection.

- added size() function to radio button sets
- removed noisy warning (panel resize when contents not defined)

Change-Id: Id39cffe5c6c9f608b9d9af672b1535610a97f0fc
...@@ -240,7 +240,8 @@ ...@@ -240,7 +240,8 @@
240 return { 240 return {
241 width: rsetWidth, 241 width: rsetWidth,
242 selected: selected, 242 selected: selected,
243 - selectedIndex: selectedIndex 243 + selectedIndex: selectedIndex,
244 + size: function () { return rads.length; }
244 } 245 }
245 } 246 }
246 247
......
...@@ -65,6 +65,13 @@ ...@@ -65,6 +65,13 @@
65 65
66 E: [equalizeMasters, 'Equalize mastership roles'], 66 E: [equalizeMasters, 'Equalize mastership roles'],
67 67
68 + // topology overlay selections
69 + F1: function () { ttbs.fnkey(0); },
70 + F2: function () { ttbs.fnkey(1); },
71 + F3: function () { ttbs.fnkey(2); },
72 + F4: function () { ttbs.fnkey(3); },
73 + F5: function () { ttbs.fnkey(4); },
74 +
68 esc: handleEscape, 75 esc: handleEscape,
69 76
70 _keyListener: ttbs.keyListener, 77 _keyListener: ttbs.keyListener,
......
...@@ -97,7 +97,9 @@ ...@@ -97,7 +97,9 @@
97 $log.warn('adjustHeight: height from top of page not given'); 97 $log.warn('adjustHeight: height from top of page not given');
98 return null; 98 return null;
99 } else if (!body || !p) { 99 } else if (!body || !p) {
100 - $log.warn('adjustHeight: panel contents are not defined'); 100 + // panel contents are not defined
101 + // this may happen when window is resizing but panel has
102 + // been cleared or removed
101 return null; 103 return null;
102 } 104 }
103 105
......
...@@ -270,6 +270,13 @@ ...@@ -270,6 +270,13 @@
270 ovRset.selectedIndex(idx); 270 ovRset.selectedIndex(idx);
271 } 271 }
272 272
273 + // an overlay was selected via Function-Key press
274 + function fnkey(idx) {
275 + if (idx < ovRset.size() && idx !== ovRset.selectedIndex()) {
276 + ovRset.selectedIndex(idx);
277 + }
278 + }
279 +
273 angular.module('ovTopo') 280 angular.module('ovTopo')
274 .factory('TopoToolbarService', 281 .factory('TopoToolbarService',
275 ['$log', 'FnService', 'ToolbarService', 'PrefsService', 282 ['$log', 'FnService', 'ToolbarService', 'PrefsService',
...@@ -289,7 +296,8 @@ ...@@ -289,7 +296,8 @@
289 destroyToolbar: destroyToolbar, 296 destroyToolbar: destroyToolbar,
290 keyListener: keyListener, 297 keyListener: keyListener,
291 toggleToolbar: toggleToolbar, 298 toggleToolbar: toggleToolbar,
292 - setDefaultOverlay: setDefaultOverlay 299 + setDefaultOverlay: setDefaultOverlay,
300 + fnkey: fnkey
293 }; 301 };
294 }]); 302 }]);
295 }()); 303 }());
...\ No newline at end of file ...\ No newline at end of file
......