Package org.jgraph.graph
Class GraphContext
java.lang.Object
org.jgraph.graph.GraphContext
- All Implemented Interfaces:
CellMapper
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SetSet of all cells including all descendants.protected intNumber of all descendants without ports.protected Object[]Reference to the cells.protected SetSet of all cells including all descendants.protected JGraphReference to the parent graph.protected GraphLayoutCacheReference to the graphs GraphLayoutCache.static booleanSwitch to enable the preview of edge groups, that is, edges that 1 or more children, as part of the context cells.protected MapMap of (cell, view) pairs including ports. -
Constructor Summary
ConstructorsConstructorDescriptionGraphContext(JGraph graph, Object[] cells) Constructs a graph context forcellswith respect to the connections defined in the model, and the views in the view ofgraph. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueifnodeor one of its ancestors is contained in this object and visible in the original graph.createMapping(Object cell) CellView[]Returns an new consistent array of views forcells.CellView[]Returns an new consistent array of views for the edges that are connected to and not contained incells.CellView[]createTemporaryContextViews(Set cellSet) Returns an new consistent array of views for the edges that are connected to and not contained incellSet.CellView[]Returns an new consistent array of views for the ports.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.Object[]getCells()Returns the array that was passed to the constructor.intReturns the number of all objects (cells and children) in this object.getGraph()Returns the graph that was passed to the constructor.getMapping(Object cell, boolean create) Returns theCellViewthat is mapped tocellin the graph context.booleanisEmpty()Returnstrueif this object contains no cells.voidputMapping(Object cell, CellView view) Associatescellwithviewin the graph context.
-
Field Details
-
PREVIEW_EDGE_GROUPS
public static boolean PREVIEW_EDGE_GROUPSSwitch to enable the preview of edge groups, that is, edges that 1 or more children, as part of the context cells. -
graph
Reference to the parent graph. -
graphLayoutCache
Reference to the graphs GraphLayoutCache. -
cells
Reference to the cells. -
allCells
Set of all cells including all descendants. -
cellSet
Set of all cells including all descendants. -
cellCount
protected int cellCountNumber of all descendants without ports. -
views
Map of (cell, view) pairs including ports.
-
-
Constructor Details
-
GraphContext
Constructs a graph context forcellswith respect to the connections defined in the model, and the views in the view ofgraph.
-
-
Method Details
-
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
Returns the graph that was passed to the constructor. -
getCells
Returns the array that was passed to the constructor. -
contains
Returnstrueifnodeor one of its ancestors is contained in this object and visible in the original graph. -
createTemporaryCellViews
Returns an new consistent array of views forcells. -
createTemporaryPortViews
Returns an new consistent array of views for the ports. -
createTemporaryContextViews
Returns an new consistent array of views for the edges that are connected to and not contained incells. -
createTemporaryContextViews
Returns an new consistent array of views for the edges that are connected to and not contained incellSet. -
getMapping
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
-
disconnect
Disconnects the edges incellsfrom the sources and targets that are not in this context and returns a ConnectionSet that defines the disconnection. -
putMapping
Associatescellwithviewin the graph context.- Specified by:
putMappingin interfaceCellMapper- Parameters:
cell- the cell that constitutes the model elementview- the view that constitutes the view element
-