org.jgraph.graph

Class GraphContext

public class GraphContext extends Object implements CellMapper

Field Summary
protected SetallCells
Set of all cells including all descendants.
protected intcellCount
Number of all descendants without ports.
protected Object[]cells
Reference to the cells.
protected SetcellSet
Set of all cells including all descendants.
protected JGraphgraph
Reference to the parent graph.
protected GraphLayoutCachegraphLayoutCache
Reference to the graphs GraphLayoutCache.
static booleanPREVIEW_EDGE_GROUPS
Switch to enable the preview of edge groups, that is, edges that 1 or more children, as part of the context cells.
protected Mapviews
Map of (cell, view) pairs including ports.
Constructor Summary
GraphContext(JGraph graph, Object[] cells)
Constructs a graph context for cells with respect to the connections defined in the model, and the views in the view of graph.
Method Summary
booleancontains(Object node)
Returns true if node or one of its ancestors is contained in this object and visible in the original graph.
CellViewcreateMapping(Object cell)
CellView[]createTemporaryCellViews()
Returns an new consistent array of views for cells.
CellView[]createTemporaryContextViews()
Returns an new consistent array of views for the edges that are connected to and not contained in cells.
CellView[]createTemporaryContextViews(Set cellSet)
Returns an new consistent array of views for the edges that are connected to and not contained in cellSet.
CellView[]createTemporaryPortViews()
Returns an new consistent array of views for the ports.
ConnectionSetdisconnect(CellView[] cells)
Disconnects the edges in cells from the sources and targets that are not in this context and returns a ConnectionSet that defines the disconnection.
Object[]getCells()
Returns the array that was passed to the constructor.
intgetDescendantCount()
Returns the number of all objects (cells and children) in this object.
JGraphgetGraph()
Returns the graph that was passed to the constructor.
CellViewgetMapping(Object cell, boolean create)
Returns the CellView that is mapped to cell in the graph context.
booleanisEmpty()
Returns true if this object contains no cells.
voidputMapping(Object cell, CellView view)
Associates cell with view in the graph context.

Field Detail

allCells

protected Set allCells
Set of all cells including all descendants.

cellCount

protected int cellCount
Number of all descendants without ports.

cells

protected Object[] cells
Reference to the cells.

cellSet

protected Set cellSet
Set of all cells including all descendants.

graph

protected JGraph graph
Reference to the parent graph.

graphLayoutCache

protected transient GraphLayoutCache graphLayoutCache
Reference to the graphs GraphLayoutCache.

PREVIEW_EDGE_GROUPS

public static boolean PREVIEW_EDGE_GROUPS
Switch to enable the preview of edge groups, that is, edges that 1 or more children, as part of the context cells.

views

protected Map views
Map of (cell, view) pairs including ports.

Constructor Detail

GraphContext

public GraphContext(JGraph graph, Object[] cells)
Constructs a graph context for cells with respect to the connections defined in the model, and the views in the view of graph.

Method Detail

contains

public boolean contains(Object node)
Returns true if node or one of its ancestors is contained in this object and visible in the original graph.

createMapping

public CellView createMapping(Object cell)

createTemporaryCellViews

public CellView[] createTemporaryCellViews()
Returns an new consistent array of views for cells.

createTemporaryContextViews

public CellView[] createTemporaryContextViews()
Returns an new consistent array of views for the edges that are connected to and not contained in cells.

createTemporaryContextViews

public CellView[] createTemporaryContextViews(Set cellSet)
Returns an new consistent array of views for the edges that are connected to and not contained in cellSet.

createTemporaryPortViews

public CellView[] createTemporaryPortViews()
Returns an new consistent array of views for the ports.

disconnect

public ConnectionSet disconnect(CellView[] cells)
Disconnects the edges in cells from the sources and targets that are not in this context and returns a ConnectionSet that defines the disconnection.

getCells

public Object[] getCells()
Returns the array that was passed to the constructor.

getDescendantCount

public int getDescendantCount()
Returns the number of all objects (cells and children) in this object.

getGraph

public JGraph getGraph()
Returns the graph that was passed to the constructor.

getMapping

public CellView getMapping(Object cell, boolean create)
Returns the CellView that is mapped to cell in the graph context. New views are created based on whether cell is contained in the context. The create-flag is ignored.

isEmpty

public boolean isEmpty()
Returns true if this object contains no cells.

putMapping

public void putMapping(Object cell, CellView view)
Associates cell with view in the graph context.
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.