Class UMLGraph
- java.lang.Object
-
- y.base.Graph
-
- y.layout.LayoutGraph
-
- y.layout.DefaultLayoutGraph
-
- com.nomagic.magicdraw.uml.symbols.layout.UMLGraph
-
- All Implemented Interfaces:
y.base.GraphInterface
,y.layout.GraphLayout
@OpenApi public class UMLGraph extends y.layout.DefaultLayoutGraph
UML graph data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
com.nomagic.magicdraw.uml.symbols.layout.UMLGraph.CalculateHorizontalBar
(package private) class
com.nomagic.magicdraw.uml.symbols.layout.UMLGraph.EdgeSourceTargetComparator
Compares target or source elements by their opposite end.
-
Field Summary
Fields Modifier and Type Field Description private int
createEdgeLabels
private boolean
createNodeLabels
protected SwimlaneView
currentSwimlane
protected SwimlaneCellView
currentSwimlaneCellView
private java.util.Set<PathElement>
doNotRepaint
static int
EDGE_LABEL_ALL
static int
EDGE_LABEL_AT_ENDS
static int
EDGE_LABEL_NON_ENDS
static int
EDGE_LABEL_NONE
private java.util.Map<y.base.Edge,java.util.List<y.layout.EdgeLabelLayoutImpl>>
edgeLabelDataMap
protected com.nomagic.magicdraw.uml.symbols.layout.labels.EdgeLabelFactory
edgeLabelFactory
private y.layout.grid.PartitionGrid
grid
private java.util.Map<com.nomagic.magicdraw.uml.symbols.layout.labels.LabelData,java.awt.Rectangle>
labelRectangles
private boolean
mContainsHierarchy
protected java.util.Map<PresentationElement,java.lang.Object>
mDataMap
PresentationElement (path or shape) bind to yFiles edge or node.private DiagramPresentationElement
mDiagramView
protected y.base.EdgeMap
mEdgeMap
private java.util.Map<PresentationElement,y.base.Edge>
mFakeElementsMap
protected y.base.NodeMap
mGroupKey
private y.base.EdgeMap
mHEdgeMap
private y.base.NodeMap
mHNodeMap
private y.base.NodeMap
mInsets
private y.base.NodeMap
mMinimalGroupNodeKey
protected y.base.NodeMap
mNodeId
protected y.base.NodeMap
mNodeMap
private java.util.Set<PresentationElement>
mNotSupported
private y.base.NodeMap
mParentNodeId
protected java.util.LinkedHashSet<PresentationElement>
mPaths
private java.util.Set<y.base.Edge>
mReversedPaths
protected java.util.Set<PresentationElement>
mSelected
private y.base.NodeMap
mShrinkableShapeInsets
private java.lang.String
mStyle
private java.util.Map<y.base.Node,java.util.List<y.layout.NodeLabelLayoutImpl>>
nodeLabelDataMap
private java.util.Map<y.base.Node,com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlaneAndCellStructure>
nodeToSwimlanePlacement
private com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlanePartitionInfo
partitionInfo
private int
placeEdgeLabelsTo
private boolean
placeNodeLabelsToCalculatedPositions
private static java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.LayoutableSymbolProvider>
PROVIDERS
private boolean
resetLabelsAtInit
static java.lang.String
SHRINKABLE_SHAPE_INSET_DP
private java.awt.Point
sphereCenterPoint
private int
sphereRadius
private PresentationElement
symbolToRefresh
-
Constructor Summary
Constructors Constructor Description UMLGraph(DiagramPresentationElement diagramView, boolean supportsSubgraph, java.util.Set<PresentationElement> selected)
Deprecated.supportsSubgraph has no effectUMLGraph(DiagramPresentationElement diagramView, boolean supportsSubgraph, java.util.Set<PresentationElement> selected, boolean resetLabelPositions)
Deprecated.supportsSubgraph has no effectUMLGraph(DiagramPresentationElement diagramView, java.util.Set<PresentationElement> selected)
Construct UML Graph.UMLGraph(DiagramPresentationElement diagramView, java.util.Set<PresentationElement> selected, boolean resetLabelPositions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description y.base.EdgeMap
addEdgeSelectionProvider(java.lang.Object provider, java.util.Collection<y.base.Edge> c)
Add Edge Selection Provider.y.base.EdgeMap
addEdgeSelectionProvider(java.lang.Object provider, y.base.Edge edge)
Add Edge Selection Provider.void
addGroupNodeInsetsProvider()
Add Group node inset provider.protected void
addPaths(PresentationElement pe)
static void
addProvider(com.nomagic.magicdraw.uml.symbols.layout.LayoutableSymbolProvider provider)
Registers a new providerprivate void
addShrinkableGroupNodeInsetsProvider()
Add shrinkable shape group node inset provider.private void
addToPathList(PathElement path)
private void
addToPathList(java.lang.Iterable<PathElement> paths)
void
addToReversedList(y.base.Edge edge)
private void
adjustFakeAtEndShapeLabelOrientation(PresentationElement symbol)
boolean
areParentToChildConnected(java.lang.Iterable<PathElement> connectedPathElements)
private static void
autosizeShapes(java.util.Set<PresentationElement> shapes)
boolean
belongsToHierarchy(y.base.Edge edge)
Check The given Edge belongs to hierarchy.boolean
belongsToHierarchy(y.base.Node node)
Checks the given node belongs to Hierarchy.protected void
collectPathsRecursively(ShapeElement element, y.base.Node node)
boolean
containsHierarchy()
Check If contains hierarchy.protected void
createAllNodeLabels(ShapeElement shape, y.base.Node node)
protected void
createAllPathLabels(com.nomagic.magicdraw.uml.symbols.layout.labels.EdgeLabelFactory factory)
private void
createAssociationClassData(AssociationClassView path, y.base.Node clientNode, y.base.Node supplierNode)
void
createCommands(com.nomagic.magicdraw.commands.MacroCommand mc, java.util.Map<java.lang.String,java.lang.Object> layouterParameters)
Create command with given parameter.private void
createData(DiagramPresentationElement diagramView)
y.base.Edge
createEdge(PathElement path)
Creates an edge in a graph by provided path element.y.layout.grouping.GroupBoundsCalculator
createGroupBoundsCalculator()
Creates bounds calculator for group nodesvoid
createHierarchicInfo(java.util.Collection<java.lang.Class<?>> classTypes)
Create Hierarchy Information of path element.private void
createInsets()
protected y.base.Node
createNode(ShapeElement shape)
y.base.Node
createNode(java.lang.Object id)
Create new Node and set the given id to it.protected void
createNodeData(java.lang.Object parentId, java.util.Collection<PresentationElement> presentationElements)
private static y.geom.YInsets
createPartShapeInsets(ShapeElement shape)
private static y.geom.YInsets
createStateShapeInsets(ShapeElement shape)
void
dispose()
Dispose the graph and graph related data.private boolean
doesNotHaveConnectedLayoutableEdges(ShapeElement e)
void
drawResults()
Draw a result.private void
fixPathInterNodePoints(java.lang.Iterable<PresentationElement> presentationElements)
Sorts and fixes inter nodes (paths that's one end(or both) goes inside a group node, but does not connect directly to the group node)java.awt.Rectangle
getBoundingBox()
private static y.geom.YInsets
getClassShapeInsets(ShapeElement shape)
int
getCreateEdgeLabels()
java.util.Map<PresentationElement,java.lang.Object>
getDataMap()
DiagramPresentationElement
getDiagram()
Get Presentation Diagram.java.util.Set<PathElement>
getDoNotRepaintPaths()
y.base.Edge
getEdge(PathElement path)
Get Edge of given path element.java.util.Map<y.base.Edge,java.util.List<y.layout.EdgeLabelLayoutImpl>>
getEdgeLabelDataMap()
y.geom.YPoint
getEdgeLabelLocation(y.base.Edge e, y.layout.EdgeLabelLayout ell)
Get Location of the given edge label.y.base.EdgeMap
getEdgeMap()
private y.layout.NodeHalo
getEnclosingShapeHalo(y.base.Node forNode)
java.util.Map<PresentationElement,y.base.Edge>
getFakeElementsMap()
java.lang.Object
getID(y.base.Node node)
Get The given node ID.y.base.NodeMap
getInsetMap()
static y.geom.YInsets
getInsets(ShapeElement shape)
Calculates insets for group nodes, applied only on group nodesstatic y.geom.YInsets
getInsets(ShapeElement shape, java.awt.Insets addAdditional)
Calculates insets for shapes.protected java.util.Map<y.base.Edge,java.util.List<com.nomagic.magicdraw.uml.symbols.layout.labels.AbstractCompositeEdgeLabelDescriptor>>
getLabelDescriptorsNotAtEnd()
y.base.Node
getNode(PresentationElement se)
Get Node from the Presentation element.private java.awt.Rectangle
getNodeBoundsByHalos(y.base.Node node)
private y.geom.YPoint
getNodeHaloAdjustedPoint(y.base.Edge edge, y.base.Node sourceNode, y.geom.YPoint pointAtSourceOrTarget)
y.geom.YPoint
getNodeHaloAdjustedSourcePointAbs(y.base.Edge edge)
Get absolute location of edge source point on halo, not on the source node itself.y.geom.YPoint
getNodeHaloAdjustedTargetPointAbs(y.base.Edge edge)
Get absolute location of edge target point on halo, not on the target node itself.java.util.Map<y.base.Node,java.util.List<y.layout.NodeLabelLayoutImpl>>
getNodeLabelDataMap()
y.base.NodeMap
getNodeMap()
java.util.Map<y.base.Node,com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlaneAndCellStructure>
getNodeToSwimlaneStructure()
java.util.Set<PresentationElement>
getNonSupportedSymbols()
java.lang.Object
getParentId(y.base.Node node)
Get Node 's parent id.y.layout.grid.PartitionGrid
getPartitionGrid()
com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlanePartitionInfo
getPartitionInfo()
PathElement
getPathElement(y.base.Edge edge)
Get Path Element of the given edge.int
getPlaceEdgeLabelsPositions()
java.util.ArrayList<java.awt.Point>
getPointsFromEdge(y.base.Edge edge)
Returns the points from an edgejava.util.Set<y.base.Edge>
getReversedList()
java.util.Set<PresentationElement>
getSelected()
Get Set of the selected PresentationElement.ShapeElement
getShapeElement(y.base.Node node)
Get The given node 's Shape Element.java.awt.Point
getSphereCenterPoint()
int
getSphereRadius()
java.lang.String
getStyle()
Get String representation of Style.private static void
handleAssociationClassPath(AssociationClassView acw)
protected void
ignoreCenterlines(PresentationElement shape)
Ignores centerlines on shape bound changes for centerlineable shape.void
initializeData()
Collects all data provided by diagram to nodes and edges.private static boolean
isAssocClsWithoutOtherRel(PresentationElement view)
boolean
isGroupNode(y.base.Node node)
Checks if a given node is a group node or not.protected boolean
isInSphereRadius(ShapeElement element)
static boolean
isLayoutableByProviders(PresentationElement el)
Checks if symbol is layoutable by providersprivate boolean
isLayoutAssocClsAsLabel(AssociationClassView view)
protected boolean
isNotLayoutedChild(PresentationElement view)
private boolean
isPathToEdgeDirectionDifferent(y.base.Edge edge, PathElement path)
private static boolean
isTreeInSelection(TreeView tree, java.util.Collection<PresentationElement> selection)
Tests if given tree is in selection.static boolean
isTreeOverlapping(TreeView tree, int y, java.lang.Iterable<TreeView> trees)
Check Is tree overlapping.void
makeSubTree(y.base.Node node, java.lang.Class<?> classType, com.nomagic.magicdraw.commands.MacroCommand mc)
Make sub tree.void
makeSubTrees(com.nomagic.magicdraw.commands.MacroCommand mc)
Make sub trees with the given Macrocommand.protected boolean
needToCreate(PresentationElement pe)
private void
placeLayoutedNodeLabel(PresentationElement pe, com.nomagic.magicdraw.commands.MacroCommand mc)
protected void
placeLayoutedPathLabel(PresentationElement pe, y.base.Edge edge, com.nomagic.magicdraw.commands.MacroCommand mc)
private void
placeNestedPorts(boolean bnodes, java.util.Collection<PresentationElement> presentationElementList)
private void
placeNodeLabels(com.nomagic.magicdraw.commands.MacroCommand mc, java.lang.Iterable<PresentationElement> presentationElementList)
private void
placeNonNestedPorts(boolean bpaths)
private void
placePaths(com.nomagic.magicdraw.commands.MacroCommand mc, boolean bpaths, com.nomagic.magicdraw.commands.MoveManager moveManager)
private void
placeShapes(java.util.Map<java.lang.String,java.lang.Object> layouterParameters, y.layout.grouping.Grouping grouping, java.util.Set<PresentationElement> needsAutosize, java.util.Collection<PathElement> notInGraphPaths, java.lang.Iterable<PresentationElement> presentationElementList)
private void
refreshParentSymbol(com.nomagic.magicdraw.commands.MacroCommand mc)
private void
removeGroupNodeFlagFromNonGroups()
Grouping flag can appear even if shape has pins/ports but nothing inside it.void
removeGroupNodeInsetsProvider()
Remove The group node in sets of provider.private void
removeShrinkableGroupNodeInsetsProvider()
Remove the shrinkable shpae group node in sets of provider.static void
removeSubTrees(com.nomagic.magicdraw.commands.MacroCommand mc, DiagramPresentationElement dpe, java.util.Set<PresentationElement> selection)
Remove Sub Trees from the given presentation element.void
resetLabel(PresentationElement pe)
Resets label to their default position.private void
resetPath(com.nomagic.magicdraw.commands.MoveManager moveManager, PathElement path)
private void
resetUnhandledPaths(boolean bnodes, boolean bpaths, com.nomagic.magicdraw.commands.MoveManager moveManager, java.lang.Iterable<PathElement> notInGraphPaths)
void
reverseAndAddToNoReverseList(y.base.Edge edg)
Reverses an edge in graph, does not reverse if path is already reversed.void
reverseEdge(y.base.Edge edge)
Reverses an edge.void
reverseEdgeAndLabels(y.base.Edge edg)
Reverses the edge along with labels, but does not add them to no reverse list.private void
savePathLabelData(boolean bpaths)
void
setCreateEdgeLabels(int createEdgeLabels)
Sets the label creation mode.void
setCreateNodeLabels(boolean shouldCreateNodeLabels)
void
setEdgeLabelFactory(com.nomagic.magicdraw.uml.symbols.layout.labels.EdgeLabelFactory edgeLabelFactory)
void
setMinimalGroupNodeSize(y.base.Node node, y.geom.YDimension dim)
Sets the minimal group node size that is obeyed by layouter.protected void
setNodeSizeEnsureNotZero(java.awt.Rectangle bounds, y.base.Node node)
Sets graph node size, ensures the node height or width is not 0private static void
setNotLayoutedChildLocation(ShapeElement p, java.awt.Point cp)
void
setParent(y.base.Node node, java.lang.Object parentId)
Set node 's parent.void
setPartitionGrid(y.layout.grid.PartitionGrid partitionGrid)
void
setPartitionInfo(com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlanePartitionInfo info)
static void
setPathBounds(PathElement path, java.util.List<java.awt.Point> points, java.awt.Point supplier, java.awt.Point client, com.nomagic.magicdraw.commands.MacroCommand mc)
Changes client point, supplier point and breakpoints and routes the path by layouted edgeprivate static void
setPathBreakPoints(PathElement path, java.util.List<java.awt.Point> points, java.awt.Point client, java.awt.Point supplier, com.nomagic.magicdraw.commands.MacroCommand mc)
Set Path break point.void
setPathStyle(java.lang.String style)
Set path stylevoid
setPlaceEdgeLabelsTo(int placeEdgeLabelsTo)
Sets the calculated label placement for labels.void
setPlaceNodeLabels(boolean shouldPlaceNodeLabelsToCalculatedPositions)
void
setResetLabelsAtInit(boolean resetLabelsAtInit)
void
setSphereCenterPoint(java.awt.Point point)
Sets the center of the sphere that is used for node creationvoid
setSphereRadius(int radius)
Sets the sphere from the defined point.boolean
shouldCreateNodeLabels()
boolean
shouldPlaceNodeLabels()
boolean
shouldResetLabelsAtInit()
private void
sortAndSetEdges(y.base.Node node, y.base.EdgeCursor edges, boolean vertical, boolean target, y.layout.grouping.Grouping grouping)
Sorts all edges by flags.private java.util.List<PresentationElement>
sortPEByNestingLevel(boolean bnodes)
-
Methods inherited from class y.layout.DefaultLayoutGraph
createEdgeLayout, createGraphCopyFactory, createLabelFactory, createNodeLayout, getFeature, getFeature, getLabelLayout, getLabelLayout, getLayout, getLayout, setLabelLayout, setLabelLayout, setLabelLayout, setLayout, setLayout
-
Methods inherited from class y.layout.LayoutGraph
getCenter, getCenterX, getCenterY, getEdgeLabelLayout, getEdgeLayout, getEdgeList, getHeight, getLocation, getNodeLabelLayout, getNodeLayout, getPath, getPathList, getPointList, getPoints, getRectangle, getSize, getSourcePointAbs, getSourcePointRel, getTargetPointAbs, getTargetPointRel, getWidth, getX, getY, moveBy, setCenter, setCenter, setEndPointsAbs, setLocation, setLocation, setPath, setPath, setPoints, setPoints, setSize, setSize, setSourcePointAbs, setSourcePointRel, setTargetPointAbs, setTargetPointRel
-
Methods inherited from class y.base.Graph
addDataProvider, addGraphListener, changeEdge, changeEdge, changeEdge, clear, contains, contains, containsEdge, createCopy, createEdge, createEdge, createEdgeMap, createGraph, createNode, createNodeMap, disposeEdgeMap, disposeNodeMap, E, edgeCount, edgeObjects, edges, fireGraphEvent, firePostEvent, firePostEvent, firePreEvent, firePreEvent, firstEdge, firstNode, firstOutEdge, getDataProvider, getDataProviderKeys, getEdgeArray, getGraphCopyFactory, getGraphListeners, getNodeArray, getRegisteredEdgeMaps, getRegisteredNodeMaps, getSource, getTarget, hasListeners, hide, hide, isEmpty, lastEdge, lastNode, moveSubGraph, moveToFirst, moveToFirst, moveToLast, moveToLast, N, nodeCount, nodeObjects, nodes, printNodeSlotSize, reInsertEdge, reInsertNode, removeDataProvider, removeEdge, removeGraphListener, removeNode, setGraphCopyFactory, sortEdges, sortEdges, sortNodes, toString, unhide, unhide
-
-
-
-
Field Detail
-
SHRINKABLE_SHAPE_INSET_DP
public static final java.lang.String SHRINKABLE_SHAPE_INSET_DP
- See Also:
- Constant Field Values
-
EDGE_LABEL_NONE
public static final int EDGE_LABEL_NONE
- See Also:
- Constant Field Values
-
EDGE_LABEL_AT_ENDS
public static final int EDGE_LABEL_AT_ENDS
- See Also:
- Constant Field Values
-
EDGE_LABEL_NON_ENDS
public static final int EDGE_LABEL_NON_ENDS
- See Also:
- Constant Field Values
-
EDGE_LABEL_ALL
public static final int EDGE_LABEL_ALL
- See Also:
- Constant Field Values
-
PROVIDERS
private static final java.util.Collection<com.nomagic.magicdraw.uml.symbols.layout.LayoutableSymbolProvider> PROVIDERS
-
mFakeElementsMap
private final java.util.Map<PresentationElement,y.base.Edge> mFakeElementsMap
-
mReversedPaths
private final java.util.Set<y.base.Edge> mReversedPaths
-
doNotRepaint
private final java.util.Set<PathElement> doNotRepaint
-
mNotSupported
private final java.util.Set<PresentationElement> mNotSupported
-
mInsets
private y.base.NodeMap mInsets
-
mShrinkableShapeInsets
private y.base.NodeMap mShrinkableShapeInsets
-
mDataMap
protected java.util.Map<PresentationElement,java.lang.Object> mDataMap
PresentationElement (path or shape) bind to yFiles edge or node.
-
mNodeMap
protected y.base.NodeMap mNodeMap
-
mEdgeMap
protected y.base.EdgeMap mEdgeMap
-
mNodeId
protected y.base.NodeMap mNodeId
-
mParentNodeId
private final y.base.NodeMap mParentNodeId
-
mGroupKey
protected y.base.NodeMap mGroupKey
-
mMinimalGroupNodeKey
private final y.base.NodeMap mMinimalGroupNodeKey
-
mPaths
protected java.util.LinkedHashSet<PresentationElement> mPaths
-
mContainsHierarchy
private boolean mContainsHierarchy
-
mHNodeMap
private y.base.NodeMap mHNodeMap
-
mHEdgeMap
private y.base.EdgeMap mHEdgeMap
-
mStyle
private java.lang.String mStyle
-
mDiagramView
private final DiagramPresentationElement mDiagramView
-
mSelected
protected java.util.Set<PresentationElement> mSelected
-
edgeLabelDataMap
private final java.util.Map<y.base.Edge,java.util.List<y.layout.EdgeLabelLayoutImpl>> edgeLabelDataMap
-
nodeLabelDataMap
private final java.util.Map<y.base.Node,java.util.List<y.layout.NodeLabelLayoutImpl>> nodeLabelDataMap
-
labelRectangles
private final java.util.Map<com.nomagic.magicdraw.uml.symbols.layout.labels.LabelData,java.awt.Rectangle> labelRectangles
-
partitionInfo
private com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlanePartitionInfo partitionInfo
-
nodeToSwimlanePlacement
private final java.util.Map<y.base.Node,com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlaneAndCellStructure> nodeToSwimlanePlacement
-
currentSwimlane
@CheckForNull protected SwimlaneView currentSwimlane
-
currentSwimlaneCellView
@CheckForNull protected SwimlaneCellView currentSwimlaneCellView
-
grid
private y.layout.grid.PartitionGrid grid
-
sphereRadius
private int sphereRadius
-
sphereCenterPoint
@CheckForNull private java.awt.Point sphereCenterPoint
-
edgeLabelFactory
protected com.nomagic.magicdraw.uml.symbols.layout.labels.EdgeLabelFactory edgeLabelFactory
-
symbolToRefresh
private PresentationElement symbolToRefresh
-
resetLabelsAtInit
private boolean resetLabelsAtInit
-
createNodeLabels
private boolean createNodeLabels
-
placeNodeLabelsToCalculatedPositions
private boolean placeNodeLabelsToCalculatedPositions
-
createEdgeLabels
private int createEdgeLabels
-
placeEdgeLabelsTo
private int placeEdgeLabelsTo
-
-
Constructor Detail
-
UMLGraph
@OpenApi public UMLGraph(DiagramPresentationElement diagramView, java.util.Set<PresentationElement> selected)
Construct UML Graph. with given parameter- Parameters:
diagramView
- diagram for which to construct graph.selected
- selected elements
-
UMLGraph
@Deprecated @OpenApi public UMLGraph(DiagramPresentationElement diagramView, boolean supportsSubgraph, java.util.Set<PresentationElement> selected)
Deprecated.supportsSubgraph has no effect
-
UMLGraph
@OpenApi public UMLGraph(DiagramPresentationElement diagramView, java.util.Set<PresentationElement> selected, boolean resetLabelPositions)
-
UMLGraph
@Deprecated @OpenApi public UMLGraph(DiagramPresentationElement diagramView, boolean supportsSubgraph, java.util.Set<PresentationElement> selected, boolean resetLabelPositions)
Deprecated.supportsSubgraph has no effect
-
-
Method Detail
-
initializeData
@OpenApi public void initializeData()
Collects all data provided by diagram to nodes and edges.
-
createInsets
private void createInsets()
-
getInsets
public static y.geom.YInsets getInsets(ShapeElement shape)
Calculates insets for group nodes, applied only on group nodes- Parameters:
shape
- the shape to calculate insets to- Returns:
- insets
-
getInsets
public static y.geom.YInsets getInsets(ShapeElement shape, java.awt.Insets addAdditional)
Calculates insets for shapes. Can add additional insets for group nodes.- Parameters:
shape
- the shape to calculate insets to- Returns:
- insets with additional insets
-
createStateShapeInsets
@CheckForNull private static y.geom.YInsets createStateShapeInsets(ShapeElement shape)
-
createPartShapeInsets
private static y.geom.YInsets createPartShapeInsets(ShapeElement shape)
-
getClassShapeInsets
private static y.geom.YInsets getClassShapeInsets(ShapeElement shape)
-
createData
private void createData(DiagramPresentationElement diagramView)
-
createNode
protected y.base.Node createNode(ShapeElement shape)
-
setNodeSizeEnsureNotZero
protected void setNodeSizeEnsureNotZero(java.awt.Rectangle bounds, y.base.Node node)
Sets graph node size, ensures the node height or width is not 0- Parameters:
bounds
- the bounds to setnode
- the node that should have the minimal size
-
createAllNodeLabels
protected void createAllNodeLabels(ShapeElement shape, y.base.Node node)
-
getBoundingBox
public java.awt.Rectangle getBoundingBox()
- Specified by:
getBoundingBox
in interfacey.layout.GraphLayout
- Overrides:
getBoundingBox
in classy.layout.LayoutGraph
-
createNode
public y.base.Node createNode(java.lang.Object id)
Create new Node and set the given id to it.- Parameters:
id
- The given id.- Returns:
- Create node.
-
getID
public java.lang.Object getID(y.base.Node node)
Get The given node ID.- Parameters:
node
- The given node.- Returns:
- Object.
-
createEdge
@CheckForNull public y.base.Edge createEdge(PathElement path)
Creates an edge in a graph by provided path element.- Parameters:
path
- the path that will correspond an edge- Returns:
- created edge
-
createAssociationClassData
private void createAssociationClassData(AssociationClassView path, @CheckForNull y.base.Node clientNode, @CheckForNull y.base.Node supplierNode)
- Parameters:
path
- the association pathclientNode
- clientsupplierNode
- supplier
-
createAllPathLabels
protected void createAllPathLabels(com.nomagic.magicdraw.uml.symbols.layout.labels.EdgeLabelFactory factory)
-
getPathElement
public PathElement getPathElement(y.base.Edge edge)
Get Path Element of the given edge.- Parameters:
edge
- The given edge.- Returns:
- PathElement.
-
getShapeElement
public ShapeElement getShapeElement(y.base.Node node)
Get The given node 's Shape Element.- Parameters:
node
- The given node.- Returns:
- ShapeElement.
-
setParent
public void setParent(y.base.Node node, java.lang.Object parentId)
Set node 's parent.- Parameters:
node
- The given node.parentId
- The parent 's id.
-
getParentId
public java.lang.Object getParentId(y.base.Node node)
Get Node 's parent id.- Parameters:
node
- The given node.- Returns:
- Object
-
getDiagram
@OpenApi public DiagramPresentationElement getDiagram()
Get Presentation Diagram.- Returns:
- Presentation Diagram.
-
needToCreate
protected boolean needToCreate(PresentationElement pe)
-
createNodeData
protected void createNodeData(@CheckForNull java.lang.Object parentId, java.util.Collection<PresentationElement> presentationElements)
-
adjustFakeAtEndShapeLabelOrientation
private void adjustFakeAtEndShapeLabelOrientation(PresentationElement symbol)
-
addToPathList
private void addToPathList(PathElement path)
-
addToPathList
private void addToPathList(java.lang.Iterable<PathElement> paths)
-
doesNotHaveConnectedLayoutableEdges
private boolean doesNotHaveConnectedLayoutableEdges(ShapeElement e)
-
areParentToChildConnected
public boolean areParentToChildConnected(java.lang.Iterable<PathElement> connectedPathElements)
-
isLayoutAssocClsAsLabel
private boolean isLayoutAssocClsAsLabel(AssociationClassView view)
-
isAssocClsWithoutOtherRel
private static boolean isAssocClsWithoutOtherRel(PresentationElement view)
- Parameters:
view
- association class view
-
collectPathsRecursively
protected void collectPathsRecursively(ShapeElement element, y.base.Node node)
-
addPaths
protected void addPaths(PresentationElement pe)
-
getNode
@CheckForNull public y.base.Node getNode(PresentationElement se)
Get Node from the Presentation element.- Parameters:
se
- PresentationElement.- Returns:
- a node for presentation element, or null if not found
-
getEdge
public y.base.Edge getEdge(PathElement path)
Get Edge of given path element.- Parameters:
path
- The given path element.- Returns:
- Edge.
-
isNotLayoutedChild
protected boolean isNotLayoutedChild(PresentationElement view)
-
isLayoutableByProviders
public static boolean isLayoutableByProviders(PresentationElement el)
Checks if symbol is layoutable by providers- Parameters:
el
- checked element- Returns:
- true if symbol is layoutable, false otherwise
-
createCommands
public void createCommands(@CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc, java.util.Map<java.lang.String,java.lang.Object> layouterParameters)
Create command with given parameter.- Parameters:
mc
- MacroCommand.layouterParameters
- layouter parameters
-
sortPEByNestingLevel
private java.util.List<PresentationElement> sortPEByNestingLevel(boolean bnodes)
-
placeShapes
private void placeShapes(java.util.Map<java.lang.String,java.lang.Object> layouterParameters, y.layout.grouping.Grouping grouping, java.util.Set<PresentationElement> needsAutosize, java.util.Collection<PathElement> notInGraphPaths, java.lang.Iterable<PresentationElement> presentationElementList)
-
getNodeBoundsByHalos
private java.awt.Rectangle getNodeBoundsByHalos(@CheckForNull y.base.Node node)
-
getEnclosingShapeHalo
@CheckForNull private y.layout.NodeHalo getEnclosingShapeHalo(@CheckForNull y.base.Node forNode)
-
ignoreCenterlines
protected void ignoreCenterlines(PresentationElement shape)
Ignores centerlines on shape bound changes for centerlineable shape.- Parameters:
shape
- the shape to ignore centerlines on shape bound changes
-
placeNestedPorts
private void placeNestedPorts(boolean bnodes, java.util.Collection<PresentationElement> presentationElementList)
-
placePaths
private void placePaths(@CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc, boolean bpaths, com.nomagic.magicdraw.commands.MoveManager moveManager)
-
placeNonNestedPorts
private void placeNonNestedPorts(boolean bpaths)
-
isPathToEdgeDirectionDifferent
private boolean isPathToEdgeDirectionDifferent(y.base.Edge edge, PathElement path)
-
resetUnhandledPaths
private void resetUnhandledPaths(boolean bnodes, boolean bpaths, com.nomagic.magicdraw.commands.MoveManager moveManager, java.lang.Iterable<PathElement> notInGraphPaths)
-
refreshParentSymbol
private void refreshParentSymbol(@CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc)
-
placeNodeLabels
private void placeNodeLabels(@CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc, java.lang.Iterable<PresentationElement> presentationElementList)
-
resetPath
private void resetPath(com.nomagic.magicdraw.commands.MoveManager moveManager, PathElement path)
-
getPointsFromEdge
public java.util.ArrayList<java.awt.Point> getPointsFromEdge(y.base.Edge edge)
Returns the points from an edge- Parameters:
edge
- edge's point to return- Returns:
- edge points excluding source and target
-
fixPathInterNodePoints
private void fixPathInterNodePoints(java.lang.Iterable<PresentationElement> presentationElements)
Sorts and fixes inter nodes (paths that's one end(or both) goes inside a group node, but does not connect directly to the group node)
-
sortAndSetEdges
private void sortAndSetEdges(y.base.Node node, y.base.EdgeCursor edges, boolean vertical, boolean target, y.layout.grouping.Grouping grouping)
Sorts all edges by flags.- Parameters:
node
- node to search inedges
- edges to sortvertical
- determines the orientationtarget
- if set to true, it will compare by source ends and sort target ends, if false the opposite.
-
setNotLayoutedChildLocation
private static void setNotLayoutedChildLocation(ShapeElement p, java.awt.Point cp)
-
autosizeShapes
private static void autosizeShapes(java.util.Set<PresentationElement> shapes)
-
setPathBreakPoints
private static void setPathBreakPoints(PathElement path, java.util.List<java.awt.Point> points, java.awt.Point client, java.awt.Point supplier, @CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc)
Set Path break point.- Parameters:
path
- Path Element.points
- List of break point.client
- Client point.supplier
- Supplier point.mc
- Macro command.
-
setPathBounds
public static void setPathBounds(PathElement path, java.util.List<java.awt.Point> points, java.awt.Point supplier, java.awt.Point client, @CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc)
Changes client point, supplier point and breakpoints and routes the path by layouted edge- Parameters:
path
- current pathpoints
- new breakpointssupplier
- supplierclient
- clientmc
- macro
-
handleAssociationClassPath
private static void handleAssociationClassPath(AssociationClassView acw)
-
savePathLabelData
private void savePathLabelData(boolean bpaths)
-
placeLayoutedPathLabel
protected void placeLayoutedPathLabel(PresentationElement pe, y.base.Edge edge, @CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc)
-
getLabelDescriptorsNotAtEnd
protected java.util.Map<y.base.Edge,java.util.List<com.nomagic.magicdraw.uml.symbols.layout.labels.AbstractCompositeEdgeLabelDescriptor>> getLabelDescriptorsNotAtEnd()
-
placeLayoutedNodeLabel
private void placeLayoutedNodeLabel(PresentationElement pe, @CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc)
-
resetLabel
public void resetLabel(PresentationElement pe)
Resets label to their default position. This is done when collecting labels while creating graph.- Parameters:
pe
- the element that labels will be reset
-
shouldResetLabelsAtInit
@OpenApi public boolean shouldResetLabelsAtInit()
- Returns:
- if label positions should be reset before creating the graph
-
setResetLabelsAtInit
@OpenApi public final void setResetLabelsAtInit(boolean resetLabelsAtInit)
- Parameters:
resetLabelsAtInit
- true for label reset when creating the graph, false otherwise. Use true for layouting, false when graph is used as a reference for routing.
-
getEdgeLabelLocation
public y.geom.YPoint getEdgeLabelLocation(y.base.Edge e, y.layout.EdgeLabelLayout ell)
Get Location of the given edge label.- Parameters:
e
- Edgeell
- Edge Label Layout.- Returns:
- Y - Point.
-
dispose
public void dispose()
Dispose the graph and graph related data.
-
setMinimalGroupNodeSize
public void setMinimalGroupNodeSize(y.base.Node node, y.geom.YDimension dim)
Sets the minimal group node size that is obeyed by layouter.- Parameters:
node
- the node that should have the minimal sizedim
- the size of node
-
isGroupNode
public boolean isGroupNode(y.base.Node node)
Checks if a given node is a group node or not.- Parameters:
node
- the node to check- Returns:
- true if node is a group node, false otherwise.
-
getStyle
@OpenApi public java.lang.String getStyle()
Get String representation of Style.- Returns:
- String.
-
setPathStyle
@OpenApi public void setPathStyle(java.lang.String style)
Set path style- Parameters:
style
- path style to set
-
makeSubTrees
public void makeSubTrees(com.nomagic.magicdraw.commands.MacroCommand mc)
Make sub trees with the given Macrocommand.- Parameters:
mc
- macro
-
makeSubTree
public void makeSubTree(y.base.Node node, java.lang.Class<?> classType, com.nomagic.magicdraw.commands.MacroCommand mc)
Make sub tree.- Parameters:
node
- The given node.classType
- The given class type.mc
- Macro Command.
-
isTreeOverlapping
public static boolean isTreeOverlapping(TreeView tree, int y, java.lang.Iterable<TreeView> trees)
Check Is tree overlapping.- Parameters:
tree
- The given tree view.y
- y coordinate of the horizontal bar of the tree view.trees
- Collection of trees.- Returns:
- boolean.
-
removeSubTrees
public static void removeSubTrees(@CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc, DiagramPresentationElement dpe, java.util.Set<PresentationElement> selection)
Remove Sub Trees from the given presentation element.- Parameters:
mc
- MacroCommanddpe
- DiagramPresentation.selection
- if not null or empty removes only trees that groups all selected paths or all path connectors.
-
isTreeInSelection
private static boolean isTreeInSelection(TreeView tree, java.util.Collection<PresentationElement> selection)
Tests if given tree is in selection. The tree is in selection if all paths are in selection or all paths ends are in selection.- Parameters:
tree
- some tree viewselection
- selected elements in diagram- Returns:
- true if given path is in selection, otherwise false.
-
belongsToHierarchy
public boolean belongsToHierarchy(y.base.Node node)
Checks the given node belongs to Hierarchy.- Parameters:
node
- The given node.- Returns:
- true, if the node belongs to some hierarchy
-
belongsToHierarchy
public boolean belongsToHierarchy(y.base.Edge edge)
Check The given Edge belongs to hierarchy.- Parameters:
edge
- The given edge.- Returns:
- boolean
-
containsHierarchy
public boolean containsHierarchy()
Check If contains hierarchy.- Returns:
- boolean
-
createHierarchicInfo
public void createHierarchicInfo(@CheckForNull java.util.Collection<java.lang.Class<?>> classTypes)
Create Hierarchy Information of path element.- Parameters:
classTypes
- List of class type.
-
drawResults
public void drawResults()
Draw a result. You need to comment the graph.dispose() call in AbstractDiagramLayouter in order to see the results.
-
getSelected
@OpenApi public java.util.Set<PresentationElement> getSelected()
Get Set of the selected PresentationElement.- Returns:
- Set set of selected presentation elements
-
addEdgeSelectionProvider
public y.base.EdgeMap addEdgeSelectionProvider(java.lang.Object provider, java.util.Collection<y.base.Edge> c)
Add Edge Selection Provider.- Parameters:
provider
- The given provider.c
- Collection of Edge.- Returns:
- EdgeMap.
-
addEdgeSelectionProvider
public y.base.EdgeMap addEdgeSelectionProvider(java.lang.Object provider, y.base.Edge edge)
Add Edge Selection Provider.- Parameters:
provider
- The given provider.edge
- single edge- Returns:
- EdgeMap.
-
addGroupNodeInsetsProvider
public void addGroupNodeInsetsProvider()
Add Group node inset provider.
-
removeGroupNodeInsetsProvider
public void removeGroupNodeInsetsProvider()
Remove The group node in sets of provider.
-
addShrinkableGroupNodeInsetsProvider
private void addShrinkableGroupNodeInsetsProvider()
Add shrinkable shape group node inset provider.
-
removeShrinkableGroupNodeInsetsProvider
private void removeShrinkableGroupNodeInsetsProvider()
Remove the shrinkable shpae group node in sets of provider.
-
createGroupBoundsCalculator
public y.layout.grouping.GroupBoundsCalculator createGroupBoundsCalculator()
Creates bounds calculator for group nodes- Returns:
- calculator
-
getNodeMap
public y.base.NodeMap getNodeMap()
- Returns:
- a node map associated with a data provider
-
getEdgeMap
public y.base.EdgeMap getEdgeMap()
- Returns:
- an edge map associated with a data provider
-
getDataMap
public java.util.Map<PresentationElement,java.lang.Object> getDataMap()
- Returns:
- an edge map associated with a data provider
-
reverseAndAddToNoReverseList
public void reverseAndAddToNoReverseList(y.base.Edge edg)
Reverses an edge in graph, does not reverse if path is already reversed. This method handles label sides also, but only if they are described by PreferredPlacementDescriptor. PreferredPlacementDescriptor.PLACE_AT_TARGET is changed to PreferredPlacementDescriptor.PLACE_AT_SOURCE- Parameters:
edg
- the edge to reverse
-
reverseEdgeAndLabels
public void reverseEdgeAndLabels(y.base.Edge edg)
Reverses the edge along with labels, but does not add them to no reverse list.- Parameters:
edg
- edge to reverse
-
reverseEdge
public void reverseEdge(y.base.Edge edge)
Reverses an edge. Note: does not reverse the labels if they are placed on edge ends. Check thereverseAndAddToNoReverseList
method.- Overrides:
reverseEdge
in classy.base.Graph
- Parameters:
edge
- edge to reverse
-
addToReversedList
public void addToReversedList(y.base.Edge edge)
- Parameters:
edge
- edge to add
-
getReversedList
public java.util.Set<y.base.Edge> getReversedList()
- Returns:
- a list of reversed edges
-
setPlaceEdgeLabelsTo
public void setPlaceEdgeLabelsTo(int placeEdgeLabelsTo)
Sets the calculated label placement for labels. Labels can be created for consideration only, but not placed at the calculated location. One of EDGE_LABEL_NONE, EDGE_LABEL_AT_ENDS, EDGE_LABEL_NON_ENDS , EDGE_LABEL_ALL. EDGE_LABEL_ALL by default.- Parameters:
placeEdgeLabelsTo
- the edge placement mode
-
getPlaceEdgeLabelsPositions
public int getPlaceEdgeLabelsPositions()
- Returns:
- the edge placement mode
-
setCreateEdgeLabels
public void setCreateEdgeLabels(int createEdgeLabels)
Sets the label creation mode. One of EDGE_LABEL_NONE, EDGE_LABEL_AT_ENDS, EDGE_LABEL_NON_ENDS , EDGE_LABEL_ALL. EDGE_LABEL_ALL by default.- Parameters:
createEdgeLabels
- edge placement mode
-
getCreateEdgeLabels
public int getCreateEdgeLabels()
- Returns:
- the edge creation mode
-
setPlaceNodeLabels
public void setPlaceNodeLabels(boolean shouldPlaceNodeLabelsToCalculatedPositions)
- Parameters:
shouldPlaceNodeLabelsToCalculatedPositions
- determines if node labels should be placed at the calculated graph position
-
shouldPlaceNodeLabels
public boolean shouldPlaceNodeLabels()
- Returns:
- true if node labels should be set at the calculated position, false for the default position
-
setCreateNodeLabels
public void setCreateNodeLabels(boolean shouldCreateNodeLabels)
- Parameters:
shouldCreateNodeLabels
- determines if node labels should be created and considered by the graph
-
shouldCreateNodeLabels
public boolean shouldCreateNodeLabels()
- Returns:
- the node label creation mode
-
removeGroupNodeFlagFromNonGroups
private void removeGroupNodeFlagFromNonGroups()
Grouping flag can appear even if shape has pins/ports but nothing inside it. These invalid flags are removed here.
-
getPartitionGrid
public y.layout.grid.PartitionGrid getPartitionGrid()
- Returns:
- instance of partition grid
-
getPartitionInfo
public com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlanePartitionInfo getPartitionInfo()
- Returns:
- the constructed partition info.
-
setPartitionGrid
public void setPartitionGrid(y.layout.grid.PartitionGrid partitionGrid)
- Parameters:
partitionGrid
- sets to use this partition grid as grid
-
setPartitionInfo
public void setPartitionInfo(com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlanePartitionInfo info)
- Parameters:
info
- the information of partitions
-
getNodeToSwimlaneStructure
public java.util.Map<y.base.Node,com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlaneAndCellStructure> getNodeToSwimlaneStructure()
- Returns:
- the node belonging to a swimlane structure
-
setSphereRadius
@OpenApi public void setSphereRadius(int radius)
Sets the sphere from the defined point. All element within this sphere will be collected and initiated. Shapes outside the sphere will be ignored.- Parameters:
radius
- the radius that shapes are collected
-
getSphereRadius
@OpenApi public int getSphereRadius()
- Returns:
- the sphere size for data initialization
-
setSphereCenterPoint
@OpenApi public void setSphereCenterPoint(@CheckForNull java.awt.Point point)
Sets the center of the sphere that is used for node creation- Parameters:
point
- new point of center, default is 0,0
-
getSphereCenterPoint
@CheckForNull @OpenApi public java.awt.Point getSphereCenterPoint()
- Returns:
- the center of the sphere for node creation
-
isInSphereRadius
protected boolean isInSphereRadius(ShapeElement element)
- Returns:
- true, if shape is in sphere radius, or sphere radius is the default, false otherwise.
-
getNodeHaloAdjustedSourcePointAbs
public y.geom.YPoint getNodeHaloAdjustedSourcePointAbs(y.base.Edge edge)
Get absolute location of edge source point on halo, not on the source node itself. As symbols themselves are adjusted by the halos, this is necessary for on edge shape placement to calculate a correct position. Currently only UMLGraphKeys.ENCLOSING_SHAPE_HALO_DP_KEY is considered.- Parameters:
edge
- edge- Returns:
- the source point on halo, rather than node
-
getNodeHaloAdjustedTargetPointAbs
public y.geom.YPoint getNodeHaloAdjustedTargetPointAbs(y.base.Edge edge)
Get absolute location of edge target point on halo, not on the target node itself. As symbols themselves are adjusted by the halos, this is necessary for on edge shape placement to calculate a correct position. Currently only UMLGraphKeys.ENCLOSING_SHAPE_HALO_DP_KEY is considered.- Parameters:
edge
- edge- Returns:
- the target point on halo, rather than node
-
getNodeHaloAdjustedPoint
@CheckForNull private y.geom.YPoint getNodeHaloAdjustedPoint(y.base.Edge edge, y.base.Node sourceNode, y.geom.YPoint pointAtSourceOrTarget)
-
addProvider
public static void addProvider(com.nomagic.magicdraw.uml.symbols.layout.LayoutableSymbolProvider provider)
Registers a new provider- Parameters:
provider
- provider
-
setEdgeLabelFactory
public void setEdgeLabelFactory(com.nomagic.magicdraw.uml.symbols.layout.labels.EdgeLabelFactory edgeLabelFactory)
-
getNonSupportedSymbols
public java.util.Set<PresentationElement> getNonSupportedSymbols()
- Returns:
- set of symbols(shapes or paths) that are not supported by the graph and will not be included into layout and/or will be treated not as a part of the graph
-
getDoNotRepaintPaths
public java.util.Set<PathElement> getDoNotRepaintPaths()
- Returns:
- set of collected paths that are included in the layout, but not repainted according to the graph result
-
getFakeElementsMap
public java.util.Map<PresentationElement,y.base.Edge> getFakeElementsMap()
-
getInsetMap
public y.base.NodeMap getInsetMap()
-
getEdgeLabelDataMap
public java.util.Map<y.base.Edge,java.util.List<y.layout.EdgeLabelLayoutImpl>> getEdgeLabelDataMap()
-
getNodeLabelDataMap
public java.util.Map<y.base.Node,java.util.List<y.layout.NodeLabelLayoutImpl>> getNodeLabelDataMap()
-
-