blob: e8b14e0324d419c244d9fc1f8bb12605c00384a8 [file] [log] [blame]
Simon Hunt1ee09852015-09-29 12:28:14 -07001#set( $symbol_pound = '#' )
2#set( $symbol_dollar = '$' )
3#set( $symbol_escape = '\' )
4/*
Jian Lic6c76dc2016-01-26 14:22:51 -08005 * Copyright ${year} Open Networking Laboratory
Simon Hunt1ee09852015-09-29 12:28:14 -07006 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19package ${package};
20
21import org.onosproject.net.Link;
22import org.onosproject.net.LinkKey;
23import org.onosproject.ui.topo.BiLink;
24import org.onosproject.ui.topo.LinkHighlight;
25import org.onosproject.ui.topo.LinkHighlight.Flavor;
26
27/**
28 * Our demo concrete class of a bi-link. We give it state so we can decide
29 * how to create link highlights.
30 */
31public class DemoLink extends BiLink {
32
33 private boolean important = false;
34 private String label = null;
35
36 public DemoLink(LinkKey key, Link link) {
37 super(key, link);
38 }
39
40 public DemoLink makeImportant() {
41 important = true;
42 return this;
43 }
44
45 public DemoLink setLabel(String label) {
46 this.label = label;
47 return this;
48 }
49
50 @Override
51 public LinkHighlight highlight(Enum<?> anEnum) {
52 Flavor flavor = important ? Flavor.PRIMARY_HIGHLIGHT
53 : Flavor.SECONDARY_HIGHLIGHT;
54 return new LinkHighlight(this.linkId(), flavor)
55 .setLabel(label);
56 }
57}