public class GraphPartitionManager extends Object
This class can be used to temporarily hide away certain elements of a graph and to unhide that parts at a later time again. Instances of this class keep track of graph elements that were hidden from a graph in order to make them visible again at a later time.
Note that this class should not be used to hide elements from a Graph2D for pure hiding purposes. Since this class will by default prevent the graph instance from firing events, other code might cease to work correctly. Use this class for short term removal of nodes and edges, only.
Constructor and Description |
---|
GraphPartitionManager(Graph graph,
IDataProvider partitionId)
Instantiates a new GraphPartitionManager for the given graph.
|
Modifier and Type | Method and Description |
---|---|
void |
displayPartition(Object partitionId)
Assures that only nodes are visible in the graph that are associated with the given partitionId.
|
Graph |
getGraph()
Gets the
Graph for which this partition manager was created. |
void |
hide(Edge e)
Hides the given edge from the graph.
|
void |
hide(EdgeList el)
Hides the given list of edges from the graph.
|
void |
hide(ICursor cursor)
Hides the given elements from the graph.
|
void |
hide(IEdgeCursor ec)
Hides the given edges from the graph.
|
void |
hide(INodeCursor nc)
Hides the given nodes from the graph.
|
void |
hide(Node v)
Hides the given node and all it's adjacent edges from the graph.
|
void |
hide(NodeList nl)
Hides the given list of nodes from the graph.
|
void |
hideAll()
Hides all nodes and edges from this graph.
|
void |
hideEdges()
Hides all edges from this graph.
|
void |
hideMultipleEdges()
Hides multiple edges from the graph.
|
void |
hidePartition(Object partitionId)
Hides nodes and adjacent edges that have the given partitionId associated.
|
void |
hideSelfLoops()
Hides all self-loop edges from this graph.
|
void |
initPartitions(IDataProvider partitionId)
Initializes internal data structures using the new DataProvider.
|
boolean |
isFiringGraphEventsEnabled()
Gets whether or not this partition manager should fire graph events.
|
void |
setFiringGraphEventsEnabled(boolean value)
Sets whether or not this partition manager should fire graph events.
|
void |
simplifyGraph()
Hides all self-loops and multiple edges from the graph.
|
protected void |
unhide(Edge e)
This method will be called whenever the partition manager is requested to unhide the given edge from the graph.
|
protected void |
unhide(Node v)
This method will be called whenever the partition manager is requested to unhide the given node from the graph.
|
void |
unhideAll()
Unhides all formerly hidden elements in the graph.
|
void |
unhideEdges()
Unhides all formerly hidden edges in the graph.
|
void |
unhideNodes()
Unhides all formerly hidden nodes in the graph.
|
void |
unhidePartition(Object partitionId)
Unhides nodes that have the given partitionId associated.
|
public GraphPartitionManager(Graph graph, IDataProvider partitionId)
All non-static hiding and unhiding methods will refer to the given graph.
public void displayPartition(Object partitionId)
partitionId
- the partitionId for the nodes that will be made visiblepublic Graph getGraph()
Graph
for which this partition manager was created.Graph
for which this partition manager was created.public void hide(Edge e)
The hidden edge will be stored so that they can be unhidden again at a later time.
public void hide(EdgeList el)
The hidden edges will be stored so that they can be unhidden again at a later time.
public void hide(ICursor cursor)
The hidden nodes and adjacent edges will be stored so that they can be unhidden again at a later time.
public void hide(IEdgeCursor ec)
The hidden edges will be stored so that they can be unhidden again at a later time.
public void hide(INodeCursor nc)
The hidden nodes and adjacent edges will be stored so that they can be unhidden again at a later time.
public void hide(Node v)
The hidden elements will be stored so that they can be unhidden again at a later time.
public void hide(NodeList nl)
The hidden nodes and adjacent edges will be stored so that they can be unhidden again at a later time.
public void hideAll()
The hidden elements will be stored so that they can be unhidden again at a later time.
public void hideEdges()
The hidden edges will be stored so that they can be unhidden again at a later time.
public void hideMultipleEdges()
If there are multiple edges connecting two nodes then all but one (representative) of these edges will be hidden. The hidden edges will be stored so that they can be unhidden again at a later time.
public void hidePartition(Object partitionId)
partitionId
- the idpublic void hideSelfLoops()
The hidden edges will be stored so that they can be unhidden again at a later time.
public void initPartitions(IDataProvider partitionId)
This method must also be called whenever the content of the given DataProvider changes.
partitionId
- the data provider that holds the partitionIds for all elements.public boolean isFiringGraphEventsEnabled()
By default the partition manager does not fire graph events.
setFiringGraphEventsEnabled(boolean)
public void setFiringGraphEventsEnabled(boolean value)
By default the partition manager does not fire graph events.
value
- The FiringGraphEventsEnabled to set.isFiringGraphEventsEnabled()
public void simplifyGraph()
The overall effect of this method is that the minimum number of edges are hidden from the graph such that it contains no self-loops and no multiple edges anymore. The hidden edges will be stored so that they can be unhidden again at a later time.
protected void unhide(Edge e)
protected void unhide(Node v)
public void unhideAll()
public void unhideEdges()
public void unhideNodes()
Note that this method does not unhide hidden edges.
public void unhidePartition(Object partitionId)
partitionId
- the id