Simon Hunt | 1ee0985 | 2015-09-29 12:28:14 -0700 | [diff] [blame] | 1 | #set( $symbol_pound = '#' ) |
| 2 | #set( $symbol_dollar = '$' ) |
| 3 | #set( $symbol_escape = '\' ) |
| 4 | /* |
Jian Li | c6c76dc | 2016-01-26 14:22:51 -0800 | [diff] [blame^] | 5 | * Copyright ${year} Open Networking Laboratory |
Simon Hunt | 1ee0985 | 2015-09-29 12:28:14 -0700 | [diff] [blame] | 6 | * |
| 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 | */ |
| 19 | package ${package}; |
| 20 | |
| 21 | import org.onosproject.net.Link; |
| 22 | import org.onosproject.net.LinkKey; |
| 23 | import org.onosproject.ui.topo.BiLink; |
| 24 | import org.onosproject.ui.topo.LinkHighlight; |
| 25 | import 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 | */ |
| 31 | public 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 | } |