Class DiagramConfig

java.lang.Object
berlin.yuna.survey.model.DiagramConfig

public class DiagramConfig extends Object
The DiagramConfig is used to define the visible output of the diagram
  • Constructor Details

  • Method Details

    • width

      public int width()
      Width of the diagram
      Returns:
      current configured width
    • width

      public DiagramConfig width(int width)
      Sets the width of the diagram (-1 = automatic)
      Returns:
      current DiagramConfig
    • height

      public int height()
      Height of the diagram
      Returns:
      current configured height
    • height

      public DiagramConfig height(int height)
      Sets the height of the diagram (-1 = automatic)
      Returns:
      current DiagramConfig
    • direction

      public guru.nidi.graphviz.attribute.Rank.RankDir direction()
      Direction of the diagram
      Returns:
      the direction Rank.RankDir of the diagram
    • direction

      public DiagramConfig direction(guru.nidi.graphviz.attribute.Rank.RankDir direction)
      Sets the direction of the diagram (e.g. left to right)
      Returns:
      current DiagramConfig
    • showBackTransition

      public boolean showBackTransition()
      Switch to show or hide the back transitions
      Returns:
      true if transitions will be shown on the diagram
    • showBackTransition

      public DiagramConfig showBackTransition(boolean showBackTransition)
      Switch to show or hide the back transitions
      Returns:
      current DiagramConfig
    • diagram

      public DiagramExporter diagram()
      DiagramExporter for chain operations
      Returns:
      DiagramExporter
    • add

      public DiagramConfig add(DiagramConfig.ElementType type, guru.nidi.graphviz.attribute.Attributes<? extends guru.nidi.graphviz.attribute.ForNode> attribute)
      Adds a configuration/attribute to a specific DiagramConfig.ElementType of the diagram Previous attribute with same key will be removed
      Parameters:
      type - DiagramConfig.ElementType to apply the attribute
      attribute - configuration/attribute for the specified DiagramConfig.ElementType
      Returns:
      current DiagramConfig
    • containsKey

      public boolean containsKey(DiagramConfig.ElementType type, String key)
      Check if a key is already defined in the config
      Parameters:
      type - DiagramConfig.ElementType to apply the attribute
      key - configuration/attribute key for the specified DiagramConfig.ElementType
      Returns:
      true if the key exists in the configuration
    • getOrDefault

      public guru.nidi.graphviz.attribute.Attributes<? extends guru.nidi.graphviz.attribute.ForNode> getOrDefault(DiagramConfig.ElementType type, String key, guru.nidi.graphviz.attribute.Attributes<? extends guru.nidi.graphviz.attribute.ForNode> defaultValue)
      Gets a specific configuration/attribute for the given key and DiagramConfig.ElementType
      Parameters:
      type - DiagramConfig.ElementType for the configuration/attribute
      key - configuration/attribute key for the specified DiagramConfig.ElementType
      defaultValue - fallback if the key wasn't defined
      Returns:
      configured Attributes or else value from 'defaultValue` parameter
    • get

      public Optional<guru.nidi.graphviz.attribute.Attributes<? extends guru.nidi.graphviz.attribute.ForNode>> get(DiagramConfig.ElementType type, String key)
      Gets a specific configuration/attribute for the given key and DiagramConfig.ElementType
      Parameters:
      type - DiagramConfig.ElementType for the configuration/attribute
      key - configuration/attribute key to search for
      Returns:
      configured Optional.empty() if the key wasn't found in the configuration
    • get

      public Set<guru.nidi.graphviz.attribute.Attributes<? extends guru.nidi.graphviz.attribute.ForNode>> get(DiagramConfig.ElementType type)
      Gets all configurations/attributes for the given DiagramConfig.ElementType
      Parameters:
      type - DiagramConfig.ElementType for the configuration/attribute
      Returns:
      a set of Attributes
    • toKey

      public static String toKey(guru.nidi.graphviz.attribute.Attributes<? extends guru.nidi.graphviz.attribute.ForNode> attribute)
      Extracts an Attributes to its key value
      Parameters:
      attribute - Attributes to extract key from
      Returns:
      key from Attributes