Package com.structurizr.view
Class ComponentView
java.lang.Object
com.structurizr.view.View
com.structurizr.view.StaticView
com.structurizr.view.ComponentView
public final class ComponentView extends StaticView
Represents a Component view from the C4 model, showing the components within a given container.
-
Method Summary
Modifier and Type Method Description void
add(Component component)
Adds an individual component to this view, including relationships to/from that component.void
add(Component component, boolean addRelationships)
Adds an individual component to this view.void
add(Container container)
Adds an individual container to this view, including relationships to/from that container.void
add(Container container, boolean addRelationships)
Adds an individual container to this view.void
addAllComponents()
Adds all components in the container to this view.void
addAllContainers()
Adds all other containers in the software system to this view.void
addAllElements()
Adds all people, software systems, sibling containers and components belonging to the container in scope.void
addDefaultElements()
Adds the default set of elements to this view.void
addExternalDependencies()
Adds allElement
s external to the container (Person, SoftwareSystem or Container) that haveRelationship
s to or fromComponent
s in this view.void
addNearestNeighbours(Element element)
Adds all people, software systems, sibling containers and components that are directly connected to the specified element.protected boolean
canBeRemoved(Element element)
protected void
checkElementCanBeAdded(Element element)
Container
getContainer()
Gets the container associated with this view.java.lang.String
getContainerId()
Gets the ID of the container associated with this view.boolean
getExternalContainerBoundariesVisible()
Determines whether container boundaries should be visible for "external" components (those outside the container in scope).java.lang.String
getName()
Gets the (computed) name of this view.java.lang.String
getSoftwareSystemId()
Gets the ID of the software system this view is associated with.void
remove(Component component)
Removes an individual component from this view.void
remove(Container container)
Removes an individual container from this view.void
setExternalSoftwareSystemBoundariesVisible(boolean externalContainerBoundariesVisible)
Sets whether container boundaries should be visible for "external" components (those outside the container in scope).Methods inherited from class com.structurizr.view.StaticView
add, add, add, add, add, addAllPeople, addAllSoftwareSystems, addAnimation, addNearestNeighbours, getAnimations, remove, remove, removeElementsThatAreUnreachableFrom, removeElementsWithTag, removeRelationshipsWithTag
Methods inherited from class com.structurizr.view.View
add, add, addElement, addRelationship, disableAutomaticLayout, enableAutomaticLayout, enableAutomaticLayout, enableAutomaticLayout, enableAutomaticLayout, getAutomaticLayout, getDescription, getElements, getElementView, getKey, getModel, getPaperSize, getRelationships, getRelationshipView, getSoftwareSystem, getTitle, getViewSet, isElementInView, remove, remove, removeElement, removeElementsWithNoRelationships, removeRelationshipsNotConnectedToElement, setDescription, setLayoutMergeStrategy, setPaperSize, setTitle
-
Method Details
-
getSoftwareSystemId
public java.lang.String getSoftwareSystemId()Description copied from class:View
Gets the ID of the software system this view is associated with.- Overrides:
getSoftwareSystemId
in classView
- 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)
-
getContainerId
public java.lang.String getContainerId()Gets the ID of the container associated with this view.- Returns:
- the ID, as a String
-
getContainer
Gets the container associated with this view.- Returns:
- a Container object
-
addAllContainers
public void addAllContainers()Adds all other containers in the software system to this view. -
add
Adds an individual container to this view, including relationships to/from that container.- Parameters:
container
- the Container to add
-
add
Adds an individual container to this view.- Parameters:
container
- the Container to addaddRelationships
- whether to add relationships to/from the container
-
addAllComponents
public void addAllComponents()Adds all components in the container to this view. -
add
Adds an individual component to this view, including relationships to/from that component.- Parameters:
component
- the Component to add
-
add
Adds an individual component to this view.- Parameters:
component
- the Component to addaddRelationships
- whether to add relationships to/from the component
-
remove
Removes an individual container from this view.- Parameters:
container
- the Container to remove
-
remove
Removes an individual component from this view.- Parameters:
component
- the Component to remove
-
getName
public java.lang.String getName()Gets the (computed) name of this view. -
addDefaultElements
public void addDefaultElements()Adds the default set of elements to this view.- Specified by:
addDefaultElements
in classStaticView
-
addAllElements
public void addAllElements()Adds all people, software systems, sibling containers and components belonging to the container in scope.- Specified by:
addAllElements
in classStaticView
-
addNearestNeighbours
Adds all people, software systems, sibling containers and components that are directly connected to the specified element.- Specified by:
addNearestNeighbours
in classStaticView
- Parameters:
element
- an Element
-
addExternalDependencies
public void addExternalDependencies()Adds all
Element
s external to the container (Person, SoftwareSystem or Container) that haveRelationship
s to or fromComponent
s in this view.Not included are:
- References to and from the
Container
of this view (only references to and from the components are considered) Relationship
s between externalElement
s (i.e. elements that are not part of this container)
Don't forget to add elements to your view prior to calling this method, e.g. by calling
addAllComponents()
or be selectively choosing certain components. - References to and from the
-
checkElementCanBeAdded
- Specified by:
checkElementCanBeAdded
in classView
-
canBeRemoved
- Specified by:
canBeRemoved
in classView
-
getExternalContainerBoundariesVisible
public boolean getExternalContainerBoundariesVisible()Determines whether container boundaries should be visible for "external" components (those outside the container in scope).- Returns:
- true if external container boundaries are visible, false otherwise
-
setExternalSoftwareSystemBoundariesVisible
public void setExternalSoftwareSystemBoundariesVisible(boolean externalContainerBoundariesVisible)Sets whether container boundaries should be visible for "external" components (those outside the container in scope).- Parameters:
externalContainerBoundariesVisible
- true if external container boundaries should be visible, false otherwise
-