diff options
author | 2015-09-09 22:15:21 -0700 | |
---|---|---|
committer | 2015-09-09 22:15:21 -0700 | |
commit | 13d05bc8458758ee39cb829098241e89616717ee (patch) | |
tree | 22a4d1ce65f15952f07a3df5af4b462b4697cb3a /framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork | |
parent | 6139282e1e93c2322076de4b91b1c85d0bc4a8b3 (diff) |
ONOS checkin based on commit tag e796610b1f721d02f9b0e213cf6f7790c10ecd60
Change-Id: Ife8810491034fe7becdba75dda20de4267bd15cd
Diffstat (limited to 'framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork')
3 files changed, 235 insertions, 0 deletions
diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork/AppUiTopoOverlay.java b/framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork/AppUiTopoOverlay.java new file mode 100644 index 00000000..c6d00cc0 --- /dev/null +++ b/framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork/AppUiTopoOverlay.java @@ -0,0 +1,74 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.meowster.over; + +import org.onosproject.ui.UiTopoOverlay; +import org.onosproject.ui.topo.ButtonId; +import org.onosproject.ui.topo.PropertyPanel; +import org.onosproject.ui.topo.TopoConstants.CoreButtons; +import org.onosproject.ui.topo.TopoConstants.Glyphs; + +import static org.onosproject.ui.topo.TopoConstants.Properties.*; + +/** + * Our topology overlay. + */ +public class AppUiTopoOverlay extends UiTopoOverlay { + + // NOTE: this must match the ID defined in topov.js + private static final String OVERLAY_ID = "meowster-overlay"; + + private static final String MY_TITLE = "I changed the title"; + private static final String MY_VERSION = "Beta-1.0.0042"; + + private static final ButtonId FOO_BUTTON = new ButtonId("foo"); + private static final ButtonId BAR_BUTTON = new ButtonId("bar"); + + public AppUiTopoOverlay() { + super(OVERLAY_ID); + } + + + @Override + public void modifySummary(PropertyPanel pp) { + pp.title("My App Rocks!") + .typeId(Glyphs.CROWN) + .removeProps( + TOPOLOGY_SSCS, + INTENTS, + TUNNELS, + FLOWS, + VERSION + ) + .addProp(VERSION, MY_VERSION); + + } + + @Override + public void modifyDeviceDetails(PropertyPanel pp) { + pp.title(MY_TITLE); + pp.removeProps(LATITUDE, LONGITUDE); + + pp.addButton(FOO_BUTTON) + .addButton(BAR_BUTTON); + + pp.removeButtons(CoreButtons.SHOW_PORT_VIEW) + .removeButtons(CoreButtons.SHOW_GROUP_VIEW); + } + +} diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork/README.txt b/framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork/README.txt new file mode 100644 index 00000000..d7dcbecd --- /dev/null +++ b/framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork/README.txt @@ -0,0 +1,4 @@ +NOTE: + +This directory is putting under revision control some key files from +an example stand-alone app, as I develop the topology overlay functionality. diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork/topov.js b/framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork/topov.js new file mode 100644 index 00000000..068c30c5 --- /dev/null +++ b/framework/src/onos/web/gui/src/main/webapp/_sdh/overlaywork/topov.js @@ -0,0 +1,157 @@ +// sample topology overlay - client side +(function () { + 'use strict'; + + // injected refs + var $log, tov; + + // internal state + var someStateValue = true; + + // our overlay definition + var overlay = { + // NOTE: this must match the ID defined in AppUiTopoOverlay + overlayId: 'meowster-overlay', + glyphId: '*star4', + tooltip: 'Sample Meowster Topo Overlay', + + // These glyphs get installed using the overlayId as a prefix. + // e.g. 'star4' is installed as 'meowster-overlay-star4' + // They can be referenced (from this overlay) as '*star4' + // That is, the '*' prefix stands in for 'meowster-overlay-' + glyphs: { + star4: { + vb: '0 0 8 8', + d: 'M1,4l2,-1l1,-2l1,2l2,1l-2,1l-1,2l-1,-2z' + }, + banner: { + vb: '0 0 6 6', + d: 'M1,1v4l2,-2l2,2v-4z' + } + }, + + activate: function () { + $log.debug("sample topology overlay ACTIVATED"); + }, + deactivate: function () { + $log.debug("sample topology overlay DEACTIVATED"); + }, + + + + + + // detail panel button definitions + buttons: { + foo: { + gid: 'chain', + tt: 'A FOO action', + cb: function (data) { + $log.debug('FOO action invoked with data:', data); + } + }, + bar: { + gid: '*banner', + tt: 'A BAR action', + cb: function (data) { + $log.debug('BAR action invoked with data:', data); + } + } + }, + + // Key bindings for traffic overlay buttons + // NOTE: fully qual. button ID is derived from overlay-id and key-name + keyBindings: { + V: { + cb: buttonCallback, + tt: 'Uses the V key', + gid: '*banner' + }, + F: { + cb: buttonCallback, + tt: 'Uses the F key', + gid: 'chain' + }, + G: { + cb: buttonCallback, + tt: 'Uses the G key', + gid: 'crown' + }, + + T: { + cb: buttonCallback, + tt: 'Uses the T key', + gid: 'switch' + }, + + R: { + cb: buttonCallback, + tt: 'Uses the R key', + gid: 'endstation' + }, + + 0: { + cb: buttonCallback, + tt: 'Uses the ZERO key', + gid: 'xMark' + }, + + _keyOrder: [ + '0', 'V', 'F', 'G', 'T', 'R' + ] + + // NOTE: T and R should be rejected (not installed) + // T is reserved for 'toggle Theme' + // R is reserved for 'Reset pan and zoom' + }, + + hooks: { + // hook for handling escape key + // Must return true to consume ESC, false otherwise. + escape: cancelState, + + // hooks for when the selection changes... + empty: function () { + selectionCallback('empty'); + }, + single: function (data) { + selectionCallback('single', data); + }, + multi: function (selectOrder) { + selectionCallback('multi', selectOrder); + tov.addDetailButton('foo'); + tov.addDetailButton('bar'); + } + } + + }; + + // invoked when the escape key is pressed + function cancelState() { + if (someStateValue) { + someStateValue = false; + // we consumed the ESC event + return true; + } + return false; + } + + function buttonCallback(x) { + $log.debug('Toolbar-button callback', x); + } + + function selectionCallback(x, d) { + $log.debug('Selection callback', x, d); + } + + // invoke code to register with the overlay service + angular.module('ovSample') + .run(['$log', 'TopoOverlayService', + + function (_$log_, _tov_) { + $log = _$log_; + tov = _tov_; + tov.register(overlay); + }]); + +}()); |