Brian O'Connor
Committed by Gerrit Code Review

Removing old code from ui/_dev

Change-Id: Ic87885195a6c302d6737b985413eece3fa260e26
1 -/*
2 - * Copyright 2016-present Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - *
16 - */
17 -
18 -package org.meowster.over;
19 -
20 -import org.onosproject.ui.UiTopoOverlay;
21 -import org.onosproject.ui.topo.ButtonId;
22 -import org.onosproject.ui.topo.PropertyPanel;
23 -import org.onosproject.ui.topo.TopoConstants.CoreButtons;
24 -import org.onosproject.ui.topo.TopoConstants.Glyphs;
25 -
26 -import static org.onosproject.ui.topo.TopoConstants.Properties.*;
27 -
28 -/**
29 - * Our topology overlay.
30 - */
31 -public class AppUiTopoOverlay extends UiTopoOverlay {
32 -
33 - // NOTE: this must match the ID defined in topov.js
34 - private static final String OVERLAY_ID = "meowster-overlay";
35 -
36 - private static final String MY_TITLE = "I changed the title";
37 - private static final String MY_VERSION = "Beta-1.0.0042";
38 -
39 - private static final ButtonId FOO_BUTTON = new ButtonId("foo");
40 - private static final ButtonId BAR_BUTTON = new ButtonId("bar");
41 -
42 - public AppUiTopoOverlay() {
43 - super(OVERLAY_ID);
44 - }
45 -
46 -
47 - @Override
48 - public void modifySummary(PropertyPanel pp) {
49 - pp.title("My App Rocks!")
50 - .typeId(Glyphs.CROWN)
51 - .removeProps(
52 - TOPOLOGY_SSCS,
53 - INTENTS,
54 - TUNNELS,
55 - FLOWS,
56 - VERSION
57 - )
58 - .addProp(VERSION, MY_VERSION);
59 -
60 - }
61 -
62 - @Override
63 - public void modifyDeviceDetails(PropertyPanel pp) {
64 - pp.title(MY_TITLE);
65 - pp.removeProps(LATITUDE, LONGITUDE);
66 -
67 - pp.addButton(FOO_BUTTON)
68 - .addButton(BAR_BUTTON);
69 -
70 - pp.removeButtons(CoreButtons.SHOW_PORT_VIEW)
71 - .removeButtons(CoreButtons.SHOW_GROUP_VIEW)
72 - .removeButtons(CoreButtons.SHOW_METER_VIEW);
73 - }
74 -
75 -}
1 -NOTE:
2 -
3 -This directory is putting under revision control some key files from
4 -an example stand-alone app, as I develop the topology overlay functionality.
1 -// sample topology overlay - client side
2 -(function () {
3 - 'use strict';
4 -
5 - // injected refs
6 - var $log, tov;
7 -
8 - // internal state
9 - var someStateValue = true;
10 -
11 - // our overlay definition
12 - var overlay = {
13 - // NOTE: this must match the ID defined in AppUiTopoOverlay
14 - overlayId: 'meowster-overlay',
15 - glyphId: '*star4',
16 - tooltip: 'Sample Meowster Topo Overlay',
17 -
18 - // These glyphs get installed using the overlayId as a prefix.
19 - // e.g. 'star4' is installed as 'meowster-overlay-star4'
20 - // They can be referenced (from this overlay) as '*star4'
21 - // That is, the '*' prefix stands in for 'meowster-overlay-'
22 - glyphs: {
23 - star4: {
24 - vb: '0 0 8 8',
25 - d: 'M1,4l2,-1l1,-2l1,2l2,1l-2,1l-1,2l-1,-2z'
26 - },
27 - banner: {
28 - vb: '0 0 6 6',
29 - d: 'M1,1v4l2,-2l2,2v-4z'
30 - }
31 - },
32 -
33 - activate: function () {
34 - $log.debug("sample topology overlay ACTIVATED");
35 - },
36 - deactivate: function () {
37 - $log.debug("sample topology overlay DEACTIVATED");
38 - },
39 -
40 -
41 -
42 -
43 -
44 - // detail panel button definitions
45 - buttons: {
46 - foo: {
47 - gid: 'chain',
48 - tt: 'A FOO action',
49 - cb: function (data) {
50 - $log.debug('FOO action invoked with data:', data);
51 - }
52 - },
53 - bar: {
54 - gid: '*banner',
55 - tt: 'A BAR action',
56 - cb: function (data) {
57 - $log.debug('BAR action invoked with data:', data);
58 - }
59 - }
60 - },
61 -
62 - // Key bindings for traffic overlay buttons
63 - // NOTE: fully qual. button ID is derived from overlay-id and key-name
64 - keyBindings: {
65 - V: {
66 - cb: buttonCallback,
67 - tt: 'Uses the V key',
68 - gid: '*banner'
69 - },
70 - F: {
71 - cb: buttonCallback,
72 - tt: 'Uses the F key',
73 - gid: 'chain'
74 - },
75 - G: {
76 - cb: buttonCallback,
77 - tt: 'Uses the G key',
78 - gid: 'crown'
79 - },
80 -
81 - T: {
82 - cb: buttonCallback,
83 - tt: 'Uses the T key',
84 - gid: 'switch'
85 - },
86 -
87 - R: {
88 - cb: buttonCallback,
89 - tt: 'Uses the R key',
90 - gid: 'endstation'
91 - },
92 -
93 - 0: {
94 - cb: buttonCallback,
95 - tt: 'Uses the ZERO key',
96 - gid: 'xMark'
97 - },
98 -
99 - _keyOrder: [
100 - '0', 'V', 'F', 'G', 'T', 'R'
101 - ]
102 -
103 - // NOTE: T and R should be rejected (not installed)
104 - // T is reserved for 'toggle Theme'
105 - // R is reserved for 'Reset pan and zoom'
106 - },
107 -
108 - hooks: {
109 - // hook for handling escape key
110 - // Must return true to consume ESC, false otherwise.
111 - escape: cancelState,
112 -
113 - // hooks for when the selection changes...
114 - empty: function () {
115 - selectionCallback('empty');
116 - },
117 - single: function (data) {
118 - selectionCallback('single', data);
119 - },
120 - multi: function (selectOrder) {
121 - selectionCallback('multi', selectOrder);
122 - tov.addDetailButton('foo');
123 - tov.addDetailButton('bar');
124 - }
125 - }
126 -
127 - };
128 -
129 - // invoked when the escape key is pressed
130 - function cancelState() {
131 - if (someStateValue) {
132 - someStateValue = false;
133 - // we consumed the ESC event
134 - return true;
135 - }
136 - return false;
137 - }
138 -
139 - function buttonCallback(x) {
140 - $log.debug('Toolbar-button callback', x);
141 - }
142 -
143 - function selectionCallback(x, d) {
144 - $log.debug('Selection callback', x, d);
145 - }
146 -
147 - // invoke code to register with the overlay service
148 - angular.module('ovSample')
149 - .run(['$log', 'TopoOverlayService',
150 -
151 - function (_$log_, _tov_) {
152 - $log = _$log_;
153 - tov = _tov_;
154 - tov.register(overlay);
155 - }]);
156 -
157 -}());