Simon Hunt | e05cae4 | 2015-07-23 17:35:24 -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 | e05cae4 | 2015-07-23 17:35:24 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | package org.onosproject.ui; |
| 18 | |
Simon Hunt | de99e0b | 2015-10-23 18:54:06 -0700 | [diff] [blame] | 19 | import org.onosproject.net.DeviceId; |
| 20 | import org.onosproject.net.HostId; |
Simon Hunt | 0af1ec3 | 2015-07-24 12:17:55 -0700 | [diff] [blame] | 21 | import org.onosproject.ui.topo.PropertyPanel; |
Simon Hunt | e05cae4 | 2015-07-23 17:35:24 -0700 | [diff] [blame] | 22 | import org.slf4j.Logger; |
| 23 | import org.slf4j.LoggerFactory; |
| 24 | |
| 25 | /** |
| 26 | * Represents user interface topology view overlay. |
| 27 | */ |
| 28 | public class UiTopoOverlay { |
| 29 | |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Logger for this overlay. |
| 32 | */ |
| 33 | protected final Logger log = LoggerFactory.getLogger(getClass()); |
Simon Hunt | e05cae4 | 2015-07-23 17:35:24 -0700 | [diff] [blame] | 34 | |
| 35 | private final String id; |
| 36 | |
Simon Hunt | d2862c3 | 2015-08-24 17:41:51 -0700 | [diff] [blame] | 37 | private boolean isActive = false; |
| 38 | |
Simon Hunt | e05cae4 | 2015-07-23 17:35:24 -0700 | [diff] [blame] | 39 | /** |
| 40 | * Creates a new user interface topology view overlay descriptor. |
| 41 | * |
| 42 | * @param id overlay identifier |
| 43 | */ |
| 44 | public UiTopoOverlay(String id) { |
| 45 | this.id = id; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Returns the identifier for this overlay. |
| 50 | * |
| 51 | * @return the identifier |
| 52 | */ |
| 53 | public String id() { |
| 54 | return id; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Callback invoked to initialize this overlay, soon after creation. |
| 59 | * This default implementation does nothing. |
| 60 | */ |
| 61 | public void init() { |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Callback invoked when this overlay is activated. |
| 66 | */ |
| 67 | public void activate() { |
Simon Hunt | d2862c3 | 2015-08-24 17:41:51 -0700 | [diff] [blame] | 68 | isActive = true; |
Simon Hunt | e05cae4 | 2015-07-23 17:35:24 -0700 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Callback invoked when this overlay is deactivated. |
| 73 | */ |
| 74 | public void deactivate() { |
Simon Hunt | d2862c3 | 2015-08-24 17:41:51 -0700 | [diff] [blame] | 75 | isActive = false; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Returns true if this overlay is currently active. |
| 80 | * |
| 81 | * @return true if overlay active |
| 82 | */ |
| 83 | public boolean isActive() { |
| 84 | return isActive; |
Simon Hunt | e05cae4 | 2015-07-23 17:35:24 -0700 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Callback invoked to destroy this instance by cleaning up any |
| 89 | * internal state ready for garbage collection. |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 90 | * This default implementation holds no state and does nothing. |
Simon Hunt | e05cae4 | 2015-07-23 17:35:24 -0700 | [diff] [blame] | 91 | */ |
| 92 | public void destroy() { |
| 93 | } |
Simon Hunt | 0af1ec3 | 2015-07-24 12:17:55 -0700 | [diff] [blame] | 94 | |
| 95 | /** |
| 96 | * Callback to modify the contents of the summary panel. |
| 97 | * This default implementation does nothing. |
| 98 | * |
| 99 | * @param pp property panel model of summary data |
| 100 | */ |
| 101 | public void modifySummary(PropertyPanel pp) { |
| 102 | } |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 103 | |
| 104 | /** |
| 105 | * Callback to modify the contents of the details panel for |
| 106 | * a selected device. |
| 107 | * This default implementation does nothing. |
| 108 | * |
| 109 | * @param pp property panel model of summary data |
Ray Milkey | e3026a4 | 2015-10-27 10:39:42 -0700 | [diff] [blame] | 110 | * @param deviceId device id |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 111 | */ |
Simon Hunt | de99e0b | 2015-10-23 18:54:06 -0700 | [diff] [blame] | 112 | public void modifyDeviceDetails(PropertyPanel pp, DeviceId deviceId) { |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Callback to modify the contents of the details panel for |
| 117 | * a selected host. |
| 118 | * This default implementation does nothing. |
| 119 | * |
| 120 | * @param pp property panel model of summary data |
Ray Milkey | e3026a4 | 2015-10-27 10:39:42 -0700 | [diff] [blame] | 121 | * @param hostId host id |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 122 | */ |
Simon Hunt | de99e0b | 2015-10-23 18:54:06 -0700 | [diff] [blame] | 123 | public void modifyHostDetails(PropertyPanel pp, HostId hostId) { |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 124 | } |
Simon Hunt | e05cae4 | 2015-07-23 17:35:24 -0700 | [diff] [blame] | 125 | } |