Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.visualization.control
Class PickingGraphMousePlugin

    java.lang.Object
      edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
          edu.uci.ics.jung.visualization.control.PickingGraphMousePlugin

All Implemented Interfaces:
  EventListener, GraphMousePlugin, MouseListener, MouseMotionListener

public class PickingGraphMousePlugin
extends AbstractGraphMousePlugin
implements MouseListener, MouseMotionListener

PickingGraphMousePlugin supports the picking of graph elements with the mouse. MouseButtonOne picks a single vertex or edge, and MouseButtonTwo adds to the set of selected Vertices or Edges. If a Vertex is selected and the mouse is dragged while on the selected Vertex, then that Vertex will be repositioned to follow the mouse until the button is released.

Author:
  Tom Nelson

Field Summary
`protected int` | `addToSelectionModifiers` additional modifiers for the action of adding to an existing selection
`protected Edge` | `edge` the picked Edge, if any
`protected Color` | `lensColor` color for the picking rectangle
`protected VisualizationViewer.Paintable` | `lensPaintable` the Paintable for the lens picking rectangle
`protected boolean` | `locked` controls whether the Vertices may be moved with the mouse
`protected double` | `offsetx` the x distance from the picked vertex center to the mouse point
`protected double` | `offsety` the y distance from the picked vertex center to the mouse point
`protected Rectangle2D` | `rect` used to draw a rectangle to contain picked vertices
`protected Vertex` | `vertex` the picked Vertex, if any

Fields inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
`cursor, down, modifiers`

Constructor Summary
`PickingGraphMousePlugin()` create an instance with default settings
`PickingGraphMousePlugin(int selectionModifiers, int addToSelectionModifiers)` create an instance with overides

Method Summary
`Color` | `getLensColor()`
`boolean` | `isLocked()`
`void` | `mouseClicked(MouseEvent e)`
`void` | `mouseDragged(MouseEvent e)` If the mouse is over a picked vertex, drag all picked vertices with the mouse.
`void` | `mouseEntered(MouseEvent e)`
`void` | `mouseExited(MouseEvent e)`
`void` | `mouseMoved(MouseEvent e)`
`void` | `mousePressed(MouseEvent e)` For primary modifiers (default, MouseButton1): pick a single Vertex or Edge that is under the mouse pointer.
`void` | `mouseReleased(MouseEvent e)` If the mouse is dragging a rectangle, pick the Vertices contained in that rectangle clean up settings from mousePressed
`protected void` | `pickContainedVertices(VisualizationViewer vv, boolean clear)` pick the vertices inside the rectangle
`void` | `setLensColor(Color lensColor)`
`void` | `setLocked(boolean locked)`

Methods inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
`checkModifiers, getCursor, getModifiers, setCursor, setModifiers`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### vertex

    protected Vertex vertex

  the picked Vertex, if any

### edge

    protected Edge edge

  the picked Edge, if any

### offsetx

    protected double offsetx

  the x distance from the picked vertex center to the mouse point

### offsety

    protected double offsety

  the y distance from the picked vertex center to the mouse point

### locked

    protected boolean locked

  controls whether the Vertices may be moved with the mouse

### addToSelectionModifiers

    protected int addToSelectionModifiers

  additional modifiers for the action of adding to an existing selection

### rect

    protected Rectangle2D rect

  used to draw a rectangle to contain picked vertices

### lensPaintable

    protected VisualizationViewer.Paintable lensPaintable

  the Paintable for the lens picking rectangle

### lensColor

    protected Color lensColor

  color for the picking rectangle

Constructor Detail

### PickingGraphMousePlugin

    public PickingGraphMousePlugin()

  create an instance with default settings

### PickingGraphMousePlugin

    public PickingGraphMousePlugin(int selectionModifiers,
                                   int addToSelectionModifiers)

  create an instance with overides

Parameters:
  `selectionModifiers` - for primary selection
  `addToSelectionModifiers` - for additional selection

Method Detail

### getLensColor

    public Color getLensColor()

  Returns:
    Returns the lensColor.

### setLensColor

    public void setLensColor(Color lensColor)

  Parameters:
    `lensColor` - The lensColor to set.

### mousePressed

    public void mousePressed(MouseEvent e)

  For primary modifiers (default, MouseButton1): pick a single Vertex or Edge that is under the mouse pointer. If no Vertex or edge is under the pointer, unselect all picked Vertices and edges, and set up to draw a rectangle for multiple selection of contained Vertices. For additional selection (default Shift+MouseButton1): Add to the selection, a single Vertex or Edge that is under the mouse pointer. If a previously picked Vertex or Edge is under the pointer, it is un-picked. If no vertex or Edge is under the pointer, set up to draw a multiple selection rectangle (as above) but do not unpick previously picked elements.

  Specified by:
    `mousePressed` in interface `MouseListener`
  Parameters:
    `e` - the event

### mouseReleased

    public void mouseReleased(MouseEvent e)

  If the mouse is dragging a rectangle, pick the Vertices contained in that rectangle clean up settings from mousePressed

  Specified by:
    `mouseReleased` in interface `MouseListener`

### mouseDragged

    public void mouseDragged(MouseEvent e)

  If the mouse is over a picked vertex, drag all picked vertices with the mouse. If the mouse is not over a Vertex, draw the rectangle to select multiple Vertices

  Specified by:
    `mouseDragged` in interface `MouseMotionListener`

### pickContainedVertices

    protected void pickContainedVertices(VisualizationViewer vv,
                                         boolean clear)

  pick the vertices inside the rectangle

### mouseClicked

    public void mouseClicked(MouseEvent e)

  Specified by:
    `mouseClicked` in interface `MouseListener`

### mouseEntered

    public void mouseEntered(MouseEvent e)

  Specified by:
    `mouseEntered` in interface `MouseListener`

### mouseExited

    public void mouseExited(MouseEvent e)

  Specified by:
    `mouseExited` in interface `MouseListener`

### mouseMoved

    public void mouseMoved(MouseEvent e)

  Specified by:
    `mouseMoved` in interface `MouseMotionListener`

### isLocked

    public boolean isLocked()

  Returns:
    Returns the locked.

### setLocked

    public void setLocked(boolean locked)

  Parameters:
    `locked` - The locked to set.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD