Class MxGraphCanvas<N,​E>

  • Type Parameters:
    N - Node object type
    E - 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 Detail

      • MxGraphCanvas

        public MxGraphCanvas()
      • MxGraphCanvas

        public MxGraphCanvas​(String width,
                             String height)
    • 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)
      • getEdges

        public HashMap<E,​com.neotropic.flow.component.mxgraph.MxGraphEdge> getEdges()
      • setEdges

        public void setEdges​(HashMap<E,​com.neotropic.flow.component.mxgraph.MxGraphEdge> edges)
      • getSourceEdgeNodes

        public HashMap<E,​N> getSourceEdgeNodes()
      • setSourceEdgeNodes

        public void setSourceEdgeNodes​(HashMap<E,​N> sourceEdgeNodes)
      • getTargetEdgeNodes

        public HashMap<E,​N> getTargetEdgeNodes()
      • setTargetEdgeNodes

        public void setTargetEdgeNodes​(HashMap<E,​N> targetEdgeNodes)
      • 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)
      • findSourceEdgeObject

        public N findSourceEdgeObject​(E edge)
      • findTargetEdgeObject

        public N findTargetEdgeObject​(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 node
        nodeId - the node id
        xCoordinate - the x coordinate in the canvas
        yCoordinate - the y coordinate in the canvas
        imageUri - 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 node
        mxgraphNode - 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 edge
        edgeId - the edge id
        sourceObject - the source edge object
        targetObject - the target edge object
        points - the control points list
        sourceLabel - the source label
        targetLabel - 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 edge
        edgeId - the edge id
        sourceObject - the source edge object
        targetObject - the target edge object
        points - the control points list
        sourceLabel - the source label
        targetLabel - the target label
        edgeColor - 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 edge
        mxgraphEdge - 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 edge
        sourceNode - the object that represents the source node
        targetNode - the object that represents the target node
        mxgraphEdge - 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