|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.piccolo.event.PBasicInputEventHandler
edu.umd.cs.piccolo.event.PDragSequenceEventHandler
edu.umd.cs.piccolox.event.PSelectionEventHandler
public class PSelectionEventHandler
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.
Nested Class Summary | |
---|---|
protected class |
PSelectionEventHandler.BoundsFilter
Class used to filter nodes that intersect with the marquee's bounds. |
Field Summary | |
---|---|
(package private) static int |
DASH_WIDTH
The default dash width when displaying selection rectangle. |
(package private) static int |
NUM_STROKES
|
static String |
SELECTION_CHANGED_NOTIFICATION
Notification name that identifies a change in the selection. |
Constructor Summary | |
---|---|
PSelectionEventHandler(PNode marqueeParent,
List selectableParents)
Creates a selection event handler. |
|
PSelectionEventHandler(PNode marqueeParent,
PNode selectableParent)
Creates a selection event handler. |
Method Summary | |
---|---|
void |
addSelectableParent(PNode node)
Flags the node provided as a selectable parent. |
protected void |
computeMarqueeSelection(PInputEvent pie)
Sets the selection to be all nodes under the marquee. |
protected void |
computeOptionMarqueeSelection(PInputEvent pie)
Extends the selection to include all nodes under the marquee. |
protected PNodeFilter |
createNodeFilter(PBounds bounds)
Creates a node filter that will filter all nodes not touching the bounds provided. |
void |
decorateSelectedNode(PNode node)
Adds bound handles to the provided node. |
protected void |
drag(PInputEvent event)
Updates the marquee to the new bounds caused by the drag. |
protected void |
dragActivityStep(PInputEvent aEvent)
This gets called continuously during the drag, and is used to animate the marquee. |
protected void |
dragStandardSelection(PInputEvent e)
Drag selected nodes. |
protected void |
endDrag(PInputEvent event)
Ends the selection marquee when the drag is ended. |
protected void |
endMarqueeSelection(PInputEvent e)
Removes marquee and clears selection. |
protected void |
endStandardSelection(PInputEvent e)
Ends the "pressed" state of the previously pressed node (if any). |
protected PBounds |
getMarqueeBounds()
Returns the bounds of the current selection marquee. |
Paint |
getMarqueePaint()
Indicates the color used to paint the marquee. |
float |
getMarqueePaintTransparency()
Indicates the transparency level for the interior of the marquee. |
Collection |
getSelectableParents()
Returns all selectable parents. |
Collection |
getSelection()
Returns a copy of the currently selected nodes. |
Collection |
getSelectionReference()
Gets a reference to the currently selected nodes. |
boolean |
getSupportDeleteKey()
Returns whether the delete key is a supported action. |
protected void |
init()
Initializes the PSelectionEventHandler with a marquee stroke. |
protected void |
initializeMarquee(PInputEvent event)
Creates an empty marquee child for use in displaying the marquee around the selection. |
protected void |
initializeSelection(PInputEvent pie)
Starts a selection based on the provided event. |
boolean |
isDeleteKeyActive()
Returns whether the delete key is a supported action. |
protected boolean |
isMarqueeSelection(PInputEvent pie)
Tests the input event to see if it is selecting a new node. |
boolean |
isOptionSelection(PInputEvent pie)
Used to test whether the event is one that changes the selection. |
protected boolean |
isSelectable(PNode node)
Determine if the specified node can be selected (i.e., if it is a child of the one the list of nodes that can be selected). |
boolean |
isSelected(PNode node)
Returns true is provided node is selected. |
void |
keyPressed(PInputEvent e)
Delete selection when delete key is pressed (if enabled). |
void |
removeSelectableParent(PNode node)
Removes the node provided from the set of selectable parents. |
void |
select(Collection items)
Marks all items as selected. |
void |
select(Map items)
Marks all keys as selected. |
void |
select(PNode node)
Selected the provided node if not already selected. |
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)
Sets the node provided as the *only* selectable parent. |
void |
setSelectableParents(Collection c)
Sets the collection of selectable parents as the only parents that are selectable. |
protected void |
startDrag(PInputEvent e)
Overrides method in PDragSequenceEventHandler so that, selections have marquees. |
protected void |
startMarqueeSelection(PInputEvent event)
Invoked at the start of the selection. |
protected void |
startOptionMarqueeSelection(PInputEvent event)
Invoked when the marquee is being used to extend the selection. |
protected void |
startStandardOptionSelection(PInputEvent pie)
Toggle the current selection on the node that was just pressed, but leave the rest of the selected nodes unchanged. |
protected void |
startStandardSelection(PInputEvent pie)
If the pressed node is not selected unselect all nodes and select the pressed node if it allows it. |
void |
undecorateSelectedNode(PNode node)
Removes bounds handles from node. |
void |
unselect(Collection items)
Removes all nodes provided from the selection. |
void |
unselect(PNode node)
Removes node from selection. |
void |
unselectAll()
Empties the selection. |
protected void |
updateMarquee(PInputEvent pie)
Updates the marquee rectangle as the result of a drag. |
Methods inherited from class edu.umd.cs.piccolo.event.PDragSequenceEventHandler |
---|
dragActivityFinalStep, dragActivityFirstStep, getDragActivity, getMinDragStartDistance, getMousePressedCanvasPoint, isDragging, mouseDragged, mousePressed, mouseReleased, 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, paramString, processEvent, setEventFilter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SELECTION_CHANGED_NOTIFICATION
static final int DASH_WIDTH
static final int NUM_STROKES
Constructor Detail |
---|
public PSelectionEventHandler(PNode marqueeParent, PNode selectableParent)
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.public PSelectionEventHandler(PNode marqueeParent, List selectableParents)
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 |
---|
protected void init()
public void select(Collection items)
items
- collection of items to be selectedpublic void select(Map items)
items
- map where keys are to be selectedpublic void select(PNode node)
node
- node to be selectedpublic void decorateSelectedNode(PNode node)
node
- node to be decoratedpublic void unselect(Collection items)
items
- items to remove form the selectionpublic void unselect(PNode node)
node
- node to be removed from selectionpublic void undecorateSelectedNode(PNode node)
node
- to have handles removed frompublic void unselectAll()
public boolean isSelected(PNode node)
node
- - node to be tested
public Collection getSelection()
public Collection getSelectionReference()
protected boolean isSelectable(PNode node)
node
- node being tested
public void addSelectableParent(PNode node)
node
- to flag as selectablepublic void removeSelectableParent(PNode node)
node
- to remove from selectable parentspublic void setSelectableParent(PNode node)
node
- node to become the 1 and only selectable parentpublic void setSelectableParents(Collection c)
c
- nodes to become selectable parents.public Collection getSelectableParents()
protected void startDrag(PInputEvent e)
startDrag
in class PDragSequenceEventHandler
e
- the event that started the dragprotected void drag(PInputEvent event)
drag
in class PDragSequenceEventHandler
event
- drag eventprotected void endDrag(PInputEvent event)
endDrag
in class PDragSequenceEventHandler
event
- the event responsible for ending the dragpublic boolean isOptionSelection(PInputEvent pie)
pie
- The event under test
protected boolean isMarqueeSelection(PInputEvent pie)
pie
- event under test
protected void initializeSelection(PInputEvent pie)
pie
- event used to populate the selectionprotected void initializeMarquee(PInputEvent event)
event
- event responsible for the initializationprotected void startOptionMarqueeSelection(PInputEvent event)
event
- event causing the option selectionprotected void startMarqueeSelection(PInputEvent event)
event
- event causing a new marquee selectionprotected void startStandardSelection(PInputEvent pie)
pie
- event that started the selectionprotected void startStandardOptionSelection(PInputEvent pie)
pie
- event responsible for the change in selectionprotected void updateMarquee(PInputEvent pie)
pie
- event responsible for the change in the marqueeprotected void computeMarqueeSelection(PInputEvent pie)
pie
- event responsible for the new selectionprotected void computeOptionMarqueeSelection(PInputEvent pie)
pie
- event responsible for the change in selectionprotected PNodeFilter createNodeFilter(PBounds bounds)
bounds
- will be used to filter matches
protected PBounds getMarqueeBounds()
protected void dragStandardSelection(PInputEvent e)
e
- event responsible for the dragprotected void endMarqueeSelection(PInputEvent e)
e
- event responsible for the end of the selectionprotected void endStandardSelection(PInputEvent e)
e
- event responsible for the end in the selectionprotected void dragActivityStep(PInputEvent aEvent)
dragActivityStep
in class PDragSequenceEventHandler
aEvent
- event responsible for this step in the drag sequencepublic void keyPressed(PInputEvent e)
keyPressed
in class PBasicInputEventHandler
e
- the key press eventpublic boolean getSupportDeleteKey()
public boolean isDeleteKeyActive()
public void setDeleteKeyActive(boolean deleteKeyActive)
deleteKeyActive
- state to set for the delete action true = enabledpublic Paint getMarqueePaint()
public void setMarqueePaint(Paint paint)
paint
- the paint colorpublic float getMarqueePaintTransparency()
public void setMarqueePaintTransparency(float marqueePaintTransparency)
marqueePaintTransparency
- The marquee paint transparency to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |