venice
Class VSelectionModifyHandler

java.lang.Object
  |
  +--venice.VSelectionModifyHandler
All Implemented Interfaces:
java.util.EventListener, java.io.Serializable, edu.umd.cs.jazz.event.ZEventHandler, edu.umd.cs.jazz.event.ZMouseListener, edu.umd.cs.jazz.event.ZMouseMotionListener

public class VSelectionModifyHandler
extends java.lang.Object
implements edu.umd.cs.jazz.event.ZEventHandler, edu.umd.cs.jazz.event.ZMouseListener, edu.umd.cs.jazz.event.ZMouseMotionListener, java.io.Serializable

VSelectionModifyHandler is a ZEventHandler that allows items to be selected with the mouse, and maintains the current selection. As an event handler, ZSelectionManager directly supports the following actions:

Holding down the SHIFT key while performing the above actions will extend the current selection with the newly selected items, otherwise the previous selection (if any) will be replaced by the new selection.

Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.

THIS IS A MODIFIED VERSION OF ZSELECTIONMODIFYHANDLER FROM JAZZ CODE!

Author:
Antony Courtney, Yale University, Lance Good, University of Maryland, Benjamin Bederson, University of Maryland, modified by Antti Pietarinen
See Also:
Serialized Form

Field Summary
private  boolean active
          true when event handler is active
private  edu.umd.cs.jazz.ZCamera activeCamera
          camera this event handler watches
private  int allButton1ButShiftMask
           
private  int allButton1Mask
           
private  int allButton3ButShiftMask
           
private  edu.umd.cs.jazz.util.ZCanvas canvas
          canvas this event handler attaches to
private  boolean consumed
           
private  java.awt.geom.Point2D dragPt
           
private  boolean globallyActive
          true if event handler is globally active
private  edu.umd.cs.jazz.ZCamera interactionCamera
          the camera with which this handler is interacting
private  java.util.ArrayList itemsToRemove
           
private  edu.umd.cs.jazz.ZVisualLeaf marquee
           
private  edu.umd.cs.jazz.ZGroup marqueeLayer
          parent node to use for marquee selection
private  boolean moved
           
private  edu.umd.cs.jazz.ZNode node
          node this event handler attaches to
private  java.awt.geom.Point2D pressPt
           
private  java.util.ArrayList prevMotionSelection
           
private  java.awt.geom.Point2D prevPt
           
private  java.awt.geom.Point2D pt1
           
private  java.awt.geom.Point2D pt2
           
private  edu.umd.cs.jazz.ZNode selNode
           
 
Constructor Summary
VSelectionModifyHandler(edu.umd.cs.jazz.ZNode node, edu.umd.cs.jazz.ZCamera camera, edu.umd.cs.jazz.util.ZCanvas canvas, edu.umd.cs.jazz.ZGroup marqueeLayer)
          Construct a new VSelectionModifyHandler.
VSelectionModifyHandler(edu.umd.cs.jazz.ZNode node, edu.umd.cs.jazz.util.ZCanvas canvas, edu.umd.cs.jazz.ZGroup marqueeLayer)
          Construct a new VSelectionModifyHandler.
 
