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.
Graph
.Constructor and Description |
---|
DAGExpandCollapseManager(boolean animate) |
Modifier and Type | Method and Description |
---|---|
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) |
public DAGExpandCollapseManager(boolean animate)
animate
- if true, implicit animations are enabled (e.g. on layout
changes)public void initExpansion(org.eclipse.gef4.layout.interfaces.LayoutContext context)
initExpansion
in interface org.eclipse.gef4.layout.interfaces.ExpandCollapseManager
public boolean canCollapse(org.eclipse.gef4.layout.interfaces.LayoutContext context, org.eclipse.gef4.layout.interfaces.NodeLayout node)
canCollapse
in interface org.eclipse.gef4.layout.interfaces.ExpandCollapseManager
public boolean canExpand(org.eclipse.gef4.layout.interfaces.LayoutContext context, org.eclipse.gef4.layout.interfaces.NodeLayout node)
canExpand
in interface org.eclipse.gef4.layout.interfaces.ExpandCollapseManager
public void setExpanded(org.eclipse.gef4.layout.interfaces.LayoutContext context, org.eclipse.gef4.layout.interfaces.NodeLayout node, boolean expanded)
setExpanded
in interface org.eclipse.gef4.layout.interfaces.ExpandCollapseManager
Copyright (c) 2014 itemis AG and others. All rights reserved.