Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
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. |
| 26 | */ |
| 27 | public interface UiTopoLayoutService { |
| 28 | |
| 29 | /** |
Thomas Vachuska | 92b016b | 2016-05-20 11:37:57 -0700 | [diff] [blame] | 30 | * Returns the top-level root layout, which always exists and cannot |
| 31 | * be removed or associated directly with a region. |
| 32 | * |
| 33 | * @return root topology layout |
| 34 | */ |
| 35 | UiTopoLayout getRootLayout(); |
| 36 | |
| 37 | /** |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 38 | * Returns the set of available layouts. |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 39 | * |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 40 | * @return set of available layouts |
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 | Set<UiTopoLayout> getLayouts(); |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 45 | * Adds a layout to the system or updates an existing one. |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 46 | * |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 47 | * @param layout the layout to add or update |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 48 | * @return an indication of success |
| 49 | */ |
| 50 | boolean addLayout(UiTopoLayout layout); |
| 51 | |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 52 | /** |
| 53 | * Returns the layout with the specified identifier. |
Thomas Vachuska | 92b016b | 2016-05-20 11:37:57 -0700 | [diff] [blame] | 54 | * |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 55 | * @param layoutId layout identifier |
| 56 | * @return layout or null if no such layout is found |
| 57 | */ |
| 58 | UiTopoLayout getLayout(UiTopoLayoutId layoutId); |
| 59 | |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 60 | /** |
Simon Hunt | 4f4ffc3 | 2016-08-03 18:30:47 -0700 | [diff] [blame] | 61 | * Returns the layout which has the backing region identified by |
| 62 | * the given region identifier. |
| 63 | * |
| 64 | * @param regionId region identifier |
| 65 | * @return corresponding layout |
| 66 | */ |
| 67 | UiTopoLayout getLayout(RegionId regionId); |
| 68 | |
| 69 | /** |
Simon Hunt | b1ce260 | 2016-07-23 14:04:31 -0700 | [diff] [blame] | 70 | * Returns the set of peer layouts of the specified layout. That is, |
| 71 | * those layouts that share the same parent. |
| 72 | * |
| 73 | * @param layoutId layout identifier |
| 74 | * @return set of peer layouts; empty set if layout has no peers |
| 75 | */ |
Simon Hunt | 9818919 | 2016-07-29 19:02:27 -0700 | [diff] [blame] | 76 | Set<UiTopoLayout> getPeerLayouts(UiTopoLayoutId layoutId); |
Simon Hunt | b1ce260 | 2016-07-23 14:04:31 -0700 | [diff] [blame] | 77 | |
| 78 | /** |
Thomas Vachuska | 92b016b | 2016-05-20 11:37:57 -0700 | [diff] [blame] | 79 | * Returns the set of the child layouts of the specified layout. |
| 80 | * |
| 81 | * @param layoutId layout identifier |
| 82 | * @return set of child layouts; empty set if layout has no children |
| 83 | */ |
| 84 | Set<UiTopoLayout> getChildren(UiTopoLayoutId layoutId); |
| 85 | |
| 86 | /** |
Simon Hunt | f679c4e | 2016-04-01 17:02:24 -0700 | [diff] [blame] | 87 | * Removes a layout from the system. |
| 88 | * |
| 89 | * @param layout the layout to remove |
| 90 | * @return an indication of success |
| 91 | */ |
| 92 | boolean removeLayout(UiTopoLayout layout); |
| 93 | |
| 94 | } |