Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

phoebe.event
Class PSelectionHandler  view PSelectionHandler download PSelectionHandler.java

java.lang.Object
  extended byPDragSequenceEventHandler
      extended byphoebe.event.PSelectionHandler

public class PSelectionHandler
extends PDragSequenceEventHandler

PSelectionHandler 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

Nested Class Summary
protected  class PSelectionHandler.BoundsFilter
           
 
Field Summary
private  java.util.Hashtable allItems
           
private  java.awt.geom.Point2D canvasPressPt
           
(package private) static int DASH_WIDTH
           
private  boolean deleteKeyActive
           
private  PPath marquee
           
private  java.util.HashMap marqueeMap
           
private  PNode marqueeParent
           
private  boolean mouseDown
           
(package private) static int NUM_STROKES
           
private  PNode pressNode
           
private  java.awt.geom.Point2D presspt
           
private  java.util.ArrayList selectableParents
           
private  java.util.Hashtable selection
           
static java.lang.String SELECTION_CHANGED_NOTIFICATION
           
private  boolean selectionMade
           
private  float strokeNum
           
private  java.awt.Stroke[] strokes
           
private  java.util.ArrayList unselectList
           
 
Constructor Summary
PSelectionHandler(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)
           
protected  void dragStandardSelection(PInputEvent e)
           
protected  void endDrag(PInputEvent e)
           
protected  void endMarqueeSelection(PInputEvent e)
           
protected  void endStandardSelection(PInputEvent e)
           
protected  PBounds getMarqueeBounds()
           
 java.util.Collection getSelectableParents()
           
 java.util.Collection getSelection()
           
 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 setDeleteKeyActive(boolean deleteKeyActive)
          Specifies if the DELETE key should delete the selection
 void setSelectableParent(PNode node)
           
 void setSelectableParents(java.util.Collection c)
           
protected  void startDrag(PInputEvent e)
           
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 unselectAll()
           
protected  void updateMarquee(PInputEvent pie)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTION_CHANGED_NOTIFICATION

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

DASH_WIDTH

static final int DASH_WIDTH
See Also:
Constant Field Values

NUM_STROKES

static final int NUM_STROKES
See Also:
Constant Field Values

selection

private java.util.Hashtable selection

selectableParents

private java.util.ArrayList selectableParents

marquee

private PPath marquee

marqueeParent

private PNode marqueeParent

presspt

private java.awt.geom.Point2D presspt

canvasPressPt

private java.awt.geom.Point2D canvasPressPt

strokeNum

private float strokeNum

strokes

private java.awt.Stroke[] strokes

allItems

private java.util.Hashtable allItems

unselectList

private java.util.ArrayList unselectList

marqueeMap

private java.util.HashMap marqueeMap

pressNode

private PNode pressNode

deleteKeyActive

private boolean deleteKeyActive

mouseDown

private boolean mouseDown

selectionMade

private boolean selectionMade
Constructor Detail

PSelectionHandler

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

Method Detail

init

protected void init()

select

public void select(java.util.Collection items)

select

public void select(java.util.Map items)

decorateSelectedNode

public void decorateSelectedNode(PNode node)

unselect

public void unselect(java.util.Collection items)

undecorateSelectedNode

public void undecorateSelectedNode(PNode node)

unselectAll

public void unselectAll()

isSelected

public boolean isSelected(PNode node)

getSelection

public java.util.Collection getSelection()

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)

drag

protected void drag(PInputEvent e)

endDrag

protected void endDrag(PInputEvent e)

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)

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