edu.umd.cs.jazz.event
Class ZSelectionModifyHandler

java.lang.Object
  |
  +--edu.umd.cs.jazz.event.ZFilteredEventHandler
        |
        +--edu.umd.cs.jazz.event.ZDragSequenceEventHandler
              |
              +--edu.umd.cs.jazz.event.ZSelectionModifyHandler
All Implemented Interfaces:
ZEventHandler

public class ZSelectionModifyHandler
extends ZDragSequenceEventHandler

ZSelectionModifyHandler 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.

Author:
Antony Courtney, Yale University
, Lance Good, University of Maryland , Benjamin Bederson, University of Maryland , Jesse Grosjean, University of Maryland
See Also:
ZSelectionManager, ZCompositeSelectionHandler, ZSelectionDeleteHandler, ZSelectionMoveHandler, ZSelectionScaleHandler

Nested Class Summary
 
Nested classes inherited from class edu.umd.cs.jazz.event.ZFilteredEventHandler
ZFilteredEventHandler.ZFilteredEventDispatcher
 
Field Summary
 
Fields inherited from class edu.umd.cs.jazz.event.ZFilteredEventHandler
fFilteredEventDispatcher, fMouseFilter
 
Constructor Summary
ZSelectionModifyHandler(ZSceneGraphObject aFilteredMouseEventSource, ZCanvas aIgnoredCanvas, ZGroup aMarqueeLayer)
          Deprecated. As of Jazz version 1.2, use ZSelectionModifyHandler(ZSceneGraphObject aFilteredMouseEventSource, ZGroup aMarqueeLayer) instead.
ZSelectionModifyHandler(ZSceneGraphObject aFilteredMouseEventSource, ZGroup aMarqueeLayer)
          Construct a new ZSelectionModifyHandler.
 
Method Summary
protected  void dragInScreenCoords(ZMouseEvent e, java.awt.geom.Dimension2D aScreenDelta)
          Forward the message to modifyMarqueeSelection.
protected  void endDrag(ZMouseEvent e)
          Forward the message to endMarqueeSelection.
protected  void endMarqueeSelection(ZMouseEvent e)
          Remove the marquee visual leaf and set the last marquee selection to null.
protected  void filteredMousePressed(ZMouseEvent e)
          On mouse pressed try to select the node under the cursor.
protected  java.util.Collection getLastMarqueeSelection()
          Get the collection of nodes that were in the last marquee selection.
 ZGroup getMarqueeLayer()
          Get the layer that the marquee upon which the marquee should be drawn.
 ZVisualLeaf getMarqueeLeaf()
          Return the leaf from which the marquee visual component should hang.
 ZVisualComponent getMarqueeVisualComponent()
          Return the visual component used to draw the marquee.
 ZMouseFilter getMouseFilter()
          Modifying the selection works with BUTTON1 by default.
protected  java.util.Collection getNewMarqueeSelection(ZBounds aBounds)
          Return the collection of nodes that intersect aBounds from the interaction cameras perspective.
protected  ZNode getNodeToSelect(ZMouseEvent e)
          Return the node that should be selected for the given event, null if no node should be selected.
protected  ZBounds getResizedMarqueeBounds(ZMouseEvent e, java.awt.geom.Dimension2D aScreenDelta)
          Resize the marquee by aScreenDelta and return the resulting bounds.
protected  boolean isOptionSelection(ZMouseEvent e)
          Return true if the event is an option selection.
protected  void makeSelection(ZNode aNode, ZMouseEvent e)
          Select aNode.
protected  void modifyMarqueeSelection(ZMouseEvent e, java.awt.geom.Dimension2D aScreenDelta)
          Modify the current marquee selection by aScreenDelta.
 void setActive(boolean active)
          Specifies whether this event handler is active or not.
