Package com.structurizr.view
Class View
java.lang.Object
com.structurizr.view.View
- Direct Known Subclasses:
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 protected voidaddElement(Element element, boolean addRelationships)protected RelationshipViewaddRelationship(Relationship relationship)protected RelationshipViewaddRelationship(Relationship relationship, java.lang.String description, java.lang.String order)protected abstract booleancanBeRemoved(Element element)voiddisableAutomaticLayout()Disables automatic layout for this view.voidenableAutomaticLayout()Enables automatic layout for this view, with some default settings.voidenableAutomaticLayout(AutomaticLayout.RankDirection rankDirection, int rankSeparation, int nodeSeparation, int edgeSeparation, boolean vertices)Enables the automatic layout for this view, with the specified settings.AutomaticLayoutgetAutomaticLayout()Gets the automatic layout settings for this view.java.lang.StringgetDescription()Gets the description of this view.java.util.Set<ElementView>getElements()Gets the set of elements in this view.ElementViewgetElementView(Element element)Gets the element view for the given element.java.lang.StringgetKey()Gets the identifier for this view.ModelgetModel()Gets the model that this view belongs to.abstract java.lang.StringgetName()Gets the (computed) name of this view.PaperSizegetPaperSize()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.RelationshipViewgetRelationshipView(Relationship relationship)Gets the relationship view for the given relationship.SoftwareSystemgetSoftwareSystem()Gets the software system that this view is associated with.java.lang.StringgetSoftwareSystemId()Gets the ID of the software system this view is associated with.java.lang.StringgetTitle()Gets the title of this view, if one has been set.ViewSetgetViewSet()Gets the view set that this view belongs to.booleanisElementInView(Element element)voidremove(Relationship relationship)Removes a relationship from this view.protected voidremoveElement(Element element)voidremoveElementsWithNoRelationships()Removes all elements that have no relationships to other elements in this view.voidremoveRelationshipsNotConnectedToElement(Element element)Removes relationships that are not connected to the specified element.voidsetDescription(java.lang.String description)voidsetLayoutMergeStrategy(LayoutMergeStrategy layoutMergeStrategy)Sets the strategy used for merging layout information (paper size, x/y positioning, etc) from one version of this view to another.voidsetPaperSize(PaperSize paperSize)voidsetTitle(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 the automatic layout for this view, with the specified settings.- 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
-
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
-
removeElement
-
addRelationship
-
isElementInView
-
addRelationship
protected RelationshipView addRelationship(Relationship relationship, java.lang.String description, java.lang.String order) -
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:
- an 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
-