Class UiRegion


  • public class UiRegion
    extends UiNode
    Represents a region.
    • Field Detail

      • NULL_ID

        public 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

      • UiRegion

        public 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

      • destroy

        protected void destroy()
        Description copied from class: UiElement
        Removes all external references, and prepares the instance for garbage collection. This default implementation does nothing.
        Overrides:
        destroy in class UiElement
      • setLayerOrder

        public void setLayerOrder​(String... layers)
        Sets the layer order for this region. Typically, the UiNode.LAYER_* constants will be used here.
        Parameters:
        layers - the layers
      • id

        public RegionId id()
        Returns the identity of the region.
        Returns:
        region ID
      • parent

        public RegionId parent()
        Returns the identity of the parent region.
        Returns:
        parent region ID
      • isRoot

        public boolean isRoot()
        Returns true if this is the root (default) region.
        Returns:
        true if root region
      • children

        public Set<RegionId> children()
        Returns the identities of the child regions.
        Returns:
        child region IDs
      • parentRegion

        public UiRegion parentRegion()
        Returns the UI region that is the parent of this region.
        Returns:
        the parent region
      • setParent

        public void setParent​(RegionId parentId)
        Sets the parent ID for this region.
        Parameters:
        parentId - parent ID
      • setChildren

        public void setChildren​(Set<RegionId> children)
        Sets the children IDs for this region.
        Parameters:
        children - children IDs
      • idAsString

        public String idAsString()
        Description copied from class: UiElement
        Returns a string representation of the element identifier.
        Specified by:
        idAsString in class UiElement
        Returns:
        the element unique identifier
      • name

        public String name()
        Description copied from class: UiElement
        Returns a friendly name to be used for display purposes. This default implementation returns the result of calling UiElement.idAsString().
        Overrides:
        name in class UiElement
        Returns:
        the friendly name
      • backingRegion

        public 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
      • reconcileDevices

        public void reconcileDevices​(Set<DeviceId> devices)
        Make sure we have only these devices in the region.
        Parameters:
        devices - devices in the region
      • type

        public Region.Type type()
        Returns the region's type.
        Returns:
        region type
      • deviceCount

        public int deviceCount()
        Returns the count of devices in this region.
        Returns:
        the device count
      • deviceIds

        public Set<DeviceId> deviceIds()
        Returns the set of device identifiers for this region.
        Returns:
        device identifiers for this region
      • devices

        public Set<UiDevice> devices()
        Returns the devices in this region.
        Returns:
        the devices in this region
      • reconcileHosts

        public void reconcileHosts​(Set<HostId> hosts)
        Make sure we have only these hosts in the region.
        Parameters:
        hosts - hosts in the region
      • hostIds

        public Set<HostId> hostIds()
        Returns the set of host identifiers for this region.
        Returns:
        host identifiers for this region
      • hosts

        public Set<UiHost> hosts()
        Returns the hosts in this region.
        Returns:
        the hosts in this region
      • hostCount

        public int hostCount()
        Returns the count of devices in this region.
        Returns:
        the device count
      • layerOrder

        public List<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
      • safeName

        public static 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
      • isRelevant

        public 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
      • newDeviceAdded

        public void newDeviceAdded​(DeviceId deviceId)
      • deviceRemoved

        public void deviceRemoved​(DeviceId deviceId)