blob: bfd2a3f1d9c9d62eba47339ad9a17740529e83d4 [file] [log] [blame]
Steven Burrows5570d1b2016-09-28 14:21:00 -07001/*
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 ONOS GUI -- Topology Layout Module.
19 Module that contains the d3.force.layout logic
20 */
21
22(function () {
23 'use strict';
24
25 var ps;
26
27 var Panel = function (id, options) {
28 this.id = id;
29 this.p = ps.createPanel(this.id, options);
30 this.setup();
31
32 this.p.show();
33 };
34
35 Panel.prototype = {
36 setup: function () {
37 var panel = this.p;
38 panel.empty();
39
40 panel.append('div').classed('header', true);
41 panel.append('div').classed('body', true);
42 panel.append('div').classed('footer', true);
43
44 this.header = panel.el().select('.header');
45 this.body = panel.el().select('.body');
46 this.footer = panel.el().select('.body');
47 },
48 appendToHeader: function (x) {
49 return this.header.append(x);
50 },
51 appendToBody: function (x) {
52 return this.body.append(x);
53 },
54 appendToFooter: function (x) {
55 return this.footer.append(x);
56 },
57 emptyRegions: function () {
58 this.header.selectAll("*").remove();
59 this.body.selectAll("*").remove();
60 this.footer.selectAll("*").remove();
61 },
62 destory: function () {
63 ps.destroy(this.id);
64 }
65 };
66
67 angular.module('ovTopo2')
68 .factory('Topo2PanelService', ['PanelService',
69 function (_ps_) {
70 ps = _ps_;
71 return Panel;
72 }
73 ]);
74
75})();