documentationfor yFiles for HTML 2.6

IFoldingView

Interface that is used for manipulating a managed view of an IGraph that supports folding operations like expanding and collapsing of nodes.

Inheritance Hierarchy
IFoldingView
Implemented Interfaces

Remarks

Folding is an extension to the grouping concept. It adds the functionality of collapsing (closing) and expanding (opening) group nodes. Collapsing a group node means that its content is hidden and the group node itself becomes a normal (i.e. non-group or leaf) node.

In yFiles folding works with two graph instances: a master graph which is is the complete unfolded graph and the so called view graph which supports collapsing and expanding. This view graph is a modified and managed copy of the master graph. To make sure that the state of both graphs is correctly synchronized, yFiles provides the types FoldingManager and the IFoldingView.

The IFoldingView stores the view graph and manages the mapping from elements of the master graph to elements in the view graph and vice versa. Typically nodes and edges are being copied from the masterGraph and they share many of their properties by reference (e.g. style). However if group nodes are being represented by collapsed group nodes in this view, they maintain a separate set of labels, ports, bends, and geometry. This view-local state is shared between all views that have been created by the same manager and can be obtained and modified via the FoldingManager's methods getFoldingEdgeState for folding edges and getFolderNodeState for folder nodes in the absence of a corresponding IFoldingView view instance.

Developers should never implement this interface themselves. Rather, an implementation is provided by the framework and can be obtained from the FoldingManager's method createFoldingView. This implementation provides a folding-enabled IGraph implementation in its graph property:

Setting up folding
// first create the manager
const manager = new FoldingManager()
// the manager serves as factory to create views
const foldingView = manager.createFoldingView()
// each view contains a folding-enabled graph: the view graph
const viewGraph = foldingView.graph
// the view graph is the graph which should actually be displayed
graphComponent.graph = viewGraph

For folding enabled graphs foldingView always returns the IFoldingView implementation which manages the graph:

Obtaining an IFoldingView from an IGraph
const foldingView = viewGraph.foldingView

This interface extends the IPropertyObservable interface. This can be used to easily monitor the validity of this view. Also changes to the localRoot property will be published via this event.

Related Reading in the Developer's Guide

A brief description of the interface's API and some usage aspects is given in the section Working with Folding. Class FoldingManager's central role for folding support in general is discussed in the section Folding Revisited.

Type Details

yfiles module
view-component
yfiles-umd modules
All view modules
Legacy UMD name
yfiles.graph.IFoldingView

See Also

Properties

Methods

Events