Package org.onosproject.ui.model.topo
Class UiRegion
- java.lang.Object
- 
- org.onosproject.ui.model.topo.UiElement
- 
- org.onosproject.ui.model.topo.UiNode
- 
- org.onosproject.ui.model.topo.UiRegion
 
 
 
- 
 public class UiRegion extends UiNode Represents a region.
- 
- 
Field SummaryFields Modifier and Type Field Description static RegionIdNULL_IDThe identifier for the null-region.static java.lang.StringNULL_NAME- 
Fields inherited from class org.onosproject.ui.model.topo.UiNodeLAYER_DEFAULT, LAYER_OPTICAL, LAYER_PACKET
 
- 
 - 
Constructor SummaryConstructors Constructor Description UiRegion(UiTopology topology, Region region)Constructs a UI region, with a reference to the specified backing region.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RegionbackingRegion()Returns the region instance backing this UI region.java.util.Set<RegionId>children()Returns the identities of the child regions.protected voiddestroy()Removes all external references, and prepares the instance for garbage collection.intdeviceCount()Returns the count of devices in this region.java.util.Set<DeviceId>deviceIds()Returns the set of device identifiers for this region.voiddeviceRemoved(DeviceId deviceId)java.util.Set<UiDevice>devices()Returns the devices in this region.inthostCount()Returns the count of devices in this region.java.util.Set<HostId>hostIds()Returns the set of host identifiers for this region.java.util.Set<UiHost>hosts()Returns the hosts in this region.RegionIdid()Returns the identity of the region.java.lang.StringidAsString()Returns a string representation of the element identifier.booleanisRelevant(UiModelEvent event)Determins whether the specified event is relevant to the view constrained to this region.booleanisRoot()Returns true if this is the root (default) region.java.util.List<java.lang.String>layerOrder()Returns the order in which layers should be rendered.java.lang.Stringname()Returns a friendly name to be used for display purposes.voidnewDeviceAdded(DeviceId deviceId)RegionIdparent()Returns the identity of the parent region.UiRegionparentRegion()Returns the UI region that is the parent of this region.voidreconcileDevices(java.util.Set<DeviceId> devices)Make sure we have only these devices in the region.voidreconcileHosts(java.util.Set<HostId> hosts)Make sure we have only these hosts in the region.static java.lang.StringsafeName(Region region)Guarantees to return a string for the name of the specified region.voidsetChildren(java.util.Set<RegionId> children)Sets the children IDs for this region.voidsetLayerOrder(java.lang.String... layers)Sets the layer order for this region.voidsetParent(RegionId parentId)Sets the parent ID for this region.java.lang.StringtoString()Region.Typetype()Returns the region's type.
 
- 
- 
- 
Field Detail- 
NULL_NAMEpublic static final java.lang.String NULL_NAME - See Also:
- Constant Field Values
 
 - 
NULL_IDpublic static final RegionId NULL_ID The identifier for the null-region. That is, a container for devices, hosts, and links for those that belong to no region.
 
- 
 - 
Constructor Detail- 
UiRegionpublic UiRegion(UiTopology topology, Region region) Constructs a UI region, with a reference to the specified backing region.- Parameters:
- topology- parent topology
- region- backing region
 
 
- 
 - 
Method Detail- 
destroyprotected void destroy() Description copied from class:UiElementRemoves all external references, and prepares the instance for garbage collection. This default implementation does nothing.
 - 
setLayerOrderpublic void setLayerOrder(java.lang.String... layers) Sets the layer order for this region. Typically, theUiNode.LAYER_*constants will be used here.- Parameters:
- layers- the layers
 
 - 
idpublic RegionId id() Returns the identity of the region.- Returns:
- region ID
 
 - 
parentpublic RegionId parent() Returns the identity of the parent region.- Returns:
- parent region ID
 
 - 
isRootpublic boolean isRoot() Returns true if this is the root (default) region.- Returns:
- true if root region
 
 - 
childrenpublic java.util.Set<RegionId> children() Returns the identities of the child regions.- Returns:
- child region IDs
 
 - 
parentRegionpublic UiRegion parentRegion() Returns the UI region that is the parent of this region.- Returns:
- the parent region
 
 - 
setParentpublic void setParent(RegionId parentId) Sets the parent ID for this region.- Parameters:
- parentId- parent ID
 
 - 
setChildrenpublic void setChildren(java.util.Set<RegionId> children) Sets the children IDs for this region.- Parameters:
- children- children IDs
 
 - 
idAsStringpublic java.lang.String idAsString() Description copied from class:UiElementReturns a string representation of the element identifier.- Specified by:
- idAsStringin class- UiElement
- Returns:
- the element unique identifier
 
 - 
namepublic java.lang.String name() Description copied from class:UiElementReturns a friendly name to be used for display purposes. This default implementation returns the result of callingUiElement.idAsString().
 - 
backingRegionpublic Region backingRegion() Returns the region instance backing this UI region. If this instance represents the "null-region", the value returned will be null.- Returns:
- the backing region instance
 
 - 
reconcileDevicespublic void reconcileDevices(java.util.Set<DeviceId> devices) Make sure we have only these devices in the region.- Parameters:
- devices- devices in the region
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
typepublic Region.Type type() Returns the region's type.- Returns:
- region type
 
 - 
deviceCountpublic int deviceCount() Returns the count of devices in this region.- Returns:
- the device count
 
 - 
deviceIdspublic java.util.Set<DeviceId> deviceIds() Returns the set of device identifiers for this region.- Returns:
- device identifiers for this region
 
 - 
devicespublic java.util.Set<UiDevice> devices() Returns the devices in this region.- Returns:
- the devices in this region
 
 - 
reconcileHostspublic void reconcileHosts(java.util.Set<HostId> hosts) Make sure we have only these hosts in the region.- Parameters:
- hosts- hosts in the region
 
 - 
hostIdspublic java.util.Set<HostId> hostIds() Returns the set of host identifiers for this region.- Returns:
- host identifiers for this region
 
 - 
hostspublic java.util.Set<UiHost> hosts() Returns the hosts in this region.- Returns:
- the hosts in this region
 
 - 
hostCountpublic int hostCount() Returns the count of devices in this region.- Returns:
- the device count
 
 - 
layerOrderpublic java.util.List<java.lang.String> layerOrder() Returns the order in which layers should be rendered. Lower layers come earlier in the list. For example, to indicate that nodes in the optical layer should be rendered "below" nodes in the packet layer, this method should return:[UiNode.LAYER_OPTICAL, UiNode.LAYER_PACKET, UiNode.LAYER_DEFAULT] - Returns:
- layer ordering
 
 - 
safeNamepublic static java.lang.String safeName(Region region) Guarantees to return a string for the name of the specified region. If region is null, we return the null region name, else we return the name as configured on the region.- Parameters:
- region- the region whose name we require
- Returns:
- the region's name
 
 - 
isRelevantpublic boolean isRelevant(UiModelEvent event) Determins whether the specified event is relevant to the view constrained to this region.- Parameters:
- event- UI model event
- Returns:
- true if relevant
 
 - 
newDeviceAddedpublic void newDeviceAdded(DeviceId deviceId) 
 - 
deviceRemovedpublic void deviceRemoved(DeviceId deviceId) 
 
- 
 
-