Package org.jgraph.graph
Class GraphContext
java.lang.Object
org.jgraph.graph.GraphContext
- All Implemented Interfaces:
CellMapper
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Set
Set of all cells including all descendants.protected int
Number of all descendants without ports.protected Object[]
Reference to the cells.protected Set
Set of all cells including all descendants.protected JGraph
Reference to the parent graph.protected GraphLayoutCache
Reference to the graphs GraphLayoutCache.static boolean
Switch to enable the preview of edge groups, that is, edges that 1 or more children, as part of the context cells.protected Map
Map of (cell, view) pairs including ports. -
Constructor Summary
ConstructorsConstructorDescriptionGraphContext
(JGraph graph, Object[] cells) Constructs a graph context forcells
with respect to the connections defined in the model, and the views in the view ofgraph
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returnstrue
ifnode
or 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 incells
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.int
Returns 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 theCellView
that is mapped tocell
in the graph context.boolean
isEmpty()
Returnstrue
if this object contains no cells.void
putMapping
(Object cell, CellView view) Associatescell
withview
in 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 forcells
with respect to the connections defined in the model, and the views in the view ofgraph
.
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returnstrue
if 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
Returnstrue
ifnode
or 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 theCellView
that is mapped tocell
in the graph context. New views are created based on whether cell is contained in the context. Thecreate
-flag is ignored.- Specified by:
getMapping
in interfaceCellMapper
create
- whether a new view should created if a view does not already exist
-
createMapping
-
disconnect
Disconnects the edges incells
from the sources and targets that are not in this context and returns a ConnectionSet that defines the disconnection. -
putMapping
Associatescell
withview
in the graph context.- Specified by:
putMapping
in interfaceCellMapper
- Parameters:
cell
- the cell that constitutes the model elementview
- the view that constitutes the view element
-