Class DAGExpandCollapseManager

java.lang.Object
org.eclipse.zest.core.widgets.DAGExpandCollapseManager
All Implemented Interfaces:
ExpandCollapseManager

public class DAGExpandCollapseManager extends Object implements 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:
1.14
  • Constructor Details

    • DAGExpandCollapseManager

      public DAGExpandCollapseManager()
  • Method Details

    • initExpansion

      public void initExpansion(LayoutContext context2)
      Description copied from interface: ExpandCollapseManager
      Initializes the expansion state of all nodes in given layout context. The receiver can initialize its internal state related to the layout context and add its listeners if necessary.
      Specified by:
      initExpansion in interface ExpandCollapseManager
      Parameters:
      context2 - the context to initialize
    • canCollapse

      public boolean canCollapse(LayoutContext context, NodeLayout node)
      Description copied from interface: ExpandCollapseManager
      Checks if given node can be collapsed.
      Specified by:
      canCollapse in interface ExpandCollapseManager
      Parameters:
      context - context containing the node
      node - node to check
    • canExpand

      public boolean canExpand(LayoutContext context, NodeLayout node)
      Description copied from interface: ExpandCollapseManager
      Checks if given node can be expanded.
      Specified by:
      canExpand in interface ExpandCollapseManager
      Parameters:
      context - context containing the node
      node - node to check
    • setExpanded

      public void setExpanded(LayoutContext context, NodeLayout node, boolean expanded)
      Description copied from interface: ExpandCollapseManager
      Changes the expanded state of given node. It prunes/unprunes nodes and hides/shows connections in the graph according to its policy. If requested operation cannot be currently performed on the node, it does nothing.
      Specified by:
      setExpanded in interface ExpandCollapseManager
      Parameters:
      context - context in which to perform the operation
      node - node to expand or collapse
      expanded - true to expand, false to collapse