Class GraphTopologyHandler
java.lang.Object
org.jppf.ui.monitoring.node.graph.GraphTopologyHandler
- All Implemented Interfaces:
EventListener,org.jppf.client.monitoring.topology.TopologyListener
public class GraphTopologyHandler
extends Object
implements org.jppf.client.monitoring.topology.TopologyListener
This class handles operations on the graph.
It actually holds 2 graphs:
- one, the full graph, which contains the entire set of vertices (representing drviers and nodes)
- another one, the displayed graph, where the collapsed nodes are filtered out
- Author:
- Laurent Cohen
-
Constructor Summary
ConstructorsConstructorDescriptionGraphTopologyHandler(GraphOption graphOption) Initialize this graph handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidcollapse(org.jppf.client.monitoring.topology.TopologyDriver driver) Collapse the specified driver by removing attached nodes from the display graph.voiddriverAdded(org.jppf.client.monitoring.topology.TopologyEvent event) voiddriverRemoved(org.jppf.client.monitoring.topology.TopologyEvent event) voiddriverUpdated(org.jppf.client.monitoring.topology.TopologyEvent event) voidexpand(org.jppf.client.monitoring.topology.TopologyDriver driver) Expand the specified driver by adding attached nodes to the display graph.edu.uci.ics.jung.graph.SparseMultigraph<org.jppf.client.monitoring.topology.AbstractTopologyComponent,Number> Get the graph that is actually displayed and accounts for collapsed vertices.edu.uci.ics.jung.graph.SparseMultigraph<org.jppf.client.monitoring.topology.AbstractTopologyComponent,Number> Get the underlying graph that keeps track of all drivers and nodes.org.jppf.utils.Pair<org.jppf.client.monitoring.topology.AbstractTopologyComponent,org.jppf.client.monitoring.topology.AbstractTopologyComponent> getVertices(Number edge) Get the vertices that are the endpoints of the specified edge.booleanisCollapsed(org.jppf.client.monitoring.topology.AbstractTopologyComponent comp) Determine whether the specified component is collapsed.booleanisExpanded(org.jppf.client.monitoring.topology.AbstractTopologyComponent comp) Determine whether the specified component is expanded.voidnodeAdded(org.jppf.client.monitoring.topology.TopologyEvent event) voidnodeRemoved(org.jppf.client.monitoring.topology.TopologyEvent event) voidnodeUpdated(org.jppf.client.monitoring.topology.TopologyEvent event) Called when the state information of a node has changed.voidpopulate()Redraw the graph.
-
Constructor Details
-
GraphTopologyHandler
Initialize this graph handler.- Parameters:
graphOption- the panel that displays the graph.
-
-
Method Details
-
getFullGraph
public edu.uci.ics.jung.graph.SparseMultigraph<org.jppf.client.monitoring.topology.AbstractTopologyComponent,Number> getFullGraph()Get the underlying graph that keeps track of all drivers and nodes.- Returns:
- a
SparseMultigraphinstance.
-
getDisplayGraph
public edu.uci.ics.jung.graph.SparseMultigraph<org.jppf.client.monitoring.topology.AbstractTopologyComponent,Number> getDisplayGraph()Get the graph that is actually displayed and accounts for collapsed vertices.- Returns:
- a
SparseMultigraphinstance.
-
populate
public void populate()Redraw the graph. -
driverAdded
public void driverAdded(org.jppf.client.monitoring.topology.TopologyEvent event) - Specified by:
driverAddedin interfaceorg.jppf.client.monitoring.topology.TopologyListener
-
driverRemoved
public void driverRemoved(org.jppf.client.monitoring.topology.TopologyEvent event) - Specified by:
driverRemovedin interfaceorg.jppf.client.monitoring.topology.TopologyListener
-
driverUpdated
public void driverUpdated(org.jppf.client.monitoring.topology.TopologyEvent event) - Specified by:
driverUpdatedin interfaceorg.jppf.client.monitoring.topology.TopologyListener
-
nodeAdded
public void nodeAdded(org.jppf.client.monitoring.topology.TopologyEvent event) - Specified by:
nodeAddedin interfaceorg.jppf.client.monitoring.topology.TopologyListener
-
nodeRemoved
public void nodeRemoved(org.jppf.client.monitoring.topology.TopologyEvent event) - Specified by:
nodeRemovedin interfaceorg.jppf.client.monitoring.topology.TopologyListener
-
nodeUpdated
public void nodeUpdated(org.jppf.client.monitoring.topology.TopologyEvent event) Called when the state information of a node has changed.- Specified by:
nodeUpdatedin interfaceorg.jppf.client.monitoring.topology.TopologyListener
-
collapse
public void collapse(org.jppf.client.monitoring.topology.TopologyDriver driver) Collapse the specified driver by removing attached nodes from the display graph.- Parameters:
driver- the driver to collapse.
-
expand
public void expand(org.jppf.client.monitoring.topology.TopologyDriver driver) Expand the specified driver by adding attached nodes to the display graph.- Parameters:
driver- the driver to expand.
-
isCollapsed
public boolean isCollapsed(org.jppf.client.monitoring.topology.AbstractTopologyComponent comp) Determine whether the specified component is collapsed.- Parameters:
comp- the topology component to check.- Returns:
trueif the node is collapsed,falseotherwise.
-
isExpanded
public boolean isExpanded(org.jppf.client.monitoring.topology.AbstractTopologyComponent comp) Determine whether the specified component is expanded.- Parameters:
comp- the topology component to check.- Returns:
trueif the node is expanded,falseotherwise.
-
getVertices
public org.jppf.utils.Pair<org.jppf.client.monitoring.topology.AbstractTopologyComponent,org.jppf.client.monitoring.topology.AbstractTopologyComponent> getVertices(Number edge) Get the vertices that are the endpoints of the specified edge.- Parameters:
edge- the edge number.- Returns:
- a pair of endpoints.
-