protected  void setLastMarqueeSelection(java.util.Collection aCollection)
          Set the collection of nodes that were in the last marquee selection.
 void setMarqueeBounds(ZBounds aBounds)
          Set the bounds of the marquee visual component to the new bounds.
 void setMarqueeLayer(ZGroup aGroup)
          Set the layer tha the marquee upon which the marquee should be drawn.
 void setMarqueeLeaf(ZVisualLeaf aMarquee)
          Set the leaf from which the marquee visual component should hang.
 void setMarqueeVisualComponent(ZVisualComponent aMarquee)
          Set the visual component used to draw the marquee.
protected  boolean shouldStartMarqueeSelection(ZMouseEvent e)
          Return true if no node is currently under the cursor that should be selected.
protected  void startDrag(ZMouseEvent e)
          Forward the message to startMarqueeSelection if shouldStartMarqueeSelection returns true.
protected  void startMarqueeSelection(ZMouseEvent e)
          Start a new marquee selection.
protected  void unselectAll()
          Unselect all selected nodes seen from the current interaction camera.
 
Methods inherited from class edu.umd.cs.jazz.event.ZDragSequenceEventHandler
drag, filteredMouseDragged, filteredMouseReleased, getCurrentScreenDelta, getCurrentScreenPoint, getDragStartScreenPoint, getMinDragStartDistance, getMousePressedScreenPoint, getPreviousScreenPoint, isDragging, setIsDragging, setMinDragStartDistance, shouldStartDragInteraction
 
Methods inherited from class edu.umd.cs.jazz.event.ZFilteredEventHandler
filteredKeyPressed, filteredKeyReleased, filteredKeyTyped, filteredMouseClicked, filteredMouseEntered, filteredMouseExited, filteredMouseMoved, getCurrentFilteredMouseEvent, getCurrentSelection, getFilteredEventDispatcher, getFilteredKeyEventSource, getFilteredMouseEventSource, getInteractionCamera, getTopCamera, isActive, setFilteredKeyEventSource, setFilteredMouseEventSource, setMouseFilter, wantsKeyEvents, wantsMouseEvents, wantsMouseMotionEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZSelectionModifyHandler

public ZSelectionModifyHandler(ZSceneGraphObject aFilteredMouseEventSource,
                               ZGroup aMarqueeLayer)
Construct a new ZSelectionModifyHandler.

Parameters:
aFilteredMouseEventSource - the source for filtered ZMouseEvents and ZMouseMotionEvents. See the class comment to customize this behavior.

ZSelectionModifyHandler

public ZSelectionModifyHandler(ZSceneGraphObject aFilteredMouseEventSource,
                               ZCanvas aIgnoredCanvas,
                               ZGroup aMarqueeLayer)
Deprecated. As of Jazz version 1.2, use ZSelectionModifyHandler(ZSceneGraphObject aFilteredMouseEventSource, ZGroup aMarqueeLayer) instead.

Method Detail

getMouseFilter

public ZMouseFilter getMouseFilter()
Modifying the selection works with BUTTON1 by default.

Overrides:
getMouseFilter in class ZFilteredEventHandler
Returns:
the filter that is currently in effect.

filteredMousePressed

protected void filteredMousePressed(ZMouseEvent e)
On mouse pressed try to select the node under the cursor.

Overrides:
filteredMousePressed in class ZDragSequenceEventHandler
Parameters:
e - the filtered mouse pressed event.

startDrag

protected void startDrag(ZMouseEvent e)
Forward the message to startMarqueeSelection if shouldStartMarqueeSelection returns true. Otherwise make the mouse filter reject all events until the next mouse pressed that it sees.

Overrides:
startDrag in class ZDragSequenceEventHandler
Parameters:
e - the event starting the drag sequence.

dragInScreenCoords

protected void dragInScreenCoords(ZMouseEvent e,
                                  java.awt.geom.Dimension2D aScreenDelta)
Forward the message to modifyMarqueeSelection.

