Package com.structurizr.view
Class ModelView
java.lang.Object
com.structurizr.view.View
com.structurizr.view.ModelView
- All Implemented Interfaces:
PropertyHolder
- Direct Known Subclasses:
CustomView
,DeploymentView
,DynamicView
,StaticView
The superclass for all views that show elements/relationships from the model, namely:
- System landscape views
- System context views
- Container views
- Dynamic views
- Deployment views
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
addElement
(Element element, boolean addRelationships) protected <T extends Element>
voidaddNearestNeighbours
(Element element, Class<T> typeOfElement) protected RelationshipView
addRelationship
(Relationship relationship) protected abstract boolean
canBeRemoved
(Element element) protected abstract void
checkElementCanBeAdded
(Element element) void
Disables automatic layout for this view.void
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.Gets the automatic layout settings for this view.Gets the set of elements in this view.getElementView
(Element element) Gets the element view for the given element.boolean
Gets whether layout information for this view should be merged from a remote version of the workspace.getModel()
Gets the model that this view belongs to.Gets the paper size that should be used to render this view.Gets the set of relationships in this view.getRelationshipView
(Relationship relationship) Gets the relationship view for the given relationship.Gets the software system that this view is associated with.Gets the ID of the software system this view is associated with.Gets the view set that this view belongs to.boolean
isElementInView
(Element element) void
remove
(Relationship relationship) Removes a relationship from this view.protected void
removeElement
(Element element) void
Removes all elements that have no relationships to other elements in this view.void
Removes relationships that are not connected to the specified element.void
setDimensions
(Dimensions dimensions) 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
setMergeFromRemote
(boolean mergeFromRemote) Specifies whether layout information for this view should be merged from a remote version of the workspace.void
setPaperSize
(PaperSize paperSize) Methods inherited from class com.structurizr.view.View
addProperty, getDescription, getKey, getName, getOrder, getProperties, getTitle, setDescription, setTitle
-
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
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)
-
getPaperSize
Gets the paper size that should be used to render this view.- Returns:
- a PaperSize
-
setPaperSize
-
getDimensions
-
setDimensions
-
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. -
getMergeFromRemote
public boolean getMergeFromRemote()Gets whether layout information for this view should be merged from a remote version of the workspace.- Returns:
- true if layout information should be merged from the remote workspace, false otherwise
-
setMergeFromRemote
public void setMergeFromRemote(boolean mergeFromRemote) Specifies whether layout information for this view should be merged from a remote version of the workspace.- Parameters:
mergeFromRemote
- true if layout information should be merged from the remote workspace, false otherwise
-
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.- Overrides:
getViewSet
in classView
- Returns:
- a ViewSet object
-
canBeRemoved
-
addNearestNeighbours
-