blob: d30ba2f6999a2369056196de635ee7eb8279b763 [file] [log] [blame]
Simon Hunta17fa672015-08-19 18:42:22 -07001/*
2 * Copyright 2015 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.
Simon Hunta17fa672015-08-19 18:42:22 -070015 */
16
17package org.onosproject.ui.topo;
18
Simon Huntd6685d02015-08-21 09:56:06 -070019import static com.google.common.base.Preconditions.checkNotNull;
20
Simon Hunta17fa672015-08-19 18:42:22 -070021/**
Simon Hunt4fc86852015-08-20 17:57:52 -070022 * Partial implementation of the highlighting to apply to topology
23 * view elements.
Simon Hunta17fa672015-08-19 18:42:22 -070024 */
25public abstract class AbstractHighlight {
26 private final TopoElementType type;
27 private final String elementId;
Simon Hunt5b3ff902015-08-27 09:46:27 -070028 private boolean keepSubdued = false;
Simon Hunta17fa672015-08-19 18:42:22 -070029
Simon Hunt4fc86852015-08-20 17:57:52 -070030 /**
31 * Constructs the highlight.
32 *
33 * @param type highlight element type
34 * @param elementId element identifier
35 */
Simon Hunta17fa672015-08-19 18:42:22 -070036 public AbstractHighlight(TopoElementType type, String elementId) {
Simon Huntd6685d02015-08-21 09:56:06 -070037 this.type = checkNotNull(type);
38 this.elementId = checkNotNull(elementId);
Simon Hunta17fa672015-08-19 18:42:22 -070039 }
40
Simon Hunt4fc86852015-08-20 17:57:52 -070041 /**
Simon Hunt5b3ff902015-08-27 09:46:27 -070042 * Sets a flag to tell the renderer to keep this element subdued.
43 */
44 public void keepSubdued() {
45 keepSubdued = true;
46 }
47
48 /**
Simon Hunt4fc86852015-08-20 17:57:52 -070049 * Returns the element type.
50 *
51 * @return element type
52 */
Simon Hunta17fa672015-08-19 18:42:22 -070053 public TopoElementType type() {
54 return type;
55 }
56
Simon Hunt4fc86852015-08-20 17:57:52 -070057 /**
58 * Returns the element identifier.
59 *
60 * @return element identifier
61 */
Simon Hunta17fa672015-08-19 18:42:22 -070062 public String elementId() {
63 return elementId;
64 }
Simon Hunt5b3ff902015-08-27 09:46:27 -070065
66 /**
67 * Returns the subdued flag.
68 *
69 * @return subdued flag
70 */
71 public boolean subdued() {
72 return keepSubdued;
73 }
Simon Hunta17fa672015-08-19 18:42:22 -070074}