Class ComponentView

java.lang.Object

public final class ComponentView
extends StaticView
Represents a Component view from the C4 model, showing the components within a given container.
  • 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 class View
      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

      public Container getContainer()
      Gets the container associated with this view.
      Returns:
      a Container object
    • add

      public void add​(@Nonnull SoftwareSystem softwareSystem)
      Adds the specified software system, including relationships to/from that software system. Please note that the parent software system of the container in scope cannot be added to this view.
      Overrides:
      add in class StaticView
      Parameters:
      softwareSystem - the SoftwareSystem to add to this view
    • add

      public void add​(@Nonnull SoftwareSystem softwareSystem, boolean addRelationships)
      Adds the specified software system. Please note that the parent software system of the container in scope cannot be added to this view.
      Overrides:
      add in class StaticView
      Parameters:
      softwareSystem - the SoftwareSystem to add to this view
      addRelationships - whether to add relationships to/from the component
    • addAllContainers

      public void addAllContainers()
      Adds all other containers in the software system to this view.
    • add

      public void add​(Container container)
      Adds an individual container to this view, including relationships to/from that container.
      Parameters:
      container - the Container to add
    • add

      public void add​(Container container, boolean addRelationships)
      Adds an individual container to this view.
      Parameters:
      container - the Container to add
      addRelationships - whether to add relationships to/from the container
    • addAllComponents

      public void addAllComponents()
      Adds all components in the container to this view.
    • add

      public void add​(Component component)
      Adds an individual component to this view, including relationships to/from that component.
      Parameters:
      component - the Component to add
    • add

      public void add​(Component component, boolean addRelationships)
      Adds an individual component to this view.
      Parameters:
      component - the Component to add
      addRelationships - whether to add relationships to/from the component
    • remove

      public void remove​(Container container)
      Removes an individual container from this view.
      Parameters:
      container - the Container to remove
    • remove

      public void remove​(Component component)
      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.
      Specified by:
      getName in class View
      Returns:
      the name, as a String
    • addDefaultElements

      public void addDefaultElements()
      Adds the default set of elements to this view.
      Specified by:
      addDefaultElements in class StaticView
    • addAllElements

      public void addAllElements()
      Adds all people, software systems, sibling containers and components belonging to the container in scope.
      Specified by:
      addAllElements in class StaticView
    • addNearestNeighbours

      public void addNearestNeighbours​(@Nonnull Element element)
      Adds all people, software systems, sibling containers and components that are directly connected to the specified element.
      Specified by:
      addNearestNeighbours in class StaticView
      Parameters:
      element - an Element
    • addExternalDependencies

      public void addExternalDependencies()

      Adds all Elements external to the container (Person, SoftwareSystem or Container) that have Relationships to or from Components in this view.

      Not included are:

      • References to and from the Container of this view (only references to and from the components are considered)
      • Relationships between external Elements (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.

    • canBeRemoved

      protected boolean canBeRemoved​(Element element)
      Specified by:
      canBeRemoved in class View
    • 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