Overrides:
dragInScreenCoords in class ZDragSequenceEventHandler
Parameters:
e - the event causing the drag.
aScreenDelta - the change in mouse position between the current and last filtered mouse events.

endDrag

protected void endDrag(ZMouseEvent e)
Forward the message to endMarqueeSelection.

Overrides:
endDrag in class ZDragSequenceEventHandler
Parameters:
e - the event causing the end of the drag sequence.

makeSelection

protected void makeSelection(ZNode aNode,
                             ZMouseEvent e)
Select aNode. If the event isOptionSelection then option select the node, otherwise unselect all nodes and then select aNode.


getNodeToSelect

protected ZNode getNodeToSelect(ZMouseEvent e)
Return the node that should be selected for the given event, null if no node should be selected.


unselectAll

protected void unselectAll()
Unselect all selected nodes seen from the current interaction camera.


startMarqueeSelection

protected void startMarqueeSelection(ZMouseEvent e)
Start a new marquee selection. This creates a new marquee visual component and adds it to the marquee layer.


modifyMarqueeSelection

protected void modifyMarqueeSelection(ZMouseEvent e,
                                      java.awt.geom.Dimension2D aScreenDelta)
Modify the current marquee selection by aScreenDelta. This will update the current nodes that are selected and the current shape of the marquee.


endMarqueeSelection

protected void endMarqueeSelection(ZMouseEvent e)
Remove the marquee visual leaf and set the last marquee selection to null.


shouldStartMarqueeSelection

protected boolean shouldStartMarqueeSelection(ZMouseEvent e)
Return true if no node is currently under the cursor that should be selected.


getResizedMarqueeBounds

protected ZBounds getResizedMarqueeBounds(ZMouseEvent e,
                                          java.awt.geom.Dimension2D aScreenDelta)
Resize the marquee by aScreenDelta and return the resulting bounds.


getNewMarqueeSelection

protected java.util.Collection getNewMarqueeSelection(ZBounds aBounds)
Return the collection of nodes that intersect aBounds from the interaction cameras perspective.


getLastMarqueeSelection

protected java.util.Collection getLastMarqueeSelection()
Get the collection of nodes that were in the last marquee selection.


setLastMarqueeSelection

protected void setLastMarqueeSelection(java.util.Collection aCollection)
Set the collection of nodes that were in the last marquee selection.


getMarqueeLayer

public ZGroup getMarqueeLayer()
Get the layer that the marquee upon which the marquee should be drawn.


setMarqueeLayer

public void setMarqueeLayer(ZGroup aGroup)
Set the layer tha the marquee upon which the marquee should be drawn.


getMarqueeLeaf

public ZVisualLeaf getMarqueeLeaf()
Return the leaf from which the marquee visual component should hang.


setMarqueeLeaf

public void setMarqueeLeaf(ZVisualLeaf aMarquee)
Set the leaf from which the marquee visual component should hang.


getMarqueeVisualComponent

public ZVisualComponent getMarqueeVisualComponent()
Return the visual component used to draw the marquee.


setMarqueeVisualComponent

public void setMarqueeVisualComponent(ZVisualComponent aMarquee)
Set the visual component used to draw the marquee.


setMarqueeBounds

public void setMarqueeBounds(ZBounds aBounds)
Set the bounds of the marquee visual component to the new bounds.


isOptionSelection

protected boolean isOptionSelection(ZMouseEvent e)
Return true if the event is an option selection. Option selection events select unselected nodes, and deselect selected nodes.


setActive

public void setActive(boolean active)
Specifies whether this event handler is active or not. An active event handler is registered with its event sources for events. An inactive event handler is not registered with its event sources and so will not receive events.

Specified by:
setActive in interface ZEventHandler
Overrides:
setActive in class ZFilteredEventHandler
Parameters:
active - true to make this event handler active.


Copyright 2003 by University of Maryland, College Park, MD 20742, USA All rights reserved.