Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 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. |
| 15 | */ |
| 16 | package org.onosproject.ui; |
| 17 | |
Simon Hunt | 4f4ffc3 | 2016-08-03 18:30:47 -0700 | [diff] [blame] | 18 | import org.onosproject.net.region.RegionId; |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 19 | import org.onosproject.ui.model.topo.UiTopoLayout; |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 20 | import org.onosproject.ui.model.topo.UiTopoLayoutId; |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 21 | |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 22 | import java.util.Set; |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Service for managing {@link UiTopoLayout} instances. |
Simon Hunt | 8add9ee | 2016-09-20 17:05:07 -0700 | [diff] [blame] | 26 | * Those instances are used in conjunction with modeling the region-based |
| 27 | * topology views. |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 28 | */ |
| 29 | public interface UiTopoLayoutService { |
| 30 | |
| 31 | /** |
Thomas Vachuska | 92b016b | 2016-05-20 11:37:57 -0700 | [diff] [blame] | 32 | * Returns the top-level root layout, which always exists and cannot |
| 33 | * be removed or associated directly with a region. |
| 34 | * |
| 35 | * @return root topology layout |
| 36 | */ |
| 37 | UiTopoLayout getRootLayout(); |
| 38 | |
| 39 | /** |
Simon Hunt | d0fa284 | 2016-10-24 18:04:05 -0700 | [diff] [blame] | 40 | * Returns the set of available layouts (not including the root layout). |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 41 | * |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 42 | * @return set of available layouts |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 43 | */ |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 44 | Set<UiTopoLayout> getLayouts(); |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 47 | * Adds a layout to the system or updates an existing one. |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 48 | * |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 49 | * @param layout the layout to add or update |
Simon Hunt | 8add9ee | 2016-09-20 17:05:07 -0700 | [diff] [blame] | 50 | * @return true if added; false if updated |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 51 | */ |
| 52 | boolean addLayout(UiTopoLayout layout); |
| 53 | |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 54 | /** |
| 55 | * Returns the layout with the specified identifier. |
Thomas Vachuska | 92b016b | 2016-05-20 11:37:57 -0700 | [diff] [blame] | 56 | * |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 57 | * @param layoutId layout identifier |
| 58 | * @return layout or null if no such layout is found |
| 59 | */ |
| 60 | UiTopoLayout getLayout(UiTopoLayoutId layoutId); |
| 61 | |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 62 | /** |
Simon Hunt | 4f4ffc3 | 2016-08-03 18:30:47 -0700 | [diff] [blame] | 63 | * Returns the layout which has the backing region identified by |
| 64 | * the given region identifier. |
| 65 | * |
| 66 | * @param regionId region identifier |
| 67 | * @return corresponding layout |
| 68 | */ |
Thomas Vachuska | 528ea95 | 2017-10-09 18:25:35 +0200 | [diff] [blame] | 69 | // FIXME: We will need to add support for multiple layouts (logical & physical) |
| 70 | // for the same region and this method won't have sufficient inputs to resolve |
| 71 | // the desired layout. |
Simon Hunt | 4f4ffc3 | 2016-08-03 18:30:47 -0700 | [diff] [blame] | 72 | UiTopoLayout getLayout(RegionId regionId); |
| 73 | |
| 74 | /** |
Simon Hunt | b1ce260 | 2016-07-23 14:04:31 -0700 | [diff] [blame] | 75 | * Returns the set of peer layouts of the specified layout. That is, |
| 76 | * those layouts that share the same parent. |
| 77 | * |
| 78 | * @param layoutId layout identifier |
| 79 | * @return set of peer layouts; empty set if layout has no peers |
| 80 | */ |
Simon Hunt | 9818919 | 2016-07-29 19:02:27 -0700 | [diff] [blame] | 81 | Set<UiTopoLayout> getPeerLayouts(UiTopoLayoutId layoutId); |
Simon Hunt | b1ce260 | 2016-07-23 14:04:31 -0700 | [diff] [blame] | 82 | |
| 83 | /** |
Thomas Vachuska | 92b016b | 2016-05-20 11:37:57 -0700 | [diff] [blame] | 84 | * Returns the set of the child layouts of the specified layout. |
| 85 | * |
| 86 | * @param layoutId layout identifier |
| 87 | * @return set of child layouts; empty set if layout has no children |
| 88 | */ |
| 89 | Set<UiTopoLayout> getChildren(UiTopoLayoutId layoutId); |
| 90 | |
| 91 | /** |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 92 | * Removes a layout from the system. |
| 93 | * |
| 94 | * @param layout the layout to remove |
Simon Hunt | 8add9ee | 2016-09-20 17:05:07 -0700 | [diff] [blame] | 95 | * @return true if removed; false if no longer registered |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 96 | */ |
| 97 | boolean removeLayout(UiTopoLayout layout); |
| 98 | |
| 99 | } |