Package com.structurizr.view
Class View
java.lang.Object
com.structurizr.view.View
- Direct Known Subclasses:
CustomView
,DeploymentView
,DynamicView
,StaticView
public abstract class View
extends java.lang.Object
The superclass for all views (static views, dynamic views and deployment views).
-
Method Summary
Modifier and Type Method Description void
add(CustomElement customElement)
Adds the given custom element to this view, including relationships to/from that custom element.void
add(CustomElement customElement, boolean addRelationships)
Adds the given custom element to this view.protected void
addElement(Element element, boolean addRelationships)
protected RelationshipView
addRelationship(Relationship relationship)
protected abstract boolean
canBeRemoved(Element element)
protected abstract void
checkElementCanBeAdded(Element element)
void
disableAutomaticLayout()
Disables automatic layout for this view.void
enableAutomaticLayout()
Enables automatic layout for this view, with some default settings.void
enableAutomaticLayout(AutomaticLayout.RankDirection rankDirection)
Enables automatic layout for this view, with the specified direction, using the Graphviz implementation.void
enableAutomaticLayout(AutomaticLayout.RankDirection rankDirection, int rankSeparation, int nodeSeparation)
Enables automatic layout for this view, with the specified settings, using the Graphviz implementation.void
enableAutomaticLayout(AutomaticLayout.RankDirection rankDirection, int rankSeparation, int nodeSeparation, int edgeSeparation, boolean vertices)
Enables automatic layout for this view, with the specified settings, using the Dagre implementation.AutomaticLayout
getAutomaticLayout()
Gets the automatic layout settings for this view.java.lang.String
getDescription()
Gets the description of this view.java.util.Set<ElementView>
getElements()
Gets the set of elements in this view.ElementView
getElementView(Element element)
Gets the element view for the given element.java.lang.String
getKey()
Gets the identifier for this view.Model
getModel()
Gets the model that this view belongs to.abstract java.lang.String
getName()
Gets the (computed) name of this view.PaperSize
getPaperSize()
Gets the paper size that should be used to render this view.java.util.Set<RelationshipView>
getRelationships()
Gets the set of relationships in this view.RelationshipView
getRelationshipView(Relationship relationship)
Gets the relationship view for the given relationship.SoftwareSystem
getSoftwareSystem()
Gets the software system that this view is associated with.java.lang.String
getSoftwareSystemId()
Gets the ID of the software system this view is associated with.java.lang.String
getTitle()
Gets the title of this view, if one has been set.ViewSet
getViewSet()
Gets the view set that this view belongs to.boolean
isElementInView(Element element)
void
remove(CustomElement customElement)
Removes the given custom element from this view.void
remove(Relationship relationship)
Removes a relationship from this view.protected void
removeElement(Element element)
void
removeElementsWithNoRelationships()
Removes all elements that have no relationships to other elements in this view.void
removeRelationshipsNotConnectedToElement(Element element)
Removes relationships that are not connected to the specified element.void
setDescription(java.lang.String description)
void
setLayoutMergeStrategy(LayoutMergeStrategy layoutMergeStrategy)
Sets the strategy used for merging layout information (paper size, x/y positioning, etc) from one version of this view to another.void
setPaperSize(PaperSize paperSize)
void
setTitle(java.lang.String title)
Sets the title for this view.
-
Method Details
-
getModel
Gets the model that this view belongs to.- Returns:
- a Model object
-
getSoftwareSystem
Gets the software system that this view is associated with.- Returns:
- a SoftwareSystem object, or null if this view is not associated with a software system (e.g. it's a system landscape view)
-
getSoftwareSystemId
public java.lang.String getSoftwareSystemId()Gets the ID of the software system this view is associated with.- Returns:
- the ID, as a String, or null if this view is not associated with a software system (e.g. it's a system landscape view)
-
getDescription
public java.lang.String getDescription()Gets the description of this view.- Returns:
- the description, as a String
-
setDescription
public void setDescription(java.lang.String description) -
getKey
public java.lang.String getKey()Gets the identifier for this view.- Returns:
- the identifier, as a String
-
getPaperSize
Gets the paper size that should be used to render this view.- Returns:
- a PaperSize
-
setPaperSize
-
getAutomaticLayout
Gets the automatic layout settings for this view.- Returns:
- an AutomaticLayout object, or null if not enabled
-
enableAutomaticLayout
public void enableAutomaticLayout()Enables automatic layout for this view, with some default settings. -
enableAutomaticLayout
public void enableAutomaticLayout(AutomaticLayout.RankDirection rankDirection, int rankSeparation, int nodeSeparation, int edgeSeparation, boolean vertices)Enables automatic layout for this view, with the specified settings, using the Dagre implementation.- Parameters:
rankDirection
- the rank directionrankSeparation
- the separation between ranks (in pixels, a positive integer)nodeSeparation
- the separation between nodes within the same rank (in pixels, a positive integer)edgeSeparation
- the separation between edges (in pixels, a positive integer)vertices
- whether vertices should be created during automatic layout
-
enableAutomaticLayout
Enables automatic layout for this view, with the specified direction, using the Graphviz implementation.- Parameters:
rankDirection
- the rank direction
-
enableAutomaticLayout
public void enableAutomaticLayout(AutomaticLayout.RankDirection rankDirection, int rankSeparation, int nodeSeparation)Enables automatic layout for this view, with the specified settings, using the Graphviz implementation.- Parameters:
rankDirection
- the rank directionrankSeparation
- the separation between ranks (in pixels, a positive integer)nodeSeparation
- the separation between nodes within the same rank (in pixels, a positive integer)
-
disableAutomaticLayout
public void disableAutomaticLayout()Disables automatic layout for this view. -
getTitle
public java.lang.String getTitle()Gets the title of this view, if one has been set.- Returns:
- the title, as a String
-
setTitle
public void setTitle(java.lang.String title)Sets the title for this view.- Parameters:
title
- the title, as a String
-
getName
public abstract java.lang.String getName()Gets the (computed) name of this view.- Returns:
- the name, as a String
-
addElement
-
checkElementCanBeAdded
-
removeElement
-
addRelationship
-
isElementInView
-
remove
Removes a relationship from this view.- Parameters:
relationship
- the Relationship to remove
-
removeRelationshipsNotConnectedToElement
Removes relationships that are not connected to the specified element.- Parameters:
element
- the Element to test against
-
getElements
Gets the set of elements in this view.- Returns:
- a Set of ElementView objects
-
getRelationships
Gets the set of relationships in this view.- Returns:
- a Set of RelationshipView objects
-
removeElementsWithNoRelationships
public void removeElementsWithNoRelationships()Removes all elements that have no relationships to other elements in this view. -
setLayoutMergeStrategy
Sets the strategy used for merging layout information (paper size, x/y positioning, etc) from one version of this view to another.- Parameters:
layoutMergeStrategy
- an instance of LayoutMergeStrategy
-
getElementView
Gets the element view for the given element.- Parameters:
element
- the Element to find the ElementView for- Returns:
- an ElementView object, or null if the element doesn't exist in the view
-
getRelationshipView
Gets the relationship view for the given relationship.- Parameters:
relationship
- the Relationship to find the RelationshipView for- Returns:
- a RelationshipView object, or null if the relationship doesn't exist in the view
-
getViewSet
Gets the view set that this view belongs to.- Returns:
- a ViewSet object
-
canBeRemoved
-
add
Adds the given custom element to this view, including relationships to/from that custom element.- Parameters:
customElement
- the CustomElement to add
-
add
Adds the given custom element to this view.- Parameters:
customElement
- the CustomElement to addaddRelationships
- whether to add relationships to/from the custom element
-
remove
Removes the given custom element from this view.- Parameters:
customElement
- the CustomElement to add
-