prefuse.controls
Class DragControl

java.lang.Object
  extended by prefuse.controls.ControlAdapter
      extended by prefuse.controls.DragControl
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener, Control, TableListener

public class DragControl
extends ControlAdapter
implements TableListener

Changes a node's location when dragged on screen. Other effects include fixing a node's position when the mouse if over it, and changing the mouse cursor to a hand when the mouse passes over an item.

Author:
jeffrey heer

Field Summary
protected  java.lang.String action
           
protected  java.awt.geom.Point2D down
           
protected  boolean dragged
           
protected  boolean repaint
           
protected  boolean resetItem
           
protected  java.awt.geom.Point2D temp
           
protected  boolean wasFixed
           
 
Fields inherited from interface prefuse.controls.Control
LEFT_MOUSE_BUTTON, MIDDLE_MOUSE_BUTTON, RIGHT_MOUSE_BUTTON
 
Constructor Summary
DragControl()
          Creates a new drag control that issues repaint requests as an item is dragged.
DragControl(boolean repaint)
          Creates a new drag control that optionally issues repaint requests as an item is dragged.
DragControl(boolean repaint, boolean fixOnMouseOver)
          Creates a new drag control that optionally issues repaint requests as an item is dragged.
DragControl(java.lang.String action)
          Creates a new drag control that invokes an action upon drag events.
DragControl(java.lang.String action, boolean fixOnMouseOver)
          Creates a new drag control that invokes an action upon drag events.
 
Method Summary
 void itemDragged(VisualItem item, java.awt.event.MouseEvent e)
          Invoked when a mouse button is pressed on a VisualItem and then dragged.
 void itemEntered(VisualItem item, java.awt.event.MouseEvent e)
          Invoked when the mouse enters a VisualItem.
 void itemExited(VisualItem item, java.awt.event.MouseEvent e)
          Invoked when the mouse exits a VisualItem.
 void itemPressed(VisualItem item, java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a VisualItem.
 void itemReleased(VisualItem item, java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a VisualItem.
 void setFixPositionOnMouseOver(boolean s)
          Determines whether or not an item should have it's position fixed when the mouse moves over it.
 void tableChanged(Table t, int start, int end, int col, int type)
          Notification that a table has changed.
 
Methods inherited from class prefuse.controls.ControlAdapter
isEnabled, itemClicked, itemKeyPressed, itemKeyReleased, itemKeyTyped, itemMoved, itemWheelMoved, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

action

protected java.lang.String action

down

protected java.awt.geom.Point2D down

temp

protected java.awt.geom.Point2D temp

dragged

protected boolean dragged

wasFixed

protected boolean wasFixed

resetItem

protected boolean resetItem

repaint

protected boolean repaint
Constructor Detail

DragControl

public DragControl()
Creates a new drag control that issues repaint requests as an item is dragged.


DragControl

public DragControl(boolean repaint)
Creates a new drag control that optionally issues repaint requests as an item is dragged.

Parameters:
repaint - indicates whether or not repaint requests are issued as drag events occur. This can be set to false if other activities (for example, a continuously running force simulation) are already issuing repaint events.

DragControl

public DragControl(boolean repaint,
                   boolean fixOnMouseOver)
Creates a new drag control that optionally issues repaint requests as an item is dragged.

Parameters:
repaint - indicates whether or not repaint requests are issued as drag events occur. This can be set to false if other activities (for example, a continuously running force simulation) are already issuing repaint events.
fixOnMouseOver - indicates if object positions should become fixed (made stationary) when the mouse pointer is over an item.

DragControl

public DragControl(java.lang.String action)
Creates a new drag control that invokes an action upon drag events.

Parameters:
action - the action to run when drag events occur.

DragControl

public DragControl(java.lang.String action,
                   boolean fixOnMouseOver)
Creates a new drag control that invokes an action upon drag events.

Parameters:
action - the action to run when drag events occur
fixOnMouseOver - indicates if object positions should become fixed (made stationary) when the mouse pointer is over an item.
Method Detail

setFixPositionOnMouseOver

public void setFixPositionOnMouseOver(boolean s)
Determines whether or not an item should have it's position fixed when the mouse moves over it.

Parameters:
s - whether or not item position should become fixed upon mouse over.

itemEntered

public void itemEntered(VisualItem item,
                        java.awt.event.MouseEvent e)
Description copied from interface: Control
Invoked when the mouse enters a VisualItem.

Specified by:
itemEntered in interface Control
Overrides:
itemEntered in class ControlAdapter
See Also:
Control.itemEntered(prefuse.visual.VisualItem, java.awt.event.MouseEvent)

itemExited

public void itemExited(VisualItem item,
                       java.awt.event.MouseEvent e)
Description copied from interface: Control
Invoked when the mouse exits a VisualItem.

Specified by:
itemExited in interface Control
Overrides:
itemExited in class ControlAdapter
See Also:
Control.itemExited(prefuse.visual.VisualItem, java.awt.event.MouseEvent)

itemPressed

public void itemPressed(VisualItem item,
                        java.awt.event.MouseEvent e)
Description copied from interface: Control
Invoked when a mouse button has been pressed on a VisualItem.

Specified by:
itemPressed in interface Control
Overrides:
itemPressed in class ControlAdapter
See Also:
Control.itemPressed(prefuse.visual.VisualItem, java.awt.event.MouseEvent)

itemReleased

public void itemReleased(VisualItem item,
                         java.awt.event.MouseEvent e)
Description copied from interface: Control
Invoked when a mouse button has been released on a VisualItem.

Specified by:
itemReleased in interface Control
Overrides:
itemReleased in class ControlAdapter
See Also:
Control.itemReleased(prefuse.visual.VisualItem, java.awt.event.MouseEvent)

itemDragged

public void itemDragged(VisualItem item,
                        java.awt.event.MouseEvent e)
Description copied from interface: Control
Invoked when a mouse button is pressed on a VisualItem and then dragged.

Specified by:
itemDragged in interface Control
Overrides:
itemDragged in class ControlAdapter
See Also:
Control.itemDragged(prefuse.visual.VisualItem, java.awt.event.MouseEvent)

tableChanged

public void tableChanged(Table t,
                         int start,
                         int end,
                         int col,
                         int type)
Description copied from interface: TableListener
Notification that a table has changed.

Specified by:
tableChanged in interface TableListener
Parameters:
t - the table that has changed
start - the starting row index of the changed table region
end - the ending row index of the changed table region
col - the column that has changed, or EventConstants.ALL_COLUMNS if the operation affects all columns
type - the type of modification, one of EventConstants.INSERT, EventConstants.DELETE, or EventConstants.UPDATE.
See Also:
TableListener.tableChanged(prefuse.data.Table, int, int, int, int)


Copyright © 2007 Regents of the University of California