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 void
addEdge(E edge, com.neotropic.flow.component.mxgraph.MxGraphEdge mxgraphEdge)
add the given edge in the canvascom.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 canvascom.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 canvasvoid
addEdge(E edge, N sourceNode, N targetNode, com.neotropic.flow.component.mxgraph.MxGraphEdge mxgraphEdge)
add the given edge in the canvasvoid
addNode(N node, com.neotropic.flow.component.mxgraph.MxGraphNode mxgraphNode)
add the given node in the canvascom.neotropic.flow.component.mxgraph.MxGraphNode
addNode(N node, String nodeId, int xCoordinate, int yCoordinate, String imageUri)
Create and add a new node in the canvascom.neotropic.flow.component.mxgraph.MxGraphEdge
findMxGraphEdge(E edge)
com.neotropic.flow.component.mxgraph.MxGraphNode
findMxGraphNode(N node)
N
findSourceEdgeObject(E edge)
N
findTargetEdgeObject(E edge)
HashMap<E,com.neotropic.flow.component.mxgraph.MxGraphEdge>
getEdges()
com.neotropic.flow.component.mxgraph.MxGraph
getMxGraph()
LinkedHashMap<N,com.neotropic.flow.component.mxgraph.MxGraphNode>
getNodes()
String
getSelectedCellId()
String
getSelectedCellType()
HashMap<E,N>
getSourceEdgeNodes()
HashMap<E,N>
getTargetEdgeNodes()
void
removeAllCells()
this method remove all cells(vertex and edges) in the graphvoid
removeEdge(E businessObject)
Removes an edge from the canvasvoid
removeNode(N businessObject)
Removes a node from the canvasvoid
setComObjectDeleted(com.vaadin.flow.server.Command comObjectDeleted)
void
setComObjectSelected(com.vaadin.flow.server.Command comObjectSelected)
void
setComObjectUnselected(com.vaadin.flow.server.Command comObjectUnselected)
void
setEdges(HashMap<E,com.neotropic.flow.component.mxgraph.MxGraphEdge> edges)
void
setMxGraph(com.neotropic.flow.component.mxgraph.MxGraph mxGraph)
void
setNodes(LinkedHashMap<N,com.neotropic.flow.component.mxgraph.MxGraphNode> nodes)
void
setSelectedCellId(String selectedCellId)
void
setSelectedCellType(String selectedCellType)
void
setSourceEdgeNodes(HashMap<E,N> sourceEdgeNodes)
void
setTargetEdgeNodes(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
-
-