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

    Constructors
    Constructor
    Description
    Initialize this graph handler.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    collapse(org.jppf.client.monitoring.topology.TopologyDriver driver)
    Collapse the specified driver by removing attached nodes from the display graph.
    void
    driverAdded(org.jppf.client.monitoring.topology.TopologyEvent event)
     
    void
    driverRemoved(org.jppf.client.monitoring.topology.TopologyEvent event)
     
    void
    driverUpdated(org.jppf.client.monitoring.topology.TopologyEvent event)
     
    void
    expand(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>
    Get the vertices that are the endpoints of the specified edge.
    boolean
    isCollapsed(org.jppf.client.monitoring.topology.AbstractTopologyComponent comp)
    Determine whether the specified component is collapsed.
    boolean
    isExpanded(org.jppf.client.monitoring.topology.AbstractTopologyComponent comp)
    Determine whether the specified component is expanded.
    void
    nodeAdded(org.jppf.client.monitoring.topology.TopologyEvent event)
     
    void
    nodeRemoved(org.jppf.client.monitoring.topology.TopologyEvent event)
     
    void
    nodeUpdated(org.jppf.client.monitoring.topology.TopologyEvent event)
    Called when the state information of a node has changed.
    void
    Redraw the graph.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GraphTopologyHandler

      public GraphTopologyHandler(GraphOption graphOption)
      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 SparseMultigraph instance.
    • 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 SparseMultigraph instance.
    • populate

      public void populate()
      Redraw the graph.
    • driverAdded

      public void driverAdded(org.jppf.client.monitoring.topology.TopologyEvent event)
      Specified by:
      driverAdded in interface org.jppf.client.monitoring.topology.TopologyListener
    • driverRemoved

      public void driverRemoved(org.jppf.client.monitoring.topology.TopologyEvent event)
      Specified by:
      driverRemoved in interface org.jppf.client.monitoring.topology.TopologyListener
    • driverUpdated

      public void driverUpdated(org.jppf.client.monitoring.topology.TopologyEvent event)
      Specified by:
      driverUpdated in interface org.jppf.client.monitoring.topology.TopologyListener
    • nodeAdded

      public void nodeAdded(org.jppf.client.monitoring.topology.TopologyEvent event)
      Specified by:
      nodeAdded in interface org.jppf.client.monitoring.topology.TopologyListener
    • nodeRemoved

      public void nodeRemoved(org.jppf.client.monitoring.topology.TopologyEvent event)
      Specified by:
      nodeRemoved in interface org.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:
      nodeUpdated in interface org.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:
      true if the node is collapsed, false otherwise.
    • 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:
      true if the node is expanded, false otherwise.
    • 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.