JGraphLayout
v1.4.0.2


com.jgraph.layout
Class JGraphModelFacade

java.lang.Object
  extended bycom.jgraph.layout.JGraphFacade
      extended bycom.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.


Nested Class Summary
 
Nested classes inherited from class com.jgraph.layout.JGraphFacade
JGraphFacade.CellVisitor, JGraphFacade.DefaultComparator
 
Field Summary
 
Fields inherited from class com.jgraph.layout.JGraphFacade
algebra, attributes, circleRadiusFactor, directed, distanceCostFunction, edgePromotion, graph, graphLayoutCache, groupHierarchies, ignoresCellsInGroups, ignoresHiddenCells, ignoresUnconnectedCells, model, order, ordered, roots, verticesFilter
 
Constructor Summary
JGraphModelFacade(org.jgraph.graph.GraphModel model)
          Constructs a JGraphGraphFacade specifying the graph passed in as the input graph
JGraphModelFacade(org.jgraph.graph.GraphModel model, Object[] roots)
          Constructs a JGraphGraphFacade specifying the graph passed in as the input graph
JGraphModelFacade(org.jgraph.graph.GraphModel model, Object[] roots, boolean ignoresHiddenCells, boolean ignoresCellsInGroups, boolean ignoresUnconnectedCells, boolean directed)
          Constructs a JGraphGraphFacade
JGraphModelFacade(org.jgraph.graph.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.
 
Method Summary
 Object[] getEdgesBetween(Object cell1, Object cell2, boolean directed)
          Returns the edges between two specified ports or two specified vertices.
 Rectangle2D getGraphBounds()
          Returns the minimal rectangular bounds that enclose all the elements in the bounds map.
 List getIncomingEdges(Object cell, Set exclude, boolean visibleCells, boolean selfLoops)
          Returns the incoming edges for cell.
 List getNeighbours(Object cell, boolean ordered)
          A shortcut method that calls getNeighbours with no cells to exclude.
 List getNeighbours(Object cell, Set exclude, boolean ordered)
          Returns a collection of cells that are connected to the specified cell by edges.
 List getOutgoingEdges(Object cell, Set exclude, boolean visibleCells, boolean selfLoops)
          Returns the outgoing edges for cell.
 boolean isEdge(Object cell)
          Returns whether or not the specified cell is an edge and should be taken into account by the layout
 boolean isVertex(Object cell)
          Returns whether or not the specified cell is a vertex and should be taken into account by the layout
 
Methods inherited from class com.jgraph.layout.JGraphFacade
bfs, circle, createNestedMap, createNestedMap, createNestedMap, determineLayoutHierarchies, dfs, dfs, dfs, disableRouting, findTreeRoots, getAll, getAttributes, getAttributes, getBounds, getBounds, getBounds, getCellBounds, getCells, getCellView, getCircleRadiusFactor, getComponents, getConnectionComponents, getDistance, getEdges, getEdges, getEdges, getGraphOrigin, getGroupHierarchies, getLength, getLocation, getLocations, getMaxSize, getMinimumSpanningTree, getOrder, getPath, getPoints, getRootAt, getRootCount, getRoots, getSize, getSource, getSourcePort, getTarget, getTargetPort, getUnconnectedVertices, getVertices, getVertices, getVerticesFilter, isDirected, isEdgePromotion, IsIgnoresCellsInGroups, isIgnoresHiddenCells, isIgnoresUnconnectedCells, isMoveable, isOrdered, isRoot, norm, populateGroupHierarchies, randomize, resetControlPoints, resetControlPoints, run, scale, scale, setAttributes, setAttributes, setBounds, setBounds, setBounds, setCircleRadiusFactor, setDirected, setEdgePromotion, setGroupHierarchies, setIgnoresCellsInGroups, setIgnoresHiddenCells, setIgnoresUnconnectedCells, setLocation, setLocation, setLocations, setLoggerLevel, setOrder, setOrdered, setPoints, setRoots, setSize, setVerticesFilter, tilt, translate, translateCells
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JGraphModelFacade

public JGraphModelFacade(org.jgraph.graph.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(org.jgraph.graph.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(org.jgraph.graph.GraphModel model,
                         Object[] roots,
                         boolean ignoresHiddenCells,
                         boolean ignoresCellsInGroups,
                         boolean ignoresUnconnectedCells,
                         boolean directed)
Constructs a JGraphGraphFacade

See Also:
JGraphModelFacade(GraphModel, Object[], boolean, boolean, boolean, boolean, JGraphCostFunction, JGraphAlgebra)

JGraphModelFacade

public JGraphModelFacade(org.jgraph.graph.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:
isVertex(java.lang.Object), JGraphFacade.ignoresHiddenCells, JGraphFacade.ignoresCellsInGroups, JGraphFacade.ignoresUnconnectedCells, JGraphFacade.directed
Method Detail

isVertex

public boolean isVertex(Object cell)
Returns whether or not the specified cell is a vertex and should be taken into account by the layout

Overrides:
isVertex in class JGraphFacade
Parameters:
cell - the cell that is to be classified as a vertex or not
Returns:
Returns true if cell is a vertex

isEdge

public boolean isEdge(Object cell)
Returns whether or not the specified cell is an edge and should be taken into account by the layout

Overrides:
isEdge in class JGraphFacade
Parameters:
cell - the cell that is to be classified as an edge or not
Returns:
Returns true if the cell is an edge

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(Object, Set, boolean)

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

getEdgesBetween

public Object[] getEdgesBetween(Object cell1,
                                Object cell2,
                                boolean directed)
Returns the edges between two specified ports or two specified vertices. If directed is true then cell1 must be the source of the returned edges.

Overrides:
getEdgesBetween in class JGraphFacade
Parameters:
cell1 - the first of the pair of cells to find edges between
cell2 - the second of the pair of cells to find edges between
directed - whether or not only edges going from cell1 to cell2 should be returned and not edges in the other direction

JGraphLayout
v1.4.0.2


Copyright (C) 2005 JGraph.com. All rights reserved.