Class StateDiagramLayouter
- java.lang.Object
-
- com.nomagic.magicdraw.uml.symbols.layout.AbstractDiagramLayouter
-
- com.nomagic.magicdraw.uml.symbols.layout.HierarchicDiagramLayouter
-
- com.nomagic.magicdraw.uml.symbols.layout.state.StateDiagramLayouter
-
- All Implemented Interfaces:
DiagramLayouter
,java.lang.Cloneable
@OpenApi public class StateDiagramLayouter extends HierarchicDiagramLayouter
A specialized layouter for state and protocol state diagrams. It is also used as a default layouter for diagrams that are based on them.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
DEFAULT_FIRST_SEGMENT_LENGTH
private com.nomagic.magicdraw.uml.symbols.layout.state.StateDiagramLayouter.Type
predefinedType
-
Constructor Summary
Constructors Constructor Description StateDiagramLayouter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterLayout(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, UMLGraph graph, com.nomagic.magicdraw.commands.MacroCommand mc)
boolean
canLayoutAsHierarchic(UMLGraph graph, AbstractDiagramLayouterOptionsGroup options)
private static void
determineDirection(UMLGraph graph)
private void
doLayoutSeries(StateMachineLayouterOptionsGroup opt, UMLGraph graph, y.layout.hierarchic.IncrementalHierarchicLayouter layouter)
private static int
findLargestEntryExit(UMLGraph graph, java.lang.String orientation)
Finds the largest entry or exit state, also include transition guard labels, trims the extremes.com.nomagic.magicdraw.uml.symbols.layout.state.StateDiagramLayouter.Type
getPredefinedLayouterType()
private static java.util.List<PresentationElement>
getPseudoStatesOnEdge(UMLGraph graph)
private static boolean
hasConstraintRequiringShapes(UMLGraph graph)
private static boolean
isChoice(ShapeElement shape)
protected boolean
layout(AbstractDiagramLayouterOptionsGroup opt, DiagramPresentationElement dpe, UMLGraph graph)
Layouts a diagramprivate void
layoutDirectedOrthogonalStyle(UMLGraph graph, StateMachineLayouterOptionsGroup options)
private void
layoutHierarchicStyle(UMLGraph graph, StateMachineLayouterOptionsGroup options)
private static void
moveElementsByFakeEdges(UMLGraph graph, java.lang.String orientation)
Moves elements like pins according to the fake edges that are connected to them.private static void
moveToAppropriateFrameEdge(DiagramPresentationElement dpe, UMLGraph graph, java.lang.String orientation)
Moves shapes on diagram frame to appropriate frame.protected void
preProcessing(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, com.nomagic.magicdraw.commands.MacroCommand mc)
private static boolean
requiresDirectedEdge(PathElement pathElement)
void
setPredefinedLayouterType(com.nomagic.magicdraw.uml.symbols.layout.state.StateDiagramLayouter.Type type)
-
Methods inherited from class com.nomagic.magicdraw.uml.symbols.layout.HierarchicDiagramLayouter
clone, createComponentLayouter, fixOnFrameElements, getPathRerouteCollectors, initDefaultHierarchicSettings, registerPathRerouteCollector, resizeOnEdgeElements, routeNonRoutedPaths, runIHLLayoutSeries, wrapToAccordingGroupLayouter
-
Methods inherited from class com.nomagic.magicdraw.uml.symbols.layout.AbstractDiagramLayouter
canLayout, clearOldRectangles, containsSelectedFromTheSameParent, createCommands, createGraph, createGraph, createLayoutParameters, drawLayoutResults, getAnchoredPresentationElement, getDiagramLayouterAbortHandler, getLayoutParameter, getMessagesFromPath, getOptionsID, getSelected, isTypeSupported, layout, needPartitionData, placeLegendAndInfo, postprocessing, resizeFrameIfNecessary, setAnchoredPresentationElement, setLabelConsiderationMode, setLayoutParameter
-
-
-
-
Field Detail
-
predefinedType
private com.nomagic.magicdraw.uml.symbols.layout.state.StateDiagramLayouter.Type predefinedType
-
DEFAULT_FIRST_SEGMENT_LENGTH
private static final int DEFAULT_FIRST_SEGMENT_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
layout
@OpenApi protected boolean layout(AbstractDiagramLayouterOptionsGroup opt, DiagramPresentationElement dpe, UMLGraph graph)
Description copied from class:AbstractDiagramLayouter
Layouts a diagram- Overrides:
layout
in classHierarchicDiagramLayouter
- Parameters:
opt
- layouter optionsdpe
- diagram to layoutgraph
- a constructed graph from the diagram- Returns:
- true if it was layouted successfully , false otherwise.
-
layoutDirectedOrthogonalStyle
private void layoutDirectedOrthogonalStyle(UMLGraph graph, StateMachineLayouterOptionsGroup options)
-
layoutHierarchicStyle
private void layoutHierarchicStyle(UMLGraph graph, StateMachineLayouterOptionsGroup options)
-
doLayoutSeries
private void doLayoutSeries(StateMachineLayouterOptionsGroup opt, UMLGraph graph, y.layout.hierarchic.IncrementalHierarchicLayouter layouter)
-
determineDirection
private static void determineDirection(UMLGraph graph)
-
canLayoutAsHierarchic
public boolean canLayoutAsHierarchic(UMLGraph graph, AbstractDiagramLayouterOptionsGroup options)
-
requiresDirectedEdge
private static boolean requiresDirectedEdge(PathElement pathElement)
-
hasConstraintRequiringShapes
private static boolean hasConstraintRequiringShapes(UMLGraph graph)
-
isChoice
private static boolean isChoice(ShapeElement shape)
-
preProcessing
protected void preProcessing(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, com.nomagic.magicdraw.commands.MacroCommand mc)
-
afterLayout
protected void afterLayout(AbstractDiagramLayouterOptionsGroup options, DiagramPresentationElement dpe, UMLGraph graph, com.nomagic.magicdraw.commands.MacroCommand mc)
-
moveToAppropriateFrameEdge
private static void moveToAppropriateFrameEdge(DiagramPresentationElement dpe, UMLGraph graph, java.lang.String orientation)
Moves shapes on diagram frame to appropriate frame. If shape has outgoing relations and orientation is set to top to bottom, then it should be placed on top and etc.- Parameters:
dpe
- diagramgraph
- layouted graphorientation
- layout orientation
-
findLargestEntryExit
private static int findLargestEntryExit(UMLGraph graph, java.lang.String orientation)
Finds the largest entry or exit state, also include transition guard labels, trims the extremes.- Parameters:
graph
- layouted graphorientation
- layout orientation- Returns:
- a largest entry/exit with extremes trimmed
-
getPseudoStatesOnEdge
private static java.util.List<PresentationElement> getPseudoStatesOnEdge(UMLGraph graph)
-
moveElementsByFakeEdges
private static void moveElementsByFakeEdges(UMLGraph graph, java.lang.String orientation)
Moves elements like pins according to the fake edges that are connected to them. Input pin is put where fake target edge connects etc.- Parameters:
graph
- the graph
-
getPredefinedLayouterType
public com.nomagic.magicdraw.uml.symbols.layout.state.StateDiagramLayouter.Type getPredefinedLayouterType()
-
setPredefinedLayouterType
public void setPredefinedLayouterType(com.nomagic.magicdraw.uml.symbols.layout.state.StateDiagramLayouter.Type type)
-
-