Documentation of 'com.mxgraph.model.mxGraphModel' Java class
mxGraphModel
com.mxgraph.model

Class mxGraphModel

  • All Implemented Interfaces:
    mxIGraphModel, java.io.Serializable


    public class mxGraphModel
    extends mxEventSource
    implements mxIGraphModel, java.io.Serializable
    Extends mxEventSource to implement a graph model. The graph model acts as a wrapper around the cells which are in charge of storing the actual graph datastructure. The model acts as a transactional wrapper with event notification for all changes, whereas the cells contain the atomic operations for updating the actual datastructure. Layers: The cell hierarchy in the model must have a top-level root cell which contains the layers (typically one default layer), which in turn contain the top-level cells of the layers. This means each cell is contained in a layer. If no layers are required, then all new cells should be added to the default layer. Layers are useful for hiding and showing groups of cells, or for placing groups of cells on top of other cells in the display. To identify a layer, the function is used. It returns true if the parent of the given cell is the root of the model. This class fires the following events: mxEvent.CHANGE fires when an undoable edit is dispatched. The edit property contains the mxUndoableEdit. The changes property contains the list of undoable changes inside the undoable edit. The changes property is deprecated, please use edit.getChanges() instead. mxEvent.EXECUTE fires between begin- and endUpdate and after an atomic change was executed in the model. The change property contains the atomic change that was executed. mxEvent.BEGIN_UPDATE fires after the updateLevel was incremented in beginUpdate. This event contains no properties. mxEvent.END_UPDATE fires after the updateLevel was decreased in endUpdate but before any notification or change dispatching. The edit property contains the current mxUndoableEdit. mxEvent.BEFORE_UNDO fires before the change is dispatched after the update level has reached 0 in endUpdate. The edit property contains the current mxUndoableEdit. mxEvent.UNDO fires after the change was dispatched in endUpdate. The edit property contains the current mxUndoableEdit.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      mxGraphModel()
      Constructs a new empty graph model.
      mxGraphModel(java.lang.Object root)
      Constructs a new graph model.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Object add(java.lang.Object parent, java.lang.Object child, int index)
      Adds the specified child to the parent at the given index.
      void beginUpdate()
      Increments the updateLevel by one.
      void clear()
      Sets a new root using createRoot.
      java.lang.Object[] cloneCells(java.lang.Object[] cells, boolean includeChildren)
      Returns an array of clones for the given array of cells.
      boolean contains(java.lang.Object cell)
      Returns true if the model contains the given cell.
      java.lang.String createId(java.lang.Object cell)
      Creates a new Id for the given cell and increments the global counter for creating new Ids.
      java.lang.Object createRoot()
      Creates a new root cell with a default layer (child 0).
      void endUpdate()
      Decrements the updateLevel by one and fires a notification event if the updateLevel reaches 0.
      void execute(mxIGraphModel.mxAtomicGraphModelChange change)
      Executes the given atomic change and adds it to the current edit.
      static java.lang.Object[] filterCells(java.lang.Object[] cells, mxGraphModel.Filter filter) 
      static java.util.Collection<java.lang.Object> filterDescendants(mxIGraphModel model, mxGraphModel.Filter filter)
      Creates a collection of cells using the visitor pattern.
      static java.util.Collection<java.lang.Object> filterDescendants(mxIGraphModel model, mxGraphModel.Filter filter, java.lang.Object parent)
      Creates a collection of cells using the visitor pattern.
      java.lang.Object getCell(java.lang.String id)
      Returns the cell for the specified Id or null if no cell can be found for the given Id.
      java.util.Map<java.lang.String,java.lang.Object> getCells()
      Returns the internal lookup table that is used to map from Ids to cells.
      java.lang.Object getChildAt(java.lang.Object parent, int index)
      Returns the child of the given parent at the given index.
      static java.lang.Object[] getChildCells(mxIGraphModel model, java.lang.Object parent, boolean vertices, boolean edges)
      Returns the children of the given cell that are vertices and/or edges depending on the arguments.
      int getChildCount(java.lang.Object cell)
      Returns the number of children in the given cell.
      static java.lang.Object[] getChildEdges(mxIGraphModel model, java.lang.Object parent)
      Returns the child edges of the given parent.
      static java.lang.Object[] getChildren(mxIGraphModel model, java.lang.Object parent)
      Returns all children of the given cell regardless of their type.
      static java.lang.Object[] getChildVertices(mxIGraphModel model, java.lang.Object parent)
      Returns the child vertices of the given parent.
      static java.lang.Object[] getConnections(mxIGraphModel model, java.lang.Object cell)
      Returns all edges connected to this cell without loops.
      static java.util.Collection<java.lang.Object> getDescendants(mxIGraphModel model, java.lang.Object parent)
      Returns a all descendants of the given cell and the cell itself as a collection.
      static int getDirectedEdgeCount(mxIGraphModel model, java.lang.Object cell, boolean outgoing)
      Returns the number of incoming or outgoing edges.
      static int getDirectedEdgeCount(mxIGraphModel model, java.lang.Object cell, boolean outgoing, java.lang.Object ignoredEdge)
      Returns the number of incoming or outgoing edges, ignoring the given edge.
      java.lang.Object getEdgeAt(java.lang.Object parent, int index)
      Returns the edge of cell at the given index.
      int getEdgeCount(java.lang.Object cell)
      Returns the number of distinct edges connected to the given cell.
      static java.lang.Object[] getEdges(mxIGraphModel model, java.lang.Object cell)
      Returns all edges connected to this cell including loops.
      static java.lang.Object[] getEdges(mxIGraphModel model, java.lang.Object cell, boolean incoming, boolean outgoing, boolean includeLoops)
      Returns all distinct edges connected to this cell.
      static java.lang.Object[] getEdgesBetween(mxIGraphModel model, java.lang.Object source, java.lang.Object target)
      Returns all edges from the given source to the given target.
      static java.lang.Object[] getEdgesBetween(mxIGraphModel model, java.lang.Object source, java.lang.Object target, boolean directed)
      Returns all edges between the given source and target pair.
      mxGeometry getGeometry(java.lang.Object cell)
      Returns the geometry of the given cell.
      static java.lang.Object[] getIncomingEdges(mxIGraphModel model, java.lang.Object cell)
      Returns the incoming edges of the given cell without loops.
      java.lang.Object getNearestCommonAncestor(java.lang.Object cell1, java.lang.Object cell2)
      Returns the nearest common ancestor for the specified cells.
      static java.lang.Object[] getOpposites(mxIGraphModel model, java.lang.Object[] edges, java.lang.Object terminal)
      Returns all opposite cells of terminal for the given edges.
      static java.lang.Object[] getOpposites(mxIGraphModel model, java.lang.Object[] edges, java.lang.Object terminal, boolean sources, boolean targets)
      Returns all opposite vertices wrt terminal for the given edges, only returning sources and/or targets as specified.
      mxPoint getOrigin(java.lang.Object cell)
      Returns the absolute, accumulated origin for the children inside the given parent.
      static java.lang.Object[] getOutgoingEdges(mxIGraphModel model, java.lang.Object cell)
      Returns the outgoing edges of the given cell without loops.
      java.lang.Object getParent(java.lang.Object child)
      Returns the parent of the given cell.
      static java.lang.Object[] getParents(mxIGraphModel model, java.lang.Object[] cells) 
      java.lang.Object getRoot()
      Returns the root of the model or the topmost parent of the given cell.
      java.lang.String getStyle(java.lang.Object cell)
      Returns the style of the given cell.
      java.lang.Object getTerminal(java.lang.Object edge, boolean isSource)
      Returns the source or target terminal of the given edge depending on the value of the boolean parameter.
      static java.lang.Object[] getTopmostCells(mxIGraphModel model, java.lang.Object[] cells)
      Function: getTopmostCells Returns the topmost cells of the hierarchy in an array that contains no desceandants for each that it contains.
      int getUpdateLevel() 
      java.lang.Object getValue(java.lang.Object cell)
      Returns the user object of the given cell.
      boolean isAncestor(java.lang.Object parent, java.lang.Object child)
      Returns true if the given parent is an ancestor of the given child.
      boolean isCollapsed(java.lang.Object cell)
      Returns true if the given cell is collapsed.
      boolean isConnectable(java.lang.Object cell)
      Returns true if the given cell is connectable.
      boolean isCreateIds()
      Returns true if the model automatically creates Ids and resolves Id collisions.
      boolean isEdge(java.lang.Object cell)
      Returns true if the given cell is an edge.
      boolean isMaintainEdgeParent()
      Returns true if the model automatically update parents of edges so that the edge is contained in the nearest-common-ancestor of its terminals.
      boolean isVertex(java.lang.Object cell)
      Returns true if the given cell is a vertex.
      boolean isVisible(java.lang.Object cell)
      Returns true if the given cell is visible.
      void mergeChildren(mxICell from, mxICell to, boolean cloneAllEdges)
      Merges the children of the given cell into the given target cell inside this model.
      java.lang.Object remove(java.lang.Object cell)
      Removes the specified cell from the model.
      boolean setCollapsed(java.lang.Object cell, boolean collapsed)
      Sets the collapsed state of the given cell.
      void setCreateIds(boolean value)
      Specifies if the model automatically creates Ids for new cells and resolves Id collisions.
      mxGeometry setGeometry(java.lang.Object cell, mxGeometry geometry)
      Sets the geometry of the given cell.
      void setMaintainEdgeParent(boolean maintainEdgeParent)
      Specifies if the model automatically updates parents of edges so that the edge is contained in the nearest-common-ancestor of its terminals.
      java.lang.Object setRoot(java.lang.Object root)
      Sets the root of the model and resets all structures.
      java.lang.String setStyle(java.lang.Object cell, java.lang.String style)
      Sets the style of the given cell.
      java.lang.Object setTerminal(java.lang.Object edge, java.lang.Object terminal, boolean isSource)
      Sets the source or target terminal of the given edge using.
      static void setTerminals(mxIGraphModel model, java.lang.Object edge, java.lang.Object source, java.lang.Object target)
      Sets the source and target of the given edge in a single atomic change.
      java.lang.Object setValue(java.lang.Object cell, java.lang.Object value)
      Sets the user object of then given cell.
      boolean setVisible(java.lang.Object cell, boolean visible)
      Sets the visible state of the given cell.
      void updateEdgeParent(java.lang.Object edge, java.lang.Object root)
      Inner helper method to update the parent of the specified edge to the nearest-common-ancestor of its two terminals.
      void updateEdgeParents(java.lang.Object cell)
      Updates the parents of the edges connected to the given cell and all its descendants so that each edge is contained in the nearest common ancestor.
      void updateEdgeParents(java.lang.Object cell, java.lang.Object root)
      Updates the parents of the edges connected to the given cell and all its descendants so that the edge is contained in the nearest-common-ancestor.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • mxGraphModel

        public mxGraphModel()
        Constructs a new empty graph model.
      • mxGraphModel

        public mxGraphModel(java.lang.Object root)
        Constructs a new graph model. If no root is specified then a new root mxCell with a default layer is created.
        Parameters:
        root - Cell that represents the root cell.
    • Method Detail

      • clear

        public void clear()
        Sets a new root using createRoot.
      • getUpdateLevel

        public int getUpdateLevel()
      • createRoot

        public java.lang.Object createRoot()
        Creates a new root cell with a default layer (child 0).
      • getCells

        public java.util.Map<java.lang.String,java.lang.Object> getCells()
        Returns the internal lookup table that is used to map from Ids to cells.
      • getCell

        public java.lang.Object getCell(java.lang.String id)
        Returns the cell for the specified Id or null if no cell can be found for the given Id.
        Parameters:
        id - A string representing the Id of the cell.
        Returns:
        Returns the cell for the given Id.
      • isMaintainEdgeParent

        public boolean isMaintainEdgeParent()
        Returns true if the model automatically update parents of edges so that the edge is contained in the nearest-common-ancestor of its terminals.
        Returns:
        Returns true if the model maintains edge parents.
      • setMaintainEdgeParent

        public void setMaintainEdgeParent(boolean maintainEdgeParent)
        Specifies if the model automatically updates parents of edges so that the edge is contained in the nearest-common-ancestor of its terminals.
        Parameters:
        maintainEdgeParent - Boolean indicating if the model should maintain edge parents.
      • isCreateIds

        public boolean isCreateIds()
        Returns true if the model automatically creates Ids and resolves Id collisions.
        Returns:
        Returns true if the model creates Ids.
      • setCreateIds

        public void setCreateIds(boolean value)
        Specifies if the model automatically creates Ids for new cells and resolves Id collisions.
        Parameters:
        value - Boolean indicating if the model should created Ids.
      • getRoot

        public java.lang.Object getRoot()
        Description copied from interface: mxIGraphModel
        Returns the root of the model or the topmost parent of the given cell.
        Specified by:
        getRoot in interface mxIGraphModel
        Returns:
        Returns the root cell.
      • setRoot

        public java.lang.Object setRoot(java.lang.Object root)
        Description copied from interface: mxIGraphModel
        Sets the root of the model and resets all structures.
        Specified by:
        setRoot in interface mxIGraphModel
        Parameters:
        root - Cell that specifies the new root.
      • cloneCells

        public java.lang.Object[] cloneCells(java.lang.Object[] cells,
                                             boolean includeChildren)
        Description copied from interface: mxIGraphModel
        Returns an array of clones for the given array of cells. Depending on the value of includeChildren, a deep clone is created for each cell. Connections are restored based if the corresponding cell is contained in the passed in array.
        Specified by:
        cloneCells in interface mxIGraphModel
        Parameters:
        cells - Array of cells to be cloned.
        includeChildren - Boolean indicating if the cells should be cloned with all descendants.
        Returns:
        Returns a cloned array of cells.
      • isAncestor

        public boolean isAncestor(java.lang.Object parent,
                                  java.lang.Object child)
        Description copied from interface: mxIGraphModel
        Returns true if the given parent is an ancestor of the given child.
        Specified by:
        isAncestor in interface mxIGraphModel
        Parameters:
        parent - Cell that specifies the parent.
        child - Cell that specifies the child.
        Returns:
        Returns true if child is an ancestor of parent.
      • contains

        public boolean contains(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns true if the model contains the given cell.
        Specified by:
        contains in interface mxIGraphModel
        Parameters:
        cell - Cell to be checked.
        Returns:
        Returns true if the cell is in the model.
      • getParent

        public java.lang.Object getParent(java.lang.Object child)
        Description copied from interface: mxIGraphModel
        Returns the parent of the given cell.
        Specified by:
        getParent in interface mxIGraphModel
        Parameters:
        child - Cell whose parent should be returned.
        Returns:
        Returns the parent of the given cell.
      • add

        public java.lang.Object add(java.lang.Object parent,
                                    java.lang.Object child,
                                    int index)
        Description copied from interface: mxIGraphModel
        Adds the specified child to the parent at the given index. If no index is specified then the child is appended to the parent's array of children.
        Specified by:
        add in interface mxIGraphModel
        Parameters:
        parent - Cell that specifies the parent to contain the child.
        child - Cell that specifies the child to be inserted.
        index - Integer that specifies the index of the child.
        Returns:
        Returns the inserted child.
      • createId

        public java.lang.String createId(java.lang.Object cell)
        Creates a new Id for the given cell and increments the global counter for creating new Ids.
        Parameters:
        cell - Cell for which a new Id should be created.
        Returns:
        Returns a new Id for the given cell.
      • remove

        public java.lang.Object remove(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Removes the specified cell from the model. This operation will remove the cell and all of its children from the model.
        Specified by:
        remove in interface mxIGraphModel
        Parameters:
        cell - Cell that should be removed.
        Returns:
        Returns the removed cell.
      • getChildCount

        public int getChildCount(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns the number of children in the given cell.
        Specified by:
        getChildCount in interface mxIGraphModel
        Parameters:
        cell - Cell whose number of children should be returned.
        Returns:
        Returns the number of children in the given cell.
      • getChildAt

        public java.lang.Object getChildAt(java.lang.Object parent,
                                           int index)
        Description copied from interface: mxIGraphModel
        Returns the child of the given parent at the given index.
        Specified by:
        getChildAt in interface mxIGraphModel
        Parameters:
        parent - Cell that represents the parent.
        index - Integer that specifies the index of the child to be returned.
        Returns:
        Returns the child at index in parent.
      • getTerminal

        public java.lang.Object getTerminal(java.lang.Object edge,
                                            boolean isSource)
        Description copied from interface: mxIGraphModel
        Returns the source or target terminal of the given edge depending on the value of the boolean parameter.
        Specified by:
        getTerminal in interface mxIGraphModel
        Parameters:
        edge - Cell that specifies the edge.
        isSource - Boolean indicating which end of the edge should be returned.
        Returns:
        Returns the source or target of the given edge.
      • setTerminal

        public java.lang.Object setTerminal(java.lang.Object edge,
                                            java.lang.Object terminal,
                                            boolean isSource)
        Description copied from interface: mxIGraphModel
        Sets the source or target terminal of the given edge using.
        Specified by:
        setTerminal in interface mxIGraphModel
        Parameters:
        edge - Cell that specifies the edge.
        terminal - Cell that specifies the new terminal.
        isSource - Boolean indicating if the terminal is the new source or target terminal of the edge.
        Returns:
        Returns the new terminal.
      • updateEdgeParents

        public void updateEdgeParents(java.lang.Object cell)
        Updates the parents of the edges connected to the given cell and all its descendants so that each edge is contained in the nearest common ancestor.
        Parameters:
        cell - Cell whose edges should be checked and updated.
      • updateEdgeParents

        public void updateEdgeParents(java.lang.Object cell,
                                      java.lang.Object root)
        Updates the parents of the edges connected to the given cell and all its descendants so that the edge is contained in the nearest-common-ancestor.
        Parameters:
        cell - Cell whose edges should be checked and updated.
        root - Root of the cell hierarchy that contains all cells.
      • updateEdgeParent

        public void updateEdgeParent(java.lang.Object edge,
                                     java.lang.Object root)
        Inner helper method to update the parent of the specified edge to the nearest-common-ancestor of its two terminals.
        Parameters:
        edge - Specifies the edge to be updated.
        root - Current root of the model.
      • getOrigin

        public mxPoint getOrigin(java.lang.Object cell)
        Returns the absolute, accumulated origin for the children inside the given parent.
      • getNearestCommonAncestor

        public java.lang.Object getNearestCommonAncestor(java.lang.Object cell1,
                                                         java.lang.Object cell2)
        Returns the nearest common ancestor for the specified cells.
        Parameters:
        cell1 - Cell that specifies the first cell in the tree.
        cell2 - Cell that specifies the second cell in the tree.
        Returns:
        Returns the nearest common ancestor of the given cells.
      • getEdgeCount

        public int getEdgeCount(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns the number of distinct edges connected to the given cell.
        Specified by:
        getEdgeCount in interface mxIGraphModel
        Parameters:
        cell - Cell that represents the vertex.
        Returns:
        Returns the number of edges connected to cell.
      • getEdgeAt

        public java.lang.Object getEdgeAt(java.lang.Object parent,
                                          int index)
        Description copied from interface: mxIGraphModel
        Returns the edge of cell at the given index.
        Specified by:
        getEdgeAt in interface mxIGraphModel
        Parameters:
        parent - Cell that specifies the vertex.
        index - Integer that specifies the index of the edge to return.
        Returns:
        Returns the edge at the given index.
      • isVertex

        public boolean isVertex(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns true if the given cell is a vertex.
        Specified by:
        isVertex in interface mxIGraphModel
        Parameters:
        cell - Cell that represents the possible vertex.
        Returns:
        Returns true if the given cell is a vertex.
      • isEdge

        public boolean isEdge(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns true if the given cell is an edge.
        Specified by:
        isEdge in interface mxIGraphModel
        Parameters:
        cell - Cell that represents the possible edge.
        Returns:
        Returns true if the given cell is an edge.
      • isConnectable

        public boolean isConnectable(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns true if the given cell is connectable.
        Specified by:
        isConnectable in interface mxIGraphModel
        Parameters:
        cell - Cell whose connectable state should be returned.
        Returns:
        Returns the connectable state of the given cell.
      • getValue

        public java.lang.Object getValue(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns the user object of the given cell.
        Specified by:
        getValue in interface mxIGraphModel
        Parameters:
        cell - Cell whose user object should be returned.
        Returns:
        Returns the user object of the given cell.
      • setValue

        public java.lang.Object setValue(java.lang.Object cell,
                                         java.lang.Object value)
        Description copied from interface: mxIGraphModel
        Sets the user object of then given cell.
        Specified by:
        setValue in interface mxIGraphModel
        Parameters:
        cell - Cell whose user object should be changed.
        value - Object that defines the new user object.
        Returns:
        Returns the new value.
      • getGeometry

        public mxGeometry getGeometry(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns the geometry of the given cell.
        Specified by:
        getGeometry in interface mxIGraphModel
        Parameters:
        cell - Cell whose geometry should be returned.
        Returns:
        Returns the geometry of the given cell.
      • setGeometry

        public mxGeometry setGeometry(java.lang.Object cell,
                                      mxGeometry geometry)
        Description copied from interface: mxIGraphModel
        Sets the geometry of the given cell.
        Specified by:
        setGeometry in interface mxIGraphModel
        Parameters:
        cell - Cell whose geometry should be changed.
        geometry - Object that defines the new geometry.
        Returns:
        Returns the new geometry.
      • getStyle

        public java.lang.String getStyle(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns the style of the given cell.
        Specified by:
        getStyle in interface mxIGraphModel
        Parameters:
        cell - Cell whose style should be returned.
        Returns:
        Returns the style of the given cell.
      • setStyle

        public java.lang.String setStyle(java.lang.Object cell,
                                         java.lang.String style)
        Description copied from interface: mxIGraphModel
        Sets the style of the given cell.
        Specified by:
        setStyle in interface mxIGraphModel
        Parameters:
        cell - Cell whose style should be changed.
        style - String of the form stylename[;key=value] to specify the new cell style.
        Returns:
        Returns the new style.
      • isCollapsed

        public boolean isCollapsed(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns true if the given cell is collapsed.
        Specified by:
        isCollapsed in interface mxIGraphModel
        Parameters:
        cell - Cell whose collapsed state should be returned.
        Returns:
        Returns the collapsed state of the given cell.
      • setCollapsed

        public boolean setCollapsed(java.lang.Object cell,
                                    boolean collapsed)
        Description copied from interface: mxIGraphModel
        Sets the collapsed state of the given cell.
        Specified by:
        setCollapsed in interface mxIGraphModel
        Parameters:
        cell - Cell whose collapsed state should be changed.
        collapsed - Boolean that specifies the new collpased state.
        Returns:
        Returns the new collapsed state.
      • isVisible

        public boolean isVisible(java.lang.Object cell)
        Description copied from interface: mxIGraphModel
        Returns true if the given cell is visible.
        Specified by:
        isVisible in interface mxIGraphModel
        Parameters:
        cell - Cell whose visible state should be returned.
        Returns:
        Returns the visible state of the given cell.
      • setVisible

        public boolean setVisible(java.lang.Object cell,
                                  boolean visible)
        Description copied from interface: mxIGraphModel
        Sets the visible state of the given cell.
        Specified by:
        setVisible in interface mxIGraphModel
        Parameters:
        cell - Cell whose visible state should be changed.
        visible - Boolean that specifies the new visible state.
        Returns:
        Returns the new visible state.
      • execute

        public void execute(mxIGraphModel.mxAtomicGraphModelChange change)
        Executes the given atomic change and adds it to the current edit.
        Parameters:
        change - Atomic change to be executed.
      • beginUpdate

        public void beginUpdate()
        Description copied from interface: mxIGraphModel
        Increments the updateLevel by one. The event notification is queued until updateLevel reaches 0 by use of endUpdate.
        Specified by:
        beginUpdate in interface mxIGraphModel
      • endUpdate

        public void endUpdate()
        Description copied from interface: mxIGraphModel
        Decrements the updateLevel by one and fires a notification event if the updateLevel reaches 0.
        Specified by:
        endUpdate in interface mxIGraphModel
      • mergeChildren

        public void mergeChildren(mxICell from,
                                  mxICell to,
                                  boolean cloneAllEdges)
                           throws java.lang.CloneNotSupportedException
        Merges the children of the given cell into the given target cell inside this model. All cells are cloned unless there is a corresponding cell in the model with the same id, in which case the source cell is ignored and all edges are connected to the corresponding cell in this model. Edges are considered to have no identity and are always cloned unless the cloneAllEdges flag is set to false, in which case edges with the same id in the target model are reconnected to reflect the terminals of the source edges.
        Parameters:
        from -
        to -
        cloneAllEdges -
        Throws:
        java.lang.CloneNotSupportedException
      • getDirectedEdgeCount

        public static int getDirectedEdgeCount(mxIGraphModel model,
                                               java.lang.Object cell,
                                               boolean outgoing)
        Returns the number of incoming or outgoing edges.
        Parameters:
        model - Graph model that contains the connection data.
        cell - Cell whose edges should be counted.
        outgoing - Boolean that specifies if the number of outgoing or incoming edges should be returned.
        Returns:
        Returns the number of incoming or outgoing edges.
      • getDirectedEdgeCount

        public static int getDirectedEdgeCount(mxIGraphModel model,
                                               java.lang.Object cell,
                                               boolean outgoing,
                                               java.lang.Object ignoredEdge)
        Returns the number of incoming or outgoing edges, ignoring the given edge.
        Parameters:
        model - Graph model that contains the connection data.
        cell - Cell whose edges should be counted.
        outgoing - Boolean that specifies if the number of outgoing or incoming edges should be returned.
        ignoredEdge - Object that represents an edge to be ignored.
        Returns:
        Returns the number of incoming or outgoing edges.
      • getEdges

        public static java.lang.Object[] getEdges(mxIGraphModel model,
                                                  java.lang.Object cell)
        Returns all edges connected to this cell including loops.
        Parameters:
        model - Model that contains the connection information.
        cell - Cell whose connections should be returned.
        Returns:
        Returns the array of connected edges for the given cell.
      • getConnections

        public static java.lang.Object[] getConnections(mxIGraphModel model,
                                                        java.lang.Object cell)
        Returns all edges connected to this cell without loops.
        Parameters:
        model - Model that contains the connection information.
        cell - Cell whose connections should be returned.
        Returns:
        Returns the connected edges for the given cell.
      • getIncomingEdges

        public static java.lang.Object[] getIncomingEdges(mxIGraphModel model,
                                                          java.lang.Object cell)
        Returns the incoming edges of the given cell without loops.
        Parameters:
        model - Graphmodel that contains the edges.
        cell - Cell whose incoming edges should be returned.
        Returns:
        Returns the incoming edges for the given cell.
      • getOutgoingEdges

        public static java.lang.Object[] getOutgoingEdges(mxIGraphModel model,
                                                          java.lang.Object cell)
        Returns the outgoing edges of the given cell without loops.
        Parameters:
        model - Graphmodel that contains the edges.
        cell - Cell whose outgoing edges should be returned.
        Returns:
        Returns the outgoing edges for the given cell.
      • getEdges

        public static java.lang.Object[] getEdges(mxIGraphModel model,
                                                  java.lang.Object cell,
                                                  boolean incoming,
                                                  boolean outgoing,
                                                  boolean includeLoops)
        Returns all distinct edges connected to this cell.
        Parameters:
        model - Model that contains the connection information.
        cell - Cell whose connections should be returned.
        incoming - Specifies if incoming edges should be returned.
        outgoing - Specifies if outgoing edges should be returned.
        includeLoops - Specifies if loops should be returned.
        Returns:
        Returns the array of connected edges for the given cell.
      • getEdgesBetween

        public static java.lang.Object[] getEdgesBetween(mxIGraphModel model,
                                                         java.lang.Object source,
                                                         java.lang.Object target)
        Returns all edges from the given source to the given target.
        Parameters:
        model - The graph model that contains the graph.
        source - Object that defines the source cell.
        target - Object that defines the target cell.
        Returns:
        Returns all edges from source to target.
      • getEdgesBetween

        public static java.lang.Object[] getEdgesBetween(mxIGraphModel model,
                                                         java.lang.Object source,
                                                         java.lang.Object target,
                                                         boolean directed)
        Returns all edges between the given source and target pair. If directed is true, then only edges from the source to the target are returned, otherwise, all edges between the two cells are returned.
        Parameters:
        model - The graph model that contains the graph.
        source - Object that defines the source cell.
        target - Object that defines the target cell.
        directed - Boolean that specifies if the direction of the edge should be taken into account.
        Returns:
        Returns all edges between the given source and target.
      • getOpposites

        public static java.lang.Object[] getOpposites(mxIGraphModel model,
                                                      java.lang.Object[] edges,
                                                      java.lang.Object terminal)
        Returns all opposite cells of terminal for the given edges.
        Parameters:
        model - Model that contains the connection information.
        edges - Array of edges to be examined.
        terminal - Cell that specifies the known end of the edges.
        Returns:
        Returns the opposite cells of the given terminal.
      • getOpposites

        public static java.lang.Object[] getOpposites(mxIGraphModel model,
                                                      java.lang.Object[] edges,
                                                      java.lang.Object terminal,
                                                      boolean sources,
                                                      boolean targets)
        Returns all opposite vertices wrt terminal for the given edges, only returning sources and/or targets as specified. The result is returned as an array of mxCells.
        Parameters:
        model - Model that contains the connection information.
        edges - Array of edges to be examined.
        terminal - Cell that specifies the known end of the edges.
        sources - Boolean that specifies if source terminals should be contained in the result. Default is true.
        targets - Boolean that specifies if target terminals should be contained in the result. Default is true.
        Returns:
        Returns the array of opposite terminals for the given edges.
      • setTerminals

        public static void setTerminals(mxIGraphModel model,
                                        java.lang.Object edge,
                                        java.lang.Object source,
                                        java.lang.Object target)
        Sets the source and target of the given edge in a single atomic change.
        Parameters:
        edge - Cell that specifies the edge.
        source - Cell that specifies the new source terminal.
        target - Cell that specifies the new target terminal.
      • getChildren

        public static java.lang.Object[] getChildren(mxIGraphModel model,
                                                     java.lang.Object parent)
        Returns all children of the given cell regardless of their type.
        Parameters:
        model - Model that contains the hierarchical information.
        parent - Cell whose child vertices or edges should be returned.
        Returns:
        Returns the child vertices and/or edges of the given parent.
      • getChildVertices

        public static java.lang.Object[] getChildVertices(mxIGraphModel model,
                                                          java.lang.Object parent)
        Returns the child vertices of the given parent.
        Parameters:
        model - Model that contains the hierarchical information.
        parent - Cell whose child vertices should be returned.
        Returns:
        Returns the child vertices of the given parent.
      • getChildEdges

        public static java.lang.Object[] getChildEdges(mxIGraphModel model,
                                                       java.lang.Object parent)
        Returns the child edges of the given parent.
        Parameters:
        model - Model that contains the hierarchical information.
        parent - Cell whose child edges should be returned.
        Returns:
        Returns the child edges of the given parent.
      • getChildCells

        public static java.lang.Object[] getChildCells(mxIGraphModel model,
                                                       java.lang.Object parent,
                                                       boolean vertices,
                                                       boolean edges)
        Returns the children of the given cell that are vertices and/or edges depending on the arguments. If both arguments are false then all children are returned regardless of their type.
        Parameters:
        model - Model that contains the hierarchical information.
        parent - Cell whose child vertices or edges should be returned.
        vertices - Boolean indicating if child vertices should be returned.
        edges - Boolean indicating if child edges should be returned.
        Returns:
        Returns the child vertices and/or edges of the given parent.
      • getParents

        public static java.lang.Object[] getParents(mxIGraphModel model,
                                                    java.lang.Object[] cells)
      • filterCells

        public static java.lang.Object[] filterCells(java.lang.Object[] cells,
                                                     mxGraphModel.Filter filter)
      • getDescendants

        public static java.util.Collection<java.lang.Object> getDescendants(mxIGraphModel model,
                                                                            java.lang.Object parent)
        Returns a all descendants of the given cell and the cell itself as a collection.
      • filterDescendants

        public static java.util.Collection<java.lang.Object> filterDescendants(mxIGraphModel model,
                                                                               mxGraphModel.Filter filter)
        Creates a collection of cells using the visitor pattern.
      • filterDescendants

        public static java.util.Collection<java.lang.Object> filterDescendants(mxIGraphModel model,
                                                                               mxGraphModel.Filter filter,
                                                                               java.lang.Object parent)
        Creates a collection of cells using the visitor pattern.
      • getTopmostCells

        public static java.lang.Object[] getTopmostCells(mxIGraphModel model,
                                                         java.lang.Object[] cells)
        Function: getTopmostCells Returns the topmost cells of the hierarchy in an array that contains no desceandants for each that it contains. Duplicates should be removed in the cells array to improve performance. Parameters: cells - Array of whose topmost ancestors should be returned.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.