Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 1 | /* |
| 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 Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | package org.onosproject.ui.topo; |
| 18 | |
Simon Hunt | d6685d0 | 2015-08-21 09:56:06 -0700 | [diff] [blame] | 19 | import static com.google.common.base.Preconditions.checkNotNull; |
| 20 | |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 21 | /** |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 22 | * Partial implementation of the highlighting to apply to topology |
| 23 | * view elements. |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 24 | */ |
| 25 | public abstract class AbstractHighlight { |
| 26 | private final TopoElementType type; |
| 27 | private final String elementId; |
Simon Hunt | 5b3ff90 | 2015-08-27 09:46:27 -0700 | [diff] [blame] | 28 | private boolean keepSubdued = false; |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 29 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Constructs the highlight. |
| 32 | * |
| 33 | * @param type highlight element type |
| 34 | * @param elementId element identifier |
| 35 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 36 | public AbstractHighlight(TopoElementType type, String elementId) { |
Simon Hunt | d6685d0 | 2015-08-21 09:56:06 -0700 | [diff] [blame] | 37 | this.type = checkNotNull(type); |
| 38 | this.elementId = checkNotNull(elementId); |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 39 | } |
| 40 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 41 | /** |
Simon Hunt | 5b3ff90 | 2015-08-27 09:46:27 -0700 | [diff] [blame] | 42 | * Sets a flag to tell the renderer to keep this element subdued. |
| 43 | */ |
| 44 | public void keepSubdued() { |
| 45 | keepSubdued = true; |
| 46 | } |
| 47 | |
| 48 | /** |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 49 | * Returns the element type. |
| 50 | * |
| 51 | * @return element type |
| 52 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 53 | public TopoElementType type() { |
| 54 | return type; |
| 55 | } |
| 56 | |
Simon Hunt | 4fc8685 | 2015-08-20 17:57:52 -0700 | [diff] [blame] | 57 | /** |
| 58 | * Returns the element identifier. |
| 59 | * |
| 60 | * @return element identifier |
| 61 | */ |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 62 | public String elementId() { |
| 63 | return elementId; |
| 64 | } |
Simon Hunt | 5b3ff90 | 2015-08-27 09:46:27 -0700 | [diff] [blame] | 65 | |
| 66 | /** |
| 67 | * Returns the subdued flag. |
| 68 | * |
| 69 | * @return subdued flag |
| 70 | */ |
| 71 | public boolean subdued() { |
| 72 | return keepSubdued; |
| 73 | } |
Simon Hunt | a17fa67 | 2015-08-19 18:42:22 -0700 | [diff] [blame] | 74 | } |