In a graph hierarchy, i.e., a graph with support for grouping and nesting, class
HierarchyManager
is responsible for maintaining the underlying model, and managing all changes relevant to it.
To this end, HierarchyManager strongly relies on graph events.
When using the services of class
GraphHider
or method
Graph.hide()
to hide nodes, however, there are no graph events fired that indicate modifications of the graph structure.
Hence HierarchyManager cannot reflect the change, and the nodes are still in the model.
| Note |
|
Beginning with yFiles version 2.2, class
DefaultGraph2DRenderer ,
which renders the visual representations of graph elements, uses the HierarchyManager object that is associated with a graph to determine the set of nodes to be painted.
|
To make sure that HierarchyManager gets proper notification whenever nodes are hidden from the graph structure, there are several possibilities to have graph events appropriately fired:
-
When using the services of class GraphHider to hide nodes, it should be configured via the setter method
setFireGraphEventsEnabled(boolean)
.
-
Instead of hiding nodes from the graph, they should be removed using method
Graph.removeNode()
.
Note that removing a node is the same as hiding it, however, proper graph events are fired.
-
Instead of unhiding nodes from the graph, they should be reinserted using method
Graph.reInsertNode()
.
Note that reinserting a node is the same as unhiding it, however, proper graph events are fired.
| Note |
|
As an alternative to firing GraphEvents when using GraphHider, it is also possible to use a customized implementation of interface
Graph2DRenderer
that does not draw hidden nodes.
|