edu.umd.cs.piccolox.event
Class PSelectionEventHandler

java.lang.Object
  extended by edu.umd.cs.piccolo.event.PBasicInputEventHandler
      extended by edu.umd.cs.piccolo.event.PDragSequenceEventHandler
          extended by edu.umd.cs.piccolox.event.PSelectionEventHandler
All Implemented Interfaces:
PInputEventListener, java.util.EventListener
Direct Known Subclasses:
PSWTSelectionEventHandler

public class PSelectionEventHandler
extends PDragSequenceEventHandler

PSelectionEventHandler provides standard interaction for selection. Clicking selects the object under the cursor. Shift-clicking allows multiple objects to be selected. Dragging offers marquee selection. Pressing the delete key deletes the selection by default.

Version:
1.0
Author:
Ben Bederson

Nested Class Summary
protected  class PSelectionEventHandler.BoundsFilter
           
 
Field Summary
static java.lang.String SELECTION_CHANGED_NOTIFICATION
           
 
Constructor Summary
PSelectionEventHandler(PNode marqueeParent, java.util.List selectableParents)
          Creates a selection event handler.
PSelectionEventHandler(PNode marqueeParent, PNode selectableParent)
          Creates a selection event handler.
 
Method Summary
 void addSelectableParent(PNode node)
           
protected  void computeMarqueeSelection(PInputEvent pie)
           
protected  void computeOptionMarqueeSelection(PInputEvent pie)
           
protected  PNodeFilter createNodeFilter(PBounds bounds)
           
 void decorateSelectedNode(PNode node)
           
protected  void drag(PInputEvent e)
          Subclasses should override this method to get notified of the drag events in a drag sequence.
protected  void dragActivityStep(PInputEvent aEvent)
          This gets called continuously during the drag, and is used to animate the marquee
protected  void dragStandardSelection(PInputEvent e)
           
protected  void endDrag(PInputEvent e)
          Subclasses should override this method to get notified of the end event in a drag sequence.
protected  void endMarqueeSelection(PInputEvent e)
           
protected  void endStandardSelection(PInputEvent e)
           
protected  PBounds getMarqueeBounds()
           
 java.awt.Paint getMarqueePaint()
          Indicates the color used to paint the marquee.
 float getMarqueePaintTransparency()
          Indicates the transparency level for the interior of the marquee.
 java.util.Collection getSelectableParents()
           
 java.util.Collection getSelection()
          Returns a copy of the currently selected nodes.
 java.util.Collection getSelectionReference()
          Gets a reference to the currently selected nodes.
 boolean getSupportDeleteKey()
           
protected  void init()
           
protected  void initializeMarquee(PInputEvent e)
           
protected  void initializeSelection(PInputEvent pie)
           
 boolean isDeleteKeyActive()
           
protected  boolean isMarqueeSelection(PInputEvent pie)
           
 boolean isOptionSelection(PInputEvent pie)
           