Method Summary
 edu.umd.cs.jazz.ZCamera getCamera()
          Returns the camera on which this event handler is watching for selection change
 edu.umd.cs.jazz.util.ZCanvas getCanvas()
          Returns the canvas to which this selection manager is attached.
 edu.umd.cs.jazz.ZGroup getMarqueeLayer()
          Determine the "marquee" layer that is used for selection.
 edu.umd.cs.jazz.ZNode getNode()
          Returns the node to which this selection manager is attached.
 boolean isActive()
          Determines if this event handler is active.
 void mouseClicked(edu.umd.cs.jazz.event.ZMouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseDragged(edu.umd.cs.jazz.event.ZMouseEvent e)
          Mouse drag event handler
 void mouseEntered(edu.umd.cs.jazz.event.ZMouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(edu.umd.cs.jazz.event.ZMouseEvent e)
          Invoked when the mouse exits a component.
 void mouseMoved(edu.umd.cs.jazz.event.ZMouseEvent e)
          Invoked when the mouse button has been moved on a node (with no buttons no down).
 void mousePressed(edu.umd.cs.jazz.event.ZMouseEvent e)
          Mouse press event handler
 void mouseReleased(edu.umd.cs.jazz.event.ZMouseEvent e)
          Mouse release event handler
 void setActive(boolean active)
          Specifies whether this event handler is active
 void setMarqueeLayer(edu.umd.cs.jazz.ZGroup layer)
          Specify the node that the selection "marquee" should be put on.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

active

private boolean active
true when event handler is active

globallyActive

private boolean globallyActive
true if event handler is globally active

node

private edu.umd.cs.jazz.ZNode node
node this event handler attaches to

activeCamera

private edu.umd.cs.jazz.ZCamera activeCamera
camera this event handler watches

interactionCamera

private edu.umd.cs.jazz.ZCamera interactionCamera
the camera with which this handler is interacting

canvas

private edu.umd.cs.jazz.util.ZCanvas canvas
canvas this event handler attaches to

marqueeLayer

private edu.umd.cs.jazz.ZGroup marqueeLayer
parent node to use for marquee selection

prevMotionSelection

private java.util.ArrayList prevMotionSelection

itemsToRemove

private java.util.ArrayList itemsToRemove

selNode

private edu.umd.cs.jazz.ZNode selNode

moved

private boolean moved

consumed

private boolean consumed

pt1

private transient java.awt.geom.Point2D pt1

pt2

private transient java.awt.geom.Point2D pt2

pressPt

private transient java.awt.geom.Point2D pressPt

dragPt

private transient java.awt.geom.Point2D dragPt

prevPt

private transient java.awt.geom.Point2D prevPt

marquee

private edu.umd.cs.jazz.ZVisualLeaf marquee

allButton1Mask

private int allButton1Mask

allButton1ButShiftMask

private int allButton1ButShiftMask

allButton3ButShiftMask

private int allButton3ButShiftMask
Constructor Detail

VSelectionModifyHandler

public VSelectionModifyHandler(edu.umd.cs.jazz.ZNode node,
                               edu.umd.cs.jazz.util.ZCanvas canvas,
                               edu.umd.cs.jazz.ZGroup marqueeLayer)
Construct a new VSelectionModifyHandler. This event handler will be active on all cameras.
Parameters:
node - The node this event handler attaches to.
canvas - The canvas this event handler attaches to
marqueeLayer - The layer to draw the marquee on

VSelectionModifyHandler

public VSelectionModifyHandler(edu.umd.cs.jazz.ZNode node,
                               edu.umd.cs.jazz.ZCamera camera,
                               edu.umd.cs.jazz.util.ZCanvas canvas,
                               edu.umd.cs.jazz.ZGroup marqueeLayer)
Construct a new VSelectionModifyHandler. This event handler will be active on the specified camera.
Parameters:
node - The node this event handler attaches to.
camera - The camera to which this event handler attaches.
canvas - The canvas this event handler attaches to
marqueeLayer - The layer to draw the marquee on
Method Detail

setActive

public void setActive(boolean active)
Specifies whether this event handler is active
Specified by:
setActive in interface edu.umd.cs.jazz.event.ZEventHandler
Parameters:
active - True to make this event handler active

isActive

public boolean isActive()
Determines if this event handler is active.
Specified by:
isActive in interface edu.umd.cs.jazz.event.ZEventHandler
Returns:
True if active

getNode

public edu.umd.cs.jazz.ZNode getNode()
Returns the node to which this selection manager is attached. Primarily for use by associated selection handlers.

getCamera

public edu.umd.cs.jazz.ZCamera getCamera()
Returns the camera on which this event handler is watching for selection change

getCanvas

public edu.umd.cs.jazz.util.ZCanvas getCanvas()
Returns the canvas to which this selection manager is attached. Primarily for use by associated selection handlers.

setMarqueeLayer

public void setMarqueeLayer(edu.umd.cs.jazz.ZGroup layer)
Specify the node that the selection "marquee" should be put on. The marquee is the rectangle that the user drags around to select things within.
Parameters:
layer - The node that the marquee should be put under

getMarqueeLayer

public edu.umd.cs.jazz.ZGroup getMarqueeLayer()
Determine the "marquee" layer that is used for selection.
Returns:
layer The node that the marquee is put under

mousePressed

public void mousePressed(edu.umd.cs.jazz.event.ZMouseEvent e)
Mouse press event handler
Specified by:
mousePressed in interface edu.umd.cs.jazz.event.ZMouseListener
Parameters:
e - The event.

mouseDragged

public void mouseDragged(edu.umd.cs.jazz.event.ZMouseEvent e)
Mouse drag event handler
Specified by:
mouseDragged in interface edu.umd.cs.jazz.event.ZMouseMotionListener
Parameters:
e - The event.

mouseReleased

public void mouseReleased(edu.umd.cs.jazz.event.ZMouseEvent e)
Mouse release event handler
Specified by:
mouseReleased in interface edu.umd.cs.jazz.event.ZMouseListener
Parameters:
e - The event.

mouseEntered

public void mouseEntered(edu.umd.cs.jazz.event.ZMouseEvent e)
Invoked when the mouse enters a component.
Specified by:
mouseEntered in interface edu.umd.cs.jazz.event.ZMouseListener

mouseExited

public void mouseExited(edu.umd.cs.jazz.event.ZMouseEvent e)
Invoked when the mouse exits a component.
Specified by:
mouseExited in interface edu.umd.cs.jazz.event.ZMouseListener

mouseClicked

public void mouseClicked(edu.umd.cs.jazz.event.ZMouseEvent e)
Invoked when the mouse has been clicked on a component.
Specified by:
mouseClicked in interface edu.umd.cs.jazz.event.ZMouseListener

mouseMoved

public void mouseMoved(edu.umd.cs.jazz.event.ZMouseEvent e)
Invoked when the mouse button has been moved on a node (with no buttons no down).
Specified by:
mouseMoved in interface edu.umd.cs.jazz.event.ZMouseMotionListener