Class JGraphModelFacade

java.lang.Object
com.jgraph.layout.JGraphFacade
com.jgraph.layout.JGraphModelFacade

public class JGraphModelFacade extends JGraphFacade
An abstract description of a graph that can be used by a layout algorithm. This abstracts visibility, grouping, directed edges, any root cells, translation and scaling functions. It also stores the actual graph to be acted upon by the layout and provides utility method to determine the characteristics of the contained cells. After the layout has been applied this class stores the result of that layout as a nested attribute map.
  • Constructor Details

    • JGraphModelFacade

      public JGraphModelFacade(GraphModel model)
      Constructs a JGraphGraphFacade specifying the graph passed in as the input graph
      Parameters:
      model - the GraphModel to be laid out
    • JGraphModelFacade

      public JGraphModelFacade(GraphModel model, Object[] roots)
      Constructs a JGraphGraphFacade specifying the graph passed in as the input graph
      Parameters:
      model - the JGraph to be laid out
      roots - the root vertices to be used by tree layouts. This is not the same thing as the roots of the graph model.
    • JGraphModelFacade

      public JGraphModelFacade(GraphModel model, Object[] roots, boolean ignoresHiddenCells, boolean ignoresCellsInGroups, boolean ignoresUnconnectedCells, boolean directed)
      Constructs a JGraphGraphFacade
      See Also:
    • JGraphModelFacade

      public JGraphModelFacade(GraphModel model, Object[] roots, boolean ignoresHiddenCells, boolean ignoresCellsInGroups, boolean ignoresUnconnectedCells, boolean directed, JGraphCostFunction distanceCostFunction, JGraphAlgebra algebra)
      Creates a JGraphGraphFacade specifying the graph passed in as the input graph. Also configures properties of layout, whether or not edge direction is to be taken into account, whether or not invisible cells are to be considered and whether or not only root cells are to be considered or roots and all their children. A root is only used if the isVertex method returns true.
      Parameters:
      model - The graph used as input to the layout
      roots - the root vertices to be used by tree layouts
      ignoresHiddenCells -
      ignoresCellsInGroups -
      ignoresUnconnectedCells -
      directed -
      distanceCostFunction - the cost function that defines the distance metrics
      algebra - the algebra used for basic algorithms and functions
      See Also:
  • Method Details

    • getNeighbours

      public List getNeighbours(Object cell, boolean ordered)
      A shortcut method that calls getNeighbours with no cells to exclude.
      Overrides:
      getNeighbours in class JGraphFacade
      See Also:
    • getNeighbours

      public List getNeighbours(Object cell, Set exclude, boolean ordered)
      Returns a collection of cells that are connected to the specified cell by edges. Any cells specified in the exclude set will be ignored.
      Overrides:
      getNeighbours in class JGraphFacade
      Parameters:
      cell - The cell from which the neighbours will be determined
      exclude - The set of cells to ignore when searching
      ordered - whether or not to order the returned value in the order of the current order comparator. Be very careful using the default comparator on the default graph model, getIndexOfRoot has linear performance and so sorting the entire model roots will have quadratic performance.
      Returns:
      Returns the set of neighbours for cell
    • getOutgoingEdges

      public List getOutgoingEdges(Object cell, Set exclude, boolean visibleCells, boolean selfLoops)
      Returns the outgoing edges for cell. Cell should be a port or a vertex.
      Overrides:
      getOutgoingEdges in class JGraphFacade
      Parameters:
      cell - The cell from which the outgoing edges will be determined
      exclude - The set of edges to ignore when searching
      visibleCells - whether or not only visible cells should be processed
      selfLoops - whether or not to include self loops in the returned list
      Returns:
      Returns the list of outgoing edges for cell
    • getIncomingEdges

      public List getIncomingEdges(Object cell, Set exclude, boolean visibleCells, boolean selfLoops)
      Returns the incoming edges for cell. Cell should be a port or a vertex.
      Overrides:
      getIncomingEdges in class JGraphFacade
      Parameters:
      cell - The cell from which the incoming edges will be determined
      exclude - The set of edges to ignore when searching
      visibleCells - whether or not only visible cells should be processed
      selfLoops - whether or not to include self loops in the returned list
      Returns:
      Returns the list of incoming edges for cell
    • getGraphBounds

      public Rectangle2D getGraphBounds()
      Returns the minimal rectangular bounds that enclose all the elements in the bounds map. After a layout has completed this method will return the collective bounds of the new laid out graph.
      Overrides:
      getGraphBounds in class JGraphFacade
      Returns:
      null