blob: 8872087929cc950bd5933ca268c8649c800103f0 [file] [log] [blame]
Simon Huntf679c4e2016-04-01 17:02:24 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Simon Huntf679c4e2016-04-01 17:02:24 -07003 *
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 */
16package org.onosproject.ui;
17
Simon Hunt4f4ffc32016-08-03 18:30:47 -070018import org.onosproject.net.region.RegionId;
Simon Huntf679c4e2016-04-01 17:02:24 -070019import org.onosproject.ui.model.topo.UiTopoLayout;
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070020import org.onosproject.ui.model.topo.UiTopoLayoutId;
Simon Huntf679c4e2016-04-01 17:02:24 -070021
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070022import java.util.Set;
Simon Huntf679c4e2016-04-01 17:02:24 -070023
24/**
25 * Service for managing {@link UiTopoLayout} instances.
Simon Hunt8add9ee2016-09-20 17:05:07 -070026 * Those instances are used in conjunction with modeling the region-based
27 * topology views.
Simon Huntf679c4e2016-04-01 17:02:24 -070028 */
29public interface UiTopoLayoutService {
30
31 /**
Thomas Vachuska92b016b2016-05-20 11:37:57 -070032 * 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 Huntd0fa2842016-10-24 18:04:05 -070040 * Returns the set of available layouts (not including the root layout).
Simon Huntf679c4e2016-04-01 17:02:24 -070041 *
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070042 * @return set of available layouts
Simon Huntf679c4e2016-04-01 17:02:24 -070043 */
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070044 Set<UiTopoLayout> getLayouts();
Simon Huntf679c4e2016-04-01 17:02:24 -070045
46 /**
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070047 * Adds a layout to the system or updates an existing one.
Simon Huntf679c4e2016-04-01 17:02:24 -070048 *
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070049 * @param layout the layout to add or update
Simon Hunt8add9ee2016-09-20 17:05:07 -070050 * @return true if added; false if updated
Simon Huntf679c4e2016-04-01 17:02:24 -070051 */
52 boolean addLayout(UiTopoLayout layout);
53
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070054 /**
55 * Returns the layout with the specified identifier.
Thomas Vachuska92b016b2016-05-20 11:37:57 -070056 *
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070057 * @param layoutId layout identifier
58 * @return layout or null if no such layout is found
59 */
60 UiTopoLayout getLayout(UiTopoLayoutId layoutId);
61
Simon Huntf679c4e2016-04-01 17:02:24 -070062 /**
Simon Hunt4f4ffc32016-08-03 18:30:47 -070063 * 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 */
69 UiTopoLayout getLayout(RegionId regionId);
70
71 /**
Simon Huntb1ce2602016-07-23 14:04:31 -070072 * Returns the set of peer layouts of the specified layout. That is,
73 * those layouts that share the same parent.
74 *
75 * @param layoutId layout identifier
76 * @return set of peer layouts; empty set if layout has no peers
77 */
Simon Hunt98189192016-07-29 19:02:27 -070078 Set<UiTopoLayout> getPeerLayouts(UiTopoLayoutId layoutId);
Simon Huntb1ce2602016-07-23 14:04:31 -070079
80 /**
Thomas Vachuska92b016b2016-05-20 11:37:57 -070081 * Returns the set of the child layouts of the specified layout.
82 *
83 * @param layoutId layout identifier
84 * @return set of child layouts; empty set if layout has no children
85 */
86 Set<UiTopoLayout> getChildren(UiTopoLayoutId layoutId);
87
88 /**
Simon Huntf679c4e2016-04-01 17:02:24 -070089 * Removes a layout from the system.
90 *
91 * @param layout the layout to remove
Simon Hunt8add9ee2016-09-20 17:05:07 -070092 * @return true if removed; false if no longer registered
Simon Huntf679c4e2016-04-01 17:02:24 -070093 */
94 boolean removeLayout(UiTopoLayout layout);
95
96}