@OpenApiAll
public class UMLGraph
extends y.layout.DefaultLayoutGraph
Modifier and Type | Class and Description |
---|---|
(package private) class |
UMLGraph.EdgeSourceTargetComparator
Compares target or source elements by their opposite end.
|
Modifier and Type | Field and Description |
---|---|
protected SwimlaneView |
currentSwimlane |
protected SwimlaneCellView |
currentSwimlaneCellView |
static int |
EDGE_LABEL_ALL |
static int |
EDGE_LABEL_AT_ENDS |
static int |
EDGE_LABEL_NON_ENDS |
static int |
EDGE_LABEL_NONE |
java.util.Map<y.base.Edge,java.util.List<y.layout.EdgeLabelLayoutImpl>> |
edgeLabelDataMap |
protected com.nomagic.magicdraw.uml.symbols.layout.labels.EdgeLabelFactory |
edgeLabelFactory |
java.util.Map<com.nomagic.magicdraw.uml.symbols.layout.labels.LabelData,java.awt.Rectangle> |
labelRectangles |
protected java.util.Map<PresentationElement,java.lang.Object> |
mDataMap
PresentationElement (path or shape) bind to yFiles edge or node.
|
protected y.base.EdgeMap |
mEdgeMap |
protected y.base.NodeMap |
mGroupKey |
protected y.base.NodeMap |
mNodeId |
protected y.base.NodeMap |
mNodeMap |
protected java.util.LinkedHashSet<PresentationElement> |
mPaths |
protected java.util.Set<PresentationElement> |
mSelected |
java.util.Map<y.base.Node,java.util.List<y.layout.NodeLabelLayoutImpl>> |
nodeLabelDataMap |
java.util.Map<y.base.Node,com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlaneAndCellStructure> |
nodeToSwimlanePlacement |
com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlanePartitionInfo |
partitionInfo |
Constructor and Description |
---|
UMLGraph(DiagramPresentationElement diagramView,
boolean supportsSubgraph,
java.util.Set<PresentationElement> selected)
Construct UML Graph.
|
UMLGraph(DiagramPresentationElement diagramView,
boolean supportsSubgraph,
java.util.Set<PresentationElement> selected,
boolean resetLabelPositions) |
Modifier and Type | Method and 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 provider
|
void |
addToReversedList(y.base.Edge edge) |
boolean |
areParentToChildConnected(java.lang.Iterable<PathElement> connectedPathElements) |
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) |
void |
createCommands(com.nomagic.magicdraw.commands.MacroCommand mc,
boolean bnodes,
boolean bpaths)
Create command with given parameter.
|
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 nodes
|
void |
createHierarchicInfo(java.util.Collection<java.lang.Class<?>> classTypes)
Create Hierarchy Information of path element.
|
y.base.Node |
createNode(java.lang.Object id)
Create new Node and set the given id to it.
|
protected y.base.Node |
createNode(ShapeElement shape) |
protected void |
createNodeData(java.lang.Object parentId,
java.util.Collection<PresentationElement> presentationElements) |
void |
dispose()
Dispose the diagram.
|
void |
drawResults()
Draw a result.
|
java.awt.Rectangle |
getBoundingBox() |
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.
|
y.geom.YPoint |
getEdgeLabelLocation(y.base.Edge e,
y.layout.EdgeLabelLayout ell)
Get Location of the given edge label.
|
y.base.EdgeMap |
getEdgeMap() |
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, applier only on group nodes
|
static 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.
|
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.
|
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 edge
|
java.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.
|
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.
|
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.
|
protected boolean |
isNotLayoutedChild(PresentationElement view) |
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) |
protected void |
placeLayoutedPathLabel(PresentationElement pe,
y.base.Edge edge,
com.nomagic.magicdraw.commands.MacroCommand mc) |
void |
removeGroupNodeInsetsProvider()
Remove The 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.
|
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.
|
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 0
|
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 edge
|
void |
setPathStyle(java.lang.String style)
Set path style
|
void |
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 creation
|
void |
setSphereRadius(int radius)
Sets the sphere from the defined point.
|
boolean |
shouldCreateNodeLabels() |
boolean |
shouldPlaceNodeLabels() |
boolean |
shouldResetLabelsAtInit() |
createEdgeLayout, createGraphCopyFactory, createLabelFactory, createNodeLayout, getFeature, getFeature, getLabelLayout, getLabelLayout, getLayout, getLayout, setLabelLayout, setLabelLayout, setLabelLayout, setLayout, setLayout
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
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
public static final int EDGE_LABEL_NONE
public static final int EDGE_LABEL_AT_ENDS
public static final int EDGE_LABEL_NON_ENDS
public static final int EDGE_LABEL_ALL
protected java.util.Map<PresentationElement,java.lang.Object> mDataMap
protected y.base.NodeMap mNodeMap
protected y.base.EdgeMap mEdgeMap
protected y.base.NodeMap mNodeId
protected y.base.NodeMap mGroupKey
protected java.util.LinkedHashSet<PresentationElement> mPaths
protected java.util.Set<PresentationElement> mSelected
public java.util.Map<y.base.Edge,java.util.List<y.layout.EdgeLabelLayoutImpl>> edgeLabelDataMap
public java.util.Map<y.base.Node,java.util.List<y.layout.NodeLabelLayoutImpl>> nodeLabelDataMap
public java.util.Map<com.nomagic.magicdraw.uml.symbols.layout.labels.LabelData,java.awt.Rectangle> labelRectangles
public com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlanePartitionInfo partitionInfo
public java.util.Map<y.base.Node,com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlaneAndCellStructure> nodeToSwimlanePlacement
protected SwimlaneView currentSwimlane
protected SwimlaneCellView currentSwimlaneCellView
protected com.nomagic.magicdraw.uml.symbols.layout.labels.EdgeLabelFactory edgeLabelFactory
public UMLGraph(DiagramPresentationElement diagramView, boolean supportsSubgraph, java.util.Set<PresentationElement> selected)
diagramView
- diagram for which to construct graph.supportsSubgraph
- True ,if UMLGraph support sub graph.selected
- selected elementspublic UMLGraph(DiagramPresentationElement diagramView, boolean supportsSubgraph, java.util.Set<PresentationElement> selected, boolean resetLabelPositions)
public void initializeData()
public static y.geom.YInsets getInsets(ShapeElement shape)
shape
- the shape to calculate insets topublic static y.geom.YInsets getInsets(ShapeElement shape, java.awt.Insets addAdditional)
shape
- the shape to calculate insets toprotected y.base.Node createNode(ShapeElement shape)
protected void setNodeSizeEnsureNotZero(java.awt.Rectangle bounds, y.base.Node node)
bounds
- the bounds to setnode
- the node that should have the minimal sizeprotected void createAllNodeLabels(ShapeElement shape, y.base.Node node)
public java.awt.Rectangle getBoundingBox()
getBoundingBox
in interface y.layout.GraphLayout
getBoundingBox
in class y.layout.LayoutGraph
public y.base.Node createNode(java.lang.Object id)
id
- The given id.public java.lang.Object getID(y.base.Node node)
node
- The given node.@CheckForNull public y.base.Edge createEdge(PathElement path)
path
- the path that will correspond an edgeprotected void createAllPathLabels(com.nomagic.magicdraw.uml.symbols.layout.labels.EdgeLabelFactory factory)
public PathElement getPathElement(y.base.Edge edge)
edge
- The given edge.public ShapeElement getShapeElement(y.base.Node node)
node
- The given node.public void setParent(y.base.Node node, java.lang.Object parentId)
node
- The given node.parentId
- The parent 's id.public java.lang.Object getParentId(y.base.Node node)
node
- The given node.public DiagramPresentationElement getDiagram()
protected boolean needToCreate(PresentationElement pe)
protected void createNodeData(@CheckForNull java.lang.Object parentId, java.util.Collection<PresentationElement> presentationElements)
public boolean areParentToChildConnected(java.lang.Iterable<PathElement> connectedPathElements)
protected void collectPathsRecursively(ShapeElement element, y.base.Node node)
protected void addPaths(PresentationElement pe)
@CheckForNull public y.base.Node getNode(PresentationElement se)
se
- PresentationElement.public y.base.Edge getEdge(PathElement path)
path
- The given path element.protected boolean isNotLayoutedChild(PresentationElement view)
public static boolean isLayoutableByProviders(PresentationElement el)
el
- checked elementpublic void createCommands(@CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc, boolean bnodes, boolean bpaths)
mc
- MacroCommand.bnodes
- determines if nodes should be placedbpaths
- determines if paths should be routedprotected void ignoreCenterlines(PresentationElement shape)
shape
- the shape to ignore centerlines on shape bound changespublic java.util.ArrayList<java.awt.Point> getPointsFromEdge(y.base.Edge edge)
edge
- edge's point to returnpublic 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)
path
- current pathpoints
- new breakpointssupplier
- supplierclient
- clientmc
- macroprotected void placeLayoutedPathLabel(PresentationElement pe, y.base.Edge edge, @CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc)
protected java.util.Map<y.base.Edge,java.util.List<com.nomagic.magicdraw.uml.symbols.layout.labels.AbstractCompositeEdgeLabelDescriptor>> getLabelDescriptorsNotAtEnd()
public void resetLabel(PresentationElement pe)
pe
- the element that labels will be resetpublic boolean shouldResetLabelsAtInit()
public final void setResetLabelsAtInit(boolean resetLabelsAtInit)
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.public y.geom.YPoint getEdgeLabelLocation(y.base.Edge e, y.layout.EdgeLabelLayout ell)
e
- Edgeell
- Edge Label Layout.public void dispose()
public void setMinimalGroupNodeSize(y.base.Node node, y.geom.YDimension dim)
node
- the node that should have the minimal sizedim
- the size of nodepublic boolean isGroupNode(y.base.Node node)
node
- the node to checkpublic java.lang.String getStyle()
public void setPathStyle(java.lang.String style)
style
- path style to setpublic void makeSubTrees(com.nomagic.magicdraw.commands.MacroCommand mc)
mc
- macropublic void makeSubTree(y.base.Node node, java.lang.Class<?> classType, com.nomagic.magicdraw.commands.MacroCommand mc)
node
- The given node.classType
- The given class type.mc
- Macro Command.public static boolean isTreeOverlapping(TreeView tree, int y, java.lang.Iterable<TreeView> trees)
tree
- The given tree view.y
- y coordinate of the horizontal bar of the tree view.trees
- Collection of trees.public static void removeSubTrees(@CheckForNull com.nomagic.magicdraw.commands.MacroCommand mc, DiagramPresentationElement dpe, java.util.Set<PresentationElement> selection)
mc
- MacroCommanddpe
- DiagramPresentation.selection
- if not null or empty removes only trees that groups all selected paths or
all path connectors.public boolean belongsToHierarchy(y.base.Node node)
node
- The given node.public boolean belongsToHierarchy(y.base.Edge edge)
edge
- The given edge.public boolean containsHierarchy()
public void createHierarchicInfo(@CheckForNull java.util.Collection<java.lang.Class<?>> classTypes)
classTypes
- List of class type.public void drawResults()
public java.util.Set<PresentationElement> getSelected()
public y.base.EdgeMap addEdgeSelectionProvider(java.lang.Object provider, java.util.Collection<y.base.Edge> c)
provider
- The given provider.c
- Collection of Edge.public y.base.EdgeMap addEdgeSelectionProvider(java.lang.Object provider, y.base.Edge edge)
provider
- The given provider.edge
- single edgepublic void addGroupNodeInsetsProvider()
public void removeGroupNodeInsetsProvider()
public y.layout.grouping.GroupBoundsCalculator createGroupBoundsCalculator()
public y.base.NodeMap getNodeMap()
public y.base.EdgeMap getEdgeMap()
public java.util.Map<PresentationElement,java.lang.Object> getDataMap()
public void reverseAndAddToNoReverseList(y.base.Edge edg)
edg
- the edge to reversepublic void reverseEdgeAndLabels(y.base.Edge edg)
edg
- edge to reversepublic void reverseEdge(y.base.Edge edge)
reverseAndAddToNoReverseList
method.reverseEdge
in class y.base.Graph
edge
- edge to reversepublic void addToReversedList(y.base.Edge edge)
edge
- edge to addpublic java.util.Set<y.base.Edge> getReversedList()
public void setPlaceEdgeLabelsTo(int placeEdgeLabelsTo)
placeEdgeLabelsTo
- the edge placement modepublic int getPlaceEdgeLabelsPositions()
public void setCreateEdgeLabels(int createEdgeLabels)
createEdgeLabels
- edge placement modepublic int getCreateEdgeLabels()
public void setPlaceNodeLabels(boolean shouldPlaceNodeLabelsToCalculatedPositions)
shouldPlaceNodeLabelsToCalculatedPositions
- determines if node labels should be placed at the calculated graph positionpublic boolean shouldPlaceNodeLabels()
public void setCreateNodeLabels(boolean shouldCreateNodeLabels)
shouldCreateNodeLabels
- determines if node labels should be created and considered by the graphpublic boolean shouldCreateNodeLabels()
public y.layout.grid.PartitionGrid getPartitionGrid()
public com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlanePartitionInfo getPartitionInfo()
public void setPartitionGrid(y.layout.grid.PartitionGrid partitionGrid)
partitionGrid
- sets to use this partition grid as gridpublic void setPartitionInfo(com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlanePartitionInfo info)
info
- the information of partitionspublic java.util.Map<y.base.Node,com.nomagic.magicdraw.uml.symbols.layout.activity.SwimlaneAndCellStructure> getNodeToSwimlaneStructure()
public void setSphereRadius(int radius)
radius
- the radius that shapes are collectedpublic int getSphereRadius()
public void setSphereCenterPoint(java.awt.Point point)
point
- new point of center, default is 0,0public java.awt.Point getSphereCenterPoint()
protected boolean isInSphereRadius(ShapeElement element)
public y.geom.YPoint getNodeHaloAdjustedSourcePointAbs(y.base.Edge edge)
edge
- edgepublic y.geom.YPoint getNodeHaloAdjustedTargetPointAbs(y.base.Edge edge)
edge
- edgepublic static void addProvider(com.nomagic.magicdraw.uml.symbols.layout.LayoutableSymbolProvider provider)
provider
- providerpublic void setEdgeLabelFactory(com.nomagic.magicdraw.uml.symbols.layout.labels.EdgeLabelFactory edgeLabelFactory)
public java.util.Set<PresentationElement> getNonSupportedSymbols()
public java.util.Set<PathElement> getDoNotRepaintPaths()
public java.util.Map<PresentationElement,y.base.Edge> getFakeElementsMap()
public y.base.NodeMap getInsetMap()