Class DAGExpandCollapseManager
- All Implemented 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.
Graph
.- Since:
- 1.14
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canCollapse
(LayoutContext context, NodeLayout node) Checks if given node can be collapsed.boolean
canExpand
(LayoutContext context, NodeLayout node) Checks if given node can be expanded.void
initExpansion
(LayoutContext context2) Initializes the expansion state of all nodes in given layout context.void
setExpanded
(LayoutContext context, NodeLayout node, boolean expanded) Changes the expanded state of given node.
-
Constructor Details
-
DAGExpandCollapseManager
public DAGExpandCollapseManager()
-
-
Method Details
-
initExpansion
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 interfaceExpandCollapseManager
- Parameters:
context2
- the context to initialize
-
canCollapse
Description copied from interface:ExpandCollapseManager
Checks if given node can be collapsed.- Specified by:
canCollapse
in interfaceExpandCollapseManager
- Parameters:
context
- context containing the nodenode
- node to check
-
canExpand
Description copied from interface:ExpandCollapseManager
Checks if given node can be expanded.- Specified by:
canExpand
in interfaceExpandCollapseManager
- Parameters:
context
- context containing the nodenode
- node to check
-
setExpanded
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 interfaceExpandCollapseManager
- Parameters:
context
- context in which to perform the operationnode
- node to expand or collapseexpanded
- true to expand, false to collapse
-