protected  boolean isSelectable(PNode node)
          Determine if the specified node is selectable (i.e., if it is a child of the one the list of selectable parents.
 boolean isSelected(PNode node)
           
 void keyPressed(PInputEvent e)
          Delete selection when delete key is pressed (if enabled)
 void removeSelectableParent(PNode node)
           
 void select(java.util.Collection items)
           
 void select(java.util.Map items)
           
 void select(PNode node)
           
 void setDeleteKeyActive(boolean deleteKeyActive)
          Specifies if the DELETE key should delete the selection
 void setMarqueePaint(java.awt.Paint paint)
          Sets the color used to paint the marquee.
 void setMarqueePaintTransparency(float marqueePaintTransparency)
          Sets the transparency level for the interior of the marquee.
 void setSelectableParent(PNode node)
           
 void setSelectableParents(java.util.Collection c)
           
protected  void startDrag(PInputEvent e)
          Subclasses should override this method to get notified of the start of a new drag sequence.
protected  void startMarqueeSelection(PInputEvent e)
           
protected  void startOptionMarqueeSelection(PInputEvent e)
           
protected  void startStandardOptionSelection(PInputEvent pie)
           
protected  void startStandardSelection(PInputEvent pie)
           
 void undecorateSelectedNode(PNode node)
           
 void unselect(java.util.Collection items)
           
 void unselect(PNode node)
           
 void unselectAll()
           
protected  void updateMarquee(PInputEvent pie)
           
 
Methods inherited from class edu.umd.cs.piccolo.event.PDragSequenceEventHandler
dragActivityFinalStep, dragActivityFirstStep, getDragActivity, getMinDragStartDistance, getMousePressedCanvasPoint, isDragging, mouseDragged, mousePressed, mouseReleased, paramString, setIsDragging, setMinDragStartDistance, shouldStartDragInteraction, startDragActivity, stopDragActivity
 
Methods inherited from class edu.umd.cs.piccolo.event.PBasicInputEventHandler
acceptsEvent, getEventFilter, keyboardFocusGained, keyboardFocusLost, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, mouseWheelRotated, mouseWheelRotatedByBlock, processEvent, setEventFilter, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SELECTION_CHANGED_NOTIFICATION

public static final java.lang.String SELECTION_CHANGED_NOTIFICATION
See Also:
Constant Field Values
Constructor Detail

PSelectionEventHandler

public PSelectionEventHandler(PNode marqueeParent,
                              PNode selectableParent)
Creates a selection event handler.

Parameters:
marqueeParent - The node to which the event handler dynamically adds a marquee (temporarily) to represent the area being selected.
selectableParent - The node whose children will be selected by this event handler.

PSelectionEventHandler

public PSelectionEventHandler(PNode marqueeParent,
                              java.util.List selectableParents)
Creates a selection event handler.

Parameters:
marqueeParent - The node to which the event handler dynamically adds a marquee (temporarily) to represent the area being selected.
selectableParents - A list of nodes whose children will be selected by this event handler.
Method Detail

init

protected void init()

select

public void select(java.util.Collection items)

select

public void select(java.util.Map items)

select

public void select(PNode node)

decorateSelectedNode

public void decorateSelectedNode(PNode node)

unselect

public void unselect(java.util.Collection items)

unselect

public void unselect(PNode node)

undecorateSelectedNode

public void undecorateSelectedNode(PNode node)

unselectAll

public void unselectAll()

isSelected

public boolean isSelected(PNode node)

getSelection

public java.util.Collection getSelection()
Returns a copy of the currently selected nodes.


getSelectionReference

public java.util.Collection getSelectionReference()
Gets a reference to the currently selected nodes. You should not modify or store this collection.


isSelectable

protected boolean isSelectable(PNode node)
Determine if the specified node is selectable (i.e., if it is a child of the one the list of selectable parents.


addSelectableParent

public void addSelectableParent(PNode node)

removeSelectableParent

public void removeSelectableParent(PNode node)

setSelectableParent

public void setSelectableParent(PNode node)

setSelectableParents

public void setSelectableParents(java.util.Collection c)

getSelectableParents

public java.util.Collection getSelectableParents()

startDrag

protected void startDrag(PInputEvent e)
Description copied from class: PDragSequenceEventHandler
Subclasses should override this method to get notified of the start of a new drag sequence. Note that that overriding methods must still call super.startDrag() for correct behavior.

Overrides:
startDrag in class PDragSequenceEventHandler

drag

protected void drag(PInputEvent e)
Description copied from class: PDragSequenceEventHandler
Subclasses should override this method to get notified of the drag events in a drag sequence. Note that that overriding methods must still call super.startDrag() for correct behavior.

Overrides:
drag in class PDragSequenceEventHandler

endDrag

protected void endDrag(PInputEvent e)
Description copied from class: PDragSequenceEventHandler
Subclasses should override this method to get notified of the end event in a drag sequence. Note that that overriding methods must still call super.startDrag() for correct behavior.

Overrides:
endDrag in class PDragSequenceEventHandler

isOptionSelection

public boolean isOptionSelection(PInputEvent pie)

isMarqueeSelection

protected boolean isMarqueeSelection(PInputEvent pie)

initializeSelection

protected void initializeSelection(PInputEvent pie)

initializeMarquee

protected void initializeMarquee(PInputEvent e)

startOptionMarqueeSelection

protected void startOptionMarqueeSelection(PInputEvent e)

startMarqueeSelection

protected void startMarqueeSelection(PInputEvent e)

startStandardSelection

protected void startStandardSelection(PInputEvent pie)

startStandardOptionSelection

protected void startStandardOptionSelection(PInputEvent pie)

updateMarquee

protected void updateMarquee(PInputEvent pie)

computeMarqueeSelection

protected void computeMarqueeSelection(PInputEvent pie)

computeOptionMarqueeSelection

protected void computeOptionMarqueeSelection(PInputEvent pie)

createNodeFilter

protected PNodeFilter createNodeFilter(PBounds bounds)

getMarqueeBounds

protected PBounds getMarqueeBounds()

dragStandardSelection

protected void dragStandardSelection(PInputEvent e)

endMarqueeSelection

protected void endMarqueeSelection(PInputEvent e)

endStandardSelection

protected void endStandardSelection(PInputEvent e)

dragActivityStep

protected void dragActivityStep(PInputEvent aEvent)
This gets called continuously during the drag, and is used to animate the marquee

Overrides:
dragActivityStep in class PDragSequenceEventHandler

keyPressed

public void keyPressed(PInputEvent e)
Delete selection when delete key is pressed (if enabled)

Overrides:
keyPressed in class PBasicInputEventHandler

getSupportDeleteKey

public boolean getSupportDeleteKey()

isDeleteKeyActive

public boolean isDeleteKeyActive()

setDeleteKeyActive

public void setDeleteKeyActive(boolean deleteKeyActive)
Specifies if the DELETE key should delete the selection


getMarqueePaint

public java.awt.Paint getMarqueePaint()
Indicates the color used to paint the marquee.

Returns:
the paint for interior of the marquee

setMarqueePaint

public void setMarqueePaint(java.awt.Paint paint)
Sets the color used to paint the marquee.

Parameters:
paint - the paint color

getMarqueePaintTransparency

public float getMarqueePaintTransparency()
Indicates the transparency level for the interior of the marquee.

Returns:
Returns the marquee paint transparency, zero to one

setMarqueePaintTransparency

public void setMarqueePaintTransparency(float marqueePaintTransparency)
Sets the transparency level for the interior of the marquee.

Parameters:
marqueePaintTransparency - The marquee paint transparency to set.


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

Web Accessibility