edu.umd.cs.piccolox.event
Class GuessSelectionEventHandler

java.lang.Object
  extended byedu.umd.cs.piccolo.event.PBasicInputEventHandler
      extended byedu.umd.cs.piccolo.event.PDragSequenceEventHandler
          extended byedu.umd.cs.piccolox.event.GuessSelectionEventHandler
All Implemented Interfaces:
EventListener, PInputEventListener
Direct Known Subclasses:
MySelectionHandler

public class GuessSelectionEventHandler
extends PDragSequenceEventHandler

GuessSelectionEventHandler 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

Field Summary
static String SELECTION_CHANGED_NOTIFICATION
           
 
Constructor Summary
GuessSelectionEventHandler(PNode marqueeParent, List selectableParents)
          Creates a selection event handler.
GuessSelectionEventHandler(PNode marqueeParent, PNode selectableParent)
          Creates a selection event handler.
 
Method Summary
 void addSelectableParent(PNode node)
           
 void decorateSelectedNode(PNode node)
           
 Paint getMarqueePaint()
          Indicates the color used to paint the marquee.
 float getMarqueePaintTransparency()
          Indicates the transparency level for the interior of the marquee.
 Collection getSelectableParents()
           
 Collection getSelection()
          Returns a copy of the currently selected nodes.
 Collection getSelectionReference()
          Gets a reference to the currently selected nodes.
 boolean getSupportDeleteKey()
           
 boolean isDeleteKeyActive()
           
 boolean isOptionSelection(PInputEvent pie)
           
 boolean isSelected(PNode node)
           
 void keyPressed(PInputEvent e)
          Delete selection when delete key is pressed (if enabled)
 void removeSelectableParent(PNode node)
           
 void select(Collection items)
           
 void select(Map items)
           
 void select(PNode node)
           
 void setDeleteKeyActive(boolean deleteKeyActive)
          Specifies if the DELETE key should delete the selection
 void setMarqueePaint(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(Collection c)
           
 void switchTo(PNode selectableParent)
           
 void undecorateSelectedNode(PNode node)
           
 void unselect(Collection items)
           
 void unselect(PNode node)
           
 void unselectAll()
           
 
Methods inherited from class edu.umd.cs.piccolo.event.PDragSequenceEventHandler
getMinDragStartDistance, getMousePressedCanvasPoint, isDragging, mouseDragged, mousePressed, mouseReleased, setIsDragging, setMinDragStartDistance
 
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SELECTION_CHANGED_NOTIFICATION

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

GuessSelectionEventHandler

public GuessSelectionEventHandler(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.

GuessSelectionEventHandler

public GuessSelectionEventHandler(PNode marqueeParent,
                                  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

switchTo

public void switchTo(PNode selectableParent)

select

public void select(Collection items)

select

public void select(Map items)

select

public void select(PNode node)

decorateSelectedNode

public void decorateSelectedNode(PNode node)

unselect

public void unselect(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 Collection getSelection()
Returns a copy of the currently selected nodes.


getSelectionReference

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


addSelectableParent

public void addSelectableParent(PNode node)

removeSelectableParent

public void removeSelectableParent(PNode node)

setSelectableParent

public void setSelectableParent(PNode node)

setSelectableParents

public void setSelectableParents(Collection c)

getSelectableParents

public Collection getSelectableParents()

isOptionSelection

public boolean isOptionSelection(PInputEvent pie)

keyPressed

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


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 Paint getMarqueePaint()
Indicates the color used to paint the marquee.

Returns:
the paint for interior of the marquee

setMarqueePaint

public void setMarqueePaint(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.