Class MxGraphCanvas<N,E>
- java.lang.Object
-
- org.neotropic.util.visual.mxgraph.MxGraphCanvas<N,E>
-
- Type Parameters:
N- Node object typeE- Edge object type
public class MxGraphCanvas<N,E> extends Object
Wrapper to manage mxgraph instance and his objects- Author:
- Orlando Paz <orlando.paz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description MxGraphCanvas()MxGraphCanvas(String width, String height)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(E edge, com.neotropic.flow.component.mxgraph.MxGraphEdge mxgraphEdge)add the given edge in the canvascom.neotropic.flow.component.mxgraph.MxGraphEdgeaddEdge(E edgeObject, String edgeId, N sourceObject, N targetObject, List<com.neotropic.flow.component.mxgraph.Point> points, String sourceLabel, String targetLabel)creates a new edge in the canvascom.neotropic.flow.component.mxgraph.MxGraphEdgeaddEdge(E edgeObject, String edgeId, N sourceObject, N targetObject, List<com.neotropic.flow.component.mxgraph.Point> points, String sourceLabel, String targetLabel, String edgeColor)creates a new edge in the canvasvoidaddEdge(E edge, N sourceNode, N targetNode, com.neotropic.flow.component.mxgraph.MxGraphEdge mxgraphEdge)add the given edge in the canvasvoidaddNode(N node, com.neotropic.flow.component.mxgraph.MxGraphNode mxgraphNode)add the given node in the canvascom.neotropic.flow.component.mxgraph.MxGraphNodeaddNode(N node, String nodeId, int xCoordinate, int yCoordinate, String imageUri)Create and add a new node in the canvascom.neotropic.flow.component.mxgraph.MxGraphEdgefindMxGraphEdge(E edge)com.neotropic.flow.component.mxgraph.MxGraphNodefindMxGraphNode(N node)NfindSourceEdgeObject(E edge)NfindTargetEdgeObject(E edge)HashMap<E,com.neotropic.flow.component.mxgraph.MxGraphEdge>getEdges()com.neotropic.flow.component.mxgraph.MxGraphgetMxGraph()LinkedHashMap<N,com.neotropic.flow.component.mxgraph.MxGraphNode>getNodes()StringgetSelectedCellId()StringgetSelectedCellType()HashMap<E,N>getSourceEdgeNodes()HashMap<E,N>getTargetEdgeNodes()voidremoveAllCells()this method remove all cells(vertex and edges) in the graphvoidremoveEdge(E businessObject)Removes an edge from the canvasvoidremoveNode(N businessObject)Removes a node from the canvasvoidsetComObjectDeleted(com.vaadin.flow.server.Command comObjectDeleted)voidsetComObjectSelected(com.vaadin.flow.server.Command comObjectSelected)voidsetComObjectUnselected(com.vaadin.flow.server.Command comObjectUnselected)voidsetEdges(HashMap<E,com.neotropic.flow.component.mxgraph.MxGraphEdge> edges)voidsetMxGraph(com.neotropic.flow.component.mxgraph.MxGraph mxGraph)voidsetNodes(LinkedHashMap<N,com.neotropic.flow.component.mxgraph.MxGraphNode> nodes)voidsetSelectedCellId(String selectedCellId)voidsetSelectedCellType(String selectedCellType)voidsetSourceEdgeNodes(HashMap<E,N> sourceEdgeNodes)voidsetTargetEdgeNodes(HashMap<E,N> targetEdgeNodes)
-
-
-
Method Detail
-
getMxGraph
public com.neotropic.flow.component.mxgraph.MxGraph getMxGraph()
-
setMxGraph
public void setMxGraph(com.neotropic.flow.component.mxgraph.MxGraph mxGraph)
-
getNodes
public LinkedHashMap<N,com.neotropic.flow.component.mxgraph.MxGraphNode> getNodes()
-
setNodes
public void setNodes(LinkedHashMap<N,com.neotropic.flow.component.mxgraph.MxGraphNode> nodes)
-
getSelectedCellId
public String getSelectedCellId()
-
setSelectedCellId
public void setSelectedCellId(String selectedCellId)
-
getSelectedCellType
public String getSelectedCellType()
-
setSelectedCellType
public void setSelectedCellType(String selectedCellType)
-
setComObjectSelected
public void setComObjectSelected(com.vaadin.flow.server.Command comObjectSelected)
-
setComObjectDeleted
public void setComObjectDeleted(com.vaadin.flow.server.Command comObjectDeleted)
-
setComObjectUnselected
public void setComObjectUnselected(com.vaadin.flow.server.Command comObjectUnselected)
-
findMxGraphNode
public com.neotropic.flow.component.mxgraph.MxGraphNode findMxGraphNode(N node)
-
findMxGraphEdge
public com.neotropic.flow.component.mxgraph.MxGraphEdge findMxGraphEdge(E edge)
-
addNode
public com.neotropic.flow.component.mxgraph.MxGraphNode addNode(N node, String nodeId, int xCoordinate, int yCoordinate, String imageUri)
Create and add a new node in the canvas- Parameters:
node- the object that represent the nodenodeId- the node idxCoordinate- the x coordinate in the canvasyCoordinate- the y coordinate in the canvasimageUri- the uri image- Returns:
- the new node
-
addNode
public void addNode(N node, com.neotropic.flow.component.mxgraph.MxGraphNode mxgraphNode)
add the given node in the canvas- Parameters:
node- he object that represents the nodemxgraphNode- the new mxGraphNode
-
addEdge
public com.neotropic.flow.component.mxgraph.MxGraphEdge addEdge(E edgeObject, String edgeId, N sourceObject, N targetObject, List<com.neotropic.flow.component.mxgraph.Point> points, String sourceLabel, String targetLabel)
creates a new edge in the canvas- Parameters:
edgeObject- the object that represents the edgeedgeId- the edge idsourceObject- the source edge objecttargetObject- the target edge objectpoints- the control points listsourceLabel- the source labeltargetLabel- the target label- Returns:
- the new edge
-
addEdge
public com.neotropic.flow.component.mxgraph.MxGraphEdge addEdge(E edgeObject, String edgeId, N sourceObject, N targetObject, List<com.neotropic.flow.component.mxgraph.Point> points, String sourceLabel, String targetLabel, String edgeColor)
creates a new edge in the canvas- Parameters:
edgeObject- the object that represents the edgeedgeId- the edge idsourceObject- the source edge objecttargetObject- the target edge objectpoints- the control points listsourceLabel- the source labeltargetLabel- the target labeledgeColor- the edge color- Returns:
- the new edge
-
addEdge
public void addEdge(E edge, com.neotropic.flow.component.mxgraph.MxGraphEdge mxgraphEdge)
add the given edge in the canvas- Parameters:
edge- he object that represents the edgemxgraphEdge- the new mxgraphCell
-
addEdge
public void addEdge(E edge, N sourceNode, N targetNode, com.neotropic.flow.component.mxgraph.MxGraphEdge mxgraphEdge)
add the given edge in the canvas- Parameters:
edge- the object that represents the edgesourceNode- the object that represents the source nodetargetNode- the object that represents the target nodemxgraphEdge- the new mxgraphCell
-
removeNode
public void removeNode(N businessObject)
Removes a node from the canvas- Parameters:
businessObject- the object to be removed
-
removeEdge
public void removeEdge(E businessObject)
Removes an edge from the canvas- Parameters:
businessObject- the object to be removed
-
removeAllCells
public void removeAllCells()
this method remove all cells(vertex and edges) in the graph
-
-