samples.preview_new_graphdraw.impl
Class GraphLayoutPanelMouseListener

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by samples.preview_new_graphdraw.impl.GraphLayoutPanelMouseListener
All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, EventListener

public class GraphLayoutPanelMouseListener
extends MouseAdapter

Author:
danyelf

Nested Class Summary
static class GraphLayoutPanelMouseListener.BothEdgeAndVertexPolicy
          Both an edge event or a vertex event is fired from this panel.
static class GraphLayoutPanelMouseListener.EdgeAndVertexPolicy
          Either an edge event or a vertex event is fired from this panel.
static class GraphLayoutPanelMouseListener.EdgeEventPolicy
          Only edge events are fired from this panel.
static class GraphLayoutPanelMouseListener.NoEventPolicy
          No graph events are fired from this panel
static class GraphLayoutPanelMouseListener.VertexEventPolicy
          Only vertex events are fired from this panel.
 
Field Summary
static double EDGE_CLICK_THRESHOLD
           
protected  GraphLayoutPanel panel
           
static double VERTEX_BIAS
          If the system is set to accept both VERTEX and EDGE clicks, then any edge click will be just as far from a vertex as a vertex click is.
static double VERTEX_CLICK_THRESHOLD
          This constant tracks how far a click needs to be before it's too far to register at all.
 
Constructor Summary
GraphLayoutPanelMouseListener(GraphLayoutPanel panel)
           
 
Method Summary
protected  void fireEdgeEvent(Edge e, double dist_to_closest_edge, MouseEvent me)
           
protected  void fireVertexEvent(Vertex v, double dist_to_closest_vertex, MouseEvent e)
           
 void mouseClicked(MouseEvent e)
           
 
Methods inherited from class java.awt.event.MouseAdapter
mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

panel

protected final GraphLayoutPanel panel

VERTEX_CLICK_THRESHOLD

public static double VERTEX_CLICK_THRESHOLD
This constant tracks how far a click needs to be before it's too far to register at all.


EDGE_CLICK_THRESHOLD

public static double EDGE_CLICK_THRESHOLD

VERTEX_BIAS

public static double VERTEX_BIAS
If the system is set to accept both VERTEX and EDGE clicks, then any edge click will be just as far from a vertex as a vertex click is. (After all, each edge terminates in a vertex.) This bias allows the vertex a little extra radius near it. A value of 2.0 means that a click can be 2 times as far from the nearest vertex as the nearest edge, and still be registered.

Constructor Detail

GraphLayoutPanelMouseListener

public GraphLayoutPanelMouseListener(GraphLayoutPanel panel)
Parameters:
panel -
Method Detail

fireVertexEvent

protected void fireVertexEvent(Vertex v,
                               double dist_to_closest_vertex,
                               MouseEvent e)

fireEdgeEvent

protected void fireEdgeEvent(Edge e,
                             double dist_to_closest_edge,
                             MouseEvent me)

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener
Overrides:
mouseClicked in class MouseAdapter