Package org.jgraph.graph
Class GraphContext
- java.lang.Object
-
- org.jgraph.graph.GraphContext
-
- All Implemented Interfaces:
CellMapper
public class GraphContext extends java.lang.Object implements CellMapper
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.SetallCellsSet of all cells including all descendants.protected intcellCountNumber of all descendants without ports.protected java.lang.Object[]cellsReference to the cells.protected java.util.SetcellSetSet of all cells including all descendants.protected JGraphgraphReference to the parent graph.protected GraphLayoutCachegraphLayoutCacheReference to the graphs GraphLayoutCache.static booleanPREVIEW_EDGE_GROUPSSwitch to enable the preview of edge groups, that is, edges that 1 or more children, as part of the context cells.protected java.util.MapviewsMap of (cell, view) pairs including ports.
-
Constructor Summary
Constructors Constructor Description GraphContext(JGraph graph, java.lang.Object[] cells)Constructs a graph context forcellswith respect to the connections defined in the model, and the views in the view ofgraph.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(java.lang.Object node)Returnstrueifnodeor one of its ancestors is contained in this object and visible in the original graph.CellViewcreateMapping(java.lang.Object cell)CellView[]createTemporaryCellViews()Returns an new consistent array of views forcells.CellView[]createTemporaryContextViews()Returns an new consistent array of views for the edges that are connected to and not contained incells.CellView[]createTemporaryContextViews(java.util.Set cellSet)Returns an new consistent array of views for the edges that are connected to and not contained incellSet.CellView[]createTemporaryPortViews()Returns an new consistent array of views for the ports.ConnectionSetdisconnect(CellView[] cells)Disconnects the edges incellsfrom the sources and targets that are not in this context and returns a ConnectionSet that defines the disconnection.java.lang.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(java.lang.Object cell, boolean create)Returns theCellViewthat is mapped tocellin the graph context.booleanisEmpty()Returnstrueif this object contains no cells.voidputMapping(java.lang.Object cell, CellView view)Associatescellwithviewin the graph context.
-
-
-
Field Detail
-
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.
-
graph
protected JGraph graph
Reference to the parent graph.
-
graphLayoutCache
protected transient GraphLayoutCache graphLayoutCache
Reference to the graphs GraphLayoutCache.
-
cells
protected java.lang.Object[] cells
Reference to the cells.
-
allCells
protected java.util.Set allCells
Set of all cells including all descendants.
-
cellSet
protected java.util.Set cellSet
Set of all cells including all descendants.
-
cellCount
protected int cellCount
Number of all descendants without ports.
-
views
protected java.util.Map views
Map of (cell, view) pairs including ports.
-
-
Constructor Detail
-
GraphContext
public GraphContext(JGraph graph, java.lang.Object[] cells)
Constructs a graph context forcellswith respect to the connections defined in the model, and the views in the view ofgraph.
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Returnstrueif this object contains no cells.
-
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.
-
getCells
public java.lang.Object[] getCells()
Returns the array that was passed to the constructor.
-
contains
public boolean contains(java.lang.Object node)
Returnstrueifnodeor one of its ancestors is contained in this object and visible in the original graph.
-
createTemporaryCellViews
public CellView[] createTemporaryCellViews()
Returns an new consistent array of views forcells.
-
createTemporaryPortViews
public CellView[] createTemporaryPortViews()
Returns an new consistent array of views for the ports.
-
createTemporaryContextViews
public CellView[] createTemporaryContextViews()
Returns an new consistent array of views for the edges that are connected to and not contained incells.
-
createTemporaryContextViews
public CellView[] createTemporaryContextViews(java.util.Set cellSet)
Returns an new consistent array of views for the edges that are connected to and not contained incellSet.
-
getMapping
public CellView getMapping(java.lang.Object cell, boolean create)
Returns theCellViewthat is mapped tocellin the graph context. New views are created based on whether cell is contained in the context. Thecreate-flag is ignored.- Specified by:
getMappingin interfaceCellMappercreate- whether a new view should created if a view does not already exist
-
createMapping
public CellView createMapping(java.lang.Object cell)
-
disconnect
public ConnectionSet disconnect(CellView[] cells)
Disconnects the edges incellsfrom the sources and targets that are not in this context and returns a ConnectionSet that defines the disconnection.
-
putMapping
public void putMapping(java.lang.Object cell, CellView view)Associatescellwithviewin the graph context.- Specified by:
putMappingin interfaceCellMapper- Parameters:
cell- the cell that constitutes the model elementview- the view that constitutes the view element
-
-