Package org.onosproject.ui.model.topo
Class UiTopoLayout
- java.lang.Object
-
- org.onosproject.ui.model.topo.UiTopoLayout
-
public class UiTopoLayout extends java.lang.Object
Represents a specific "subset" of the UI model of the network topology that a user might wish to view. Backed by aRegion
.These instances include information about which geo-map or grid-layout should be displayed, along with zoom and offset parameters.
-
-
Constructor Summary
Constructors Constructor Description UiTopoLayout(UiTopoLayoutId id)
Created a new UI topology layout.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
geomap()
Returns the symbolic name for the geomap for this layout.UiTopoLayout
geomap(java.lang.String geomap)
Sets the name of the geomap for this layout.UiTopoLayoutId
id()
Returns the UI layout identifier.boolean
isRoot()
Returns true if this layout instance is at the top of the hierarchy tree.double
offsetX()
Returns the x-offset value.UiTopoLayout
offsetX(double offsetX)
Sets the x-offset value.double
offsetY()
Returns the y-offset value.UiTopoLayout
offsetY(double offsetY)
Sets the y-offset value.UiTopoLayoutId
parent()
Returns the parent layout identifier.UiTopoLayout
parent(UiTopoLayoutId parentId)
Sets the identity of this layout's parent.Region
region()
Returns the backing region with which this layout is associated.UiTopoLayout
region(Region region)
Sets the backing region for this layout.RegionId
regionId()
Returns the identifier of the backing region.double
scale()
Returns the scale for the geomap / sprite image.UiTopoLayout
scale(double scale)
Sets the scale for the geomap / sprite image.java.lang.String
sprites()
Returns the symbolic name for the sprites definition for this layout.UiTopoLayout
sprites(java.lang.String sprites)
Sets the name of the sprites definition for this layout.java.lang.String
toString()
-
-
-
Constructor Detail
-
UiTopoLayout
public UiTopoLayout(UiTopoLayoutId id)
Created a new UI topology layout.- Parameters:
id
- layout identifier
-
-
Method Detail
-
isRoot
public boolean isRoot()
Returns true if this layout instance is at the top of the hierarchy tree.- Returns:
- true if this is the root layout
-
id
public UiTopoLayoutId id()
Returns the UI layout identifier.- Returns:
- identifier of the layout
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
region
public UiTopoLayout region(Region region)
Sets the backing region for this layout. Note that an exception will be thrown if this is the root layout.- Parameters:
region
- the backing region- Returns:
- self, for chaining
- Throws:
java.lang.IllegalArgumentException
- if this is the root layout
-
region
public Region region()
Returns the backing region with which this layout is associated. Note that this may be null (for the root layout).- Returns:
- backing region
-
regionId
public RegionId regionId()
Returns the identifier of the backing region. If this is the default layout, the null-region ID will be returned, otherwise the ID of the backing region for this layout will be returned; null in the case that there is no backing region.- Returns:
- backing region identifier
-
parent
public UiTopoLayout parent(UiTopoLayoutId parentId)
Sets the identity of this layout's parent. May be null to unset. Note that an exception will be thrown if this is the root layout, since the parent of the root is always itself, and cannot be changed.- Parameters:
parentId
- parent layout identifier- Returns:
- self, for chaining
- Throws:
java.lang.IllegalArgumentException
- if this instance is the root layout
-
parent
public UiTopoLayoutId parent()
Returns the parent layout identifier.- Returns:
- parent layout identifier
-
geomap
public UiTopoLayout geomap(java.lang.String geomap)
Sets the name of the geomap for this layout. This is the symbolic name for a "topojson" file containing a geographic map projection, to be displayed in the topology view, for this layout.Since the geomap and sprites fields are mutually exclusive, this method will throw an exception if the sprites field is already set.
- Parameters:
geomap
- the geomap name- Returns:
- self, for chaining
- Throws:
java.lang.IllegalArgumentException
- if the sprites field is not null
-
geomap
public java.lang.String geomap()
Returns the symbolic name for the geomap for this layout.- Returns:
- name of geomap
-
sprites
public UiTopoLayout sprites(java.lang.String sprites)
Sets the name of the sprites definition for this layout. This is the symbolic name for a definition of sprites, which render as a symbolic background (e.g. a campus, or floor plan), to be displayed in the topology view, for this layout.Since the geomap and sprites fields are mutually exclusive, this method will throw an exception if the geomap field is already set.
- Parameters:
sprites
- the sprites definition name- Returns:
- self, for chaining
- Throws:
java.lang.IllegalArgumentException
- if the geomap field is not null
-
sprites
public java.lang.String sprites()
Returns the symbolic name for the sprites definition for this layout.- Returns:
- name of sprites definition
-
scale
public UiTopoLayout scale(double scale)
Sets the scale for the geomap / sprite image. Note that the acceptable bounds are from 0.01 to 100.0.- Parameters:
scale
- the scale- Returns:
- self for chaining
- Throws:
java.lang.IllegalArgumentException
- if the value is out of bounds
-
scale
public double scale()
Returns the scale for the geomap / sprite image.- Returns:
- the scale
-
offsetX
public UiTopoLayout offsetX(double offsetX)
Sets the x-offset value.- Parameters:
offsetX
- x-offset- Returns:
- self, for chaining
-
offsetX
public double offsetX()
Returns the x-offset value.- Returns:
- the x-offset
-
offsetY
public UiTopoLayout offsetY(double offsetY)
Sets the y-offset value.- Parameters:
offsetY
- y-offset- Returns:
- self, for chaining
-
offsetY
public double offsetY()
Returns the y-offset value.- Returns:
- the y-offset
-
-