org.eclipse.gef4.zest.core.widgets

## Class DAGExpandCollapseManager

- java.lang.Object
- - org.eclipse.gef4.zest.core.widgets.DAGExpandCollapseManager

All Implemented Interfaces:
  org.eclipse.gef4.layout.interfaces.ExpandCollapseManager

    public class DAGExpandCollapseManager
    extends java.lang.Object
    implements org.eclipse.gef4.layout.interfaces.ExpandCollapseManager

An `ExpandCollapseManager` specialized for Directed Acyclic Graphs. It works correctly only when all connections are directed (and of course nodes form an acyclic graph). It's supposed to be used with `InternalLayoutContext`.

When a node is collapsed, all its outgoing connections are hidden and these successors that have no visible incoming nodes are pruned. When a node is expanded, all its successors are unpruned and connections pointing to them are shown.

NOTE: A `Graph` using this manager should use `DefaultSubgraph`, which doesn't show any information about subgraphs in the graph. That's because for this manager it doesn't matter which subgraph a node belongs to (each pruning creates a new subgraph). Also, this manager adds a label to each collapsed node showing number of its successors.

One instance of this class can serve only one instance of `Graph`.

Since:
  2.0

### Constructor Summary

Constructors
Constructor and Description
`DAGExpandCollapseManager(boolean animate)`

### Method Summary

Methods
`boolean` `canCollapse(org.eclipse.gef4.layout.interfaces.LayoutContext context, org.eclipse.gef4.layout.interfaces.NodeLayout node)`
`boolean` `canExpand(org.eclipse.gef4.layout.interfaces.LayoutContext context, org.eclipse.gef4.layout.interfaces.NodeLayout node)`
`void` `initExpansion(org.eclipse.gef4.layout.interfaces.LayoutContext context)`
`void` `setExpanded(org.eclipse.gef4.layout.interfaces.LayoutContext context, org.eclipse.gef4.layout.interfaces.NodeLayout node, boolean expanded)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DAGExpandCollapseManager

    public DAGExpandCollapseManager(boolean animate)

Parameters:
  `animate` - if true, implicit animations are enabled (e.g. on layout changes)

### Method Detail

#### initExpansion

    public void initExpansion(org.eclipse.gef4.layout.interfaces.LayoutContext context)

Specified by:
  `initExpansion` in interface `org.eclipse.gef4.layout.interfaces.ExpandCollapseManager`

#### canCollapse

    public boolean canCollapse(org.eclipse.gef4.layout.interfaces.LayoutContext context,
                      org.eclipse.gef4.layout.interfaces.NodeLayout node)

Specified by:
  `canCollapse` in interface `org.eclipse.gef4.layout.interfaces.ExpandCollapseManager`

#### canExpand

    public boolean canExpand(org.eclipse.gef4.layout.interfaces.LayoutContext context,
                    org.eclipse.gef4.layout.interfaces.NodeLayout node)

Specified by:
  `canExpand` in interface `org.eclipse.gef4.layout.interfaces.ExpandCollapseManager`

#### setExpanded

    public void setExpanded(org.eclipse.gef4.layout.interfaces.LayoutContext context,
                   org.eclipse.gef4.layout.interfaces.NodeLayout node,
                   boolean expanded)

Specified by:
  `setExpanded` in interface `org.eclipse.gef4.layout.interfaces.ExpandCollapseManager`