at.tuwien.ifs.somtoolbox.apps.viewer.handlers
Class LineSelectionEventHandler

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
              extended by at.tuwien.ifs.somtoolbox.apps.viewer.handlers.OrderedPSelectionEventHandler
                  extended by at.tuwien.ifs.somtoolbox.apps.viewer.handlers.LineSelectionEventHandler
All Implemented Interfaces:
edu.umd.cs.piccolo.event.PInputEventListener, EventListener

public class LineSelectionEventHandler
extends OrderedPSelectionEventHandler

Implements the line selection model, everything below a drawn line is selected.

Version:
$Id: LineSelectionEventHandler.java 3888 2010-11-02 17:42:53Z frank $
Author:
Robert Neumayer

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.umd.cs.piccolox.event.PSelectionEventHandler
edu.umd.cs.piccolox.event.PSelectionEventHandler.BoundsFilter
 
Field Summary
private  HashMap<Object,Boolean> allItems
           
static float BLUR_FACTOR
           
(package private)  edu.umd.cs.piccolox.nodes.PLine currentLine
           
(package private) static Point2D endPoint
           
(package private) static Point2D lastPoint
           
private  Vector<edu.umd.cs.piccolo.PNode> lineParts
           
private  edu.umd.cs.piccolo.PNode marqueeParent
           
(package private) static Point2D nextPoint
           
private  edu.umd.cs.piccolo.PNode pressNode
           
private  List<edu.umd.cs.piccolo.PNode> selectableParents
           
static String SELECTION_CHANGED_NOTIFICATION
           
private  String selectionStatusString
           
(package private) static Point2D startPoint
           
 
Fields inherited from class at.tuwien.ifs.somtoolbox.apps.viewer.handlers.OrderedPSelectionEventHandler
currentSelection
 
Constructor Summary
LineSelectionEventHandler(edu.umd.cs.piccolo.PNode marqueeParent, edu.umd.cs.piccolo.PNode selectableParent)
          Creates a selection event handler.
 
Method Summary
 void decorateSelectedNode(edu.umd.cs.piccolo.PNode node)
           
 void deleteOldLine()
          delete the old selection / line
protected  void drag(edu.umd.cs.piccolo.event.PInputEvent e)
           
protected  void endMarqueeSelection(edu.umd.cs.piccolo.event.PInputEvent e)
           
protected  void endStandardSelection(edu.umd.cs.piccolo.event.PInputEvent e)
           
 void init()
           
protected  void initializeMarquee(edu.umd.cs.piccolo.event.PInputEvent e)
           
protected  boolean isMarqueeSelection(edu.umd.cs.piccolo.event.PInputEvent pie)
           
protected  boolean onSelection(GeneralUnitPNode upn, Point2D selectedPoint)
          check if the given Point lies on the given UnitPNode
protected  void startDrag(edu.umd.cs.piccolo.event.PInputEvent e)
           
protected  void startMarqueeSelection(edu.umd.cs.piccolo.event.PInputEvent e)
           
 void undecorateSelectedNode(edu.umd.cs.piccolo.PNode node)
           
protected  void updateWhatever(edu.umd.cs.piccolo.event.PInputEvent e)
          adds the node specified by the event e to the current selection (if it is not selected already)
 
Methods inherited from class at.tuwien.ifs.somtoolbox.apps.viewer.handlers.OrderedPSelectionEventHandler
alreadySelected, getSelection, select, select, select, unselect, unselect, unselectAll
 
Methods inherited from class edu.umd.cs.piccolox.event.PSelectionEventHandler
addSelectableParent, computeMarqueeSelection, computeOptionMarqueeSelection, createNodeFilter, dragActivityStep, dragStandardSelection, endDrag, getMarqueeBounds, getMarqueePaint, getMarqueePaintTransparency, getSelectableParents, getSelectionReference, getSupportDeleteKey, initializeSelection, isDeleteKeyActive, isOptionSelection, isSelectable, isSelected, keyPressed, removeSelectableParent, setDeleteKeyActive, setMarqueePaint, setMarqueePaintTransparency, setSelectableParent, setSelectableParents, startOptionMarqueeSelection, startStandardOptionSelection, startStandardSelection, updateMarquee
 
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 String SELECTION_CHANGED_NOTIFICATION
See Also:
Constant Field Values

BLUR_FACTOR

public static final float BLUR_FACTOR
See Also:
Constant Field Values

selectionStatusString

private String selectionStatusString

lineParts

private Vector<edu.umd.cs.piccolo.PNode> lineParts

selectableParents

private List<edu.umd.cs.piccolo.PNode> selectableParents

marqueeParent

private edu.umd.cs.piccolo.PNode marqueeParent

allItems

private HashMap<Object,Boolean> allItems

pressNode

private edu.umd.cs.piccolo.PNode pressNode

startPoint

static Point2D startPoint

lastPoint

static Point2D lastPoint

nextPoint

static Point2D nextPoint

endPoint

static Point2D endPoint

currentLine

edu.umd.cs.piccolox.nodes.PLine currentLine
Constructor Detail

LineSelectionEventHandler

public LineSelectionEventHandler(edu.umd.cs.piccolo.PNode marqueeParent,
                                 edu.umd.cs.piccolo.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.
Method Detail

decorateSelectedNode

public void decorateSelectedNode(edu.umd.cs.piccolo.PNode node)
Overrides:
decorateSelectedNode in class edu.umd.cs.piccolox.event.PSelectionEventHandler

undecorateSelectedNode

public void undecorateSelectedNode(edu.umd.cs.piccolo.PNode node)
Overrides:
undecorateSelectedNode in class edu.umd.cs.piccolox.event.PSelectionEventHandler

init

public void init()
Overrides:
init in class OrderedPSelectionEventHandler

deleteOldLine

public void deleteOldLine()
delete the old selection / line


startDrag

protected void startDrag(edu.umd.cs.piccolo.event.PInputEvent e)
Overrides:
startDrag in class OrderedPSelectionEventHandler

drag

protected void drag(edu.umd.cs.piccolo.event.PInputEvent e)
Overrides:
drag in class edu.umd.cs.piccolox.event.PSelectionEventHandler

isMarqueeSelection

protected boolean isMarqueeSelection(edu.umd.cs.piccolo.event.PInputEvent pie)
Overrides:
isMarqueeSelection in class edu.umd.cs.piccolox.event.PSelectionEventHandler

initializeMarquee

protected void initializeMarquee(edu.umd.cs.piccolo.event.PInputEvent e)
Overrides:
initializeMarquee in class edu.umd.cs.piccolox.event.PSelectionEventHandler

startMarqueeSelection

protected void startMarqueeSelection(edu.umd.cs.piccolo.event.PInputEvent e)
Overrides:
startMarqueeSelection in class edu.umd.cs.piccolox.event.PSelectionEventHandler

updateWhatever

protected void updateWhatever(edu.umd.cs.piccolo.event.PInputEvent e)
adds the node specified by the event e to the current selection (if it is not selected already)


onSelection

protected boolean onSelection(GeneralUnitPNode upn,
                              Point2D selectedPoint)
check if the given Point lies on the given UnitPNode

Returns:
- true if coordinates match, false if not

endMarqueeSelection

protected void endMarqueeSelection(edu.umd.cs.piccolo.event.PInputEvent e)
Overrides:
endMarqueeSelection in class edu.umd.cs.piccolox.event.PSelectionEventHandler

endStandardSelection

protected void endStandardSelection(edu.umd.cs.piccolo.event.PInputEvent e)
Overrides:
endStandardSelection in class edu.umd.cs.piccolox.event.PSelectionEventHandler