Package berlin.yuna.survey.model
Class DiagramConfig
java.lang.Object
berlin.yuna.survey.model.DiagramConfig
The
DiagramConfig
is used to define the visible output of the diagram-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(DiagramConfig.ElementType type, guru.nidi.graphviz.attribute.Attributes<? extends guru.nidi.graphviz.attribute.ForNode> attribute) Adds a configuration/attribute to a specificDiagramConfig.ElementType
of the diagram Previous attribute with same key will be removedboolean
containsKey
(DiagramConfig.ElementType type, String key) Check if a key is already defined in the configdiagram()
DiagramExporter
for chain operationsguru.nidi.graphviz.attribute.Rank.RankDir
Direction of the diagramdirection
(guru.nidi.graphviz.attribute.Rank.RankDir direction) Sets the direction of the diagram (e.g.Set<guru.nidi.graphviz.attribute.Attributes<? extends guru.nidi.graphviz.attribute.ForNode>>
get
(DiagramConfig.ElementType type) Gets all configurations/attributes for the givenDiagramConfig.ElementType
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 andDiagramConfig.ElementType
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 andDiagramConfig.ElementType
int
height()
Height of the diagramheight
(int height) Sets the height of the diagram (-1 = automatic)boolean
Switch to show or hide the back transitionsshowBackTransition
(boolean showBackTransition) Switch to show or hide the back transitionsstatic String
toKey
(guru.nidi.graphviz.attribute.Attributes<? extends guru.nidi.graphviz.attribute.ForNode> attribute) Extracts anAttributes
to its key valueint
width()
Width of the diagramwidth
(int width) Sets the width of the diagram (-1 = automatic)
-
Constructor Details
-
DiagramConfig
-
-
Method Details
-
width
public int width()Width of the diagram- Returns:
- current configured width
-
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
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
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
Switch to show or hide the back transitions- Returns:
- current
DiagramConfig
-
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 specificDiagramConfig.ElementType
of the diagram Previous attribute with same key will be removed- Parameters:
type
-DiagramConfig.ElementType
to apply the attributeattribute
- configuration/attribute for the specifiedDiagramConfig.ElementType
- Returns:
- current
DiagramConfig
-
containsKey
Check if a key is already defined in the config- Parameters:
type
-DiagramConfig.ElementType
to apply the attributekey
- configuration/attribute key for the specifiedDiagramConfig.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 andDiagramConfig.ElementType
- Parameters:
type
-DiagramConfig.ElementType
for the configuration/attributekey
- configuration/attribute key for the specifiedDiagramConfig.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 andDiagramConfig.ElementType
- Parameters:
type
-DiagramConfig.ElementType
for the configuration/attributekey
- 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 givenDiagramConfig.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 anAttributes
to its key value- Parameters:
attribute
-Attributes
to extract key from- Returns:
- key from
Attributes
-