Java Reference
In-Depth Information
Table 9-2
Selection Interactions
Tools
Requests
Edit Policies and Roles
Actions
SelectionTool
SelectionRequest
SelectionEditPolicy
SelectAllAction
MarqueeTool
DirectEditRequest
DirectEditPolicy
SelectEditPartTracker
REQ_SELECTION_
SELECTION_
HOVER
FEEDBACK_ROLE
REQ_OPEN
*GraphicalViewer
REQ_DIRECT_EDIT
KeyHandler
The Selection Tool is the primary tool used in GEF and is often the default
for an application. Although item selection might seem to be the most basic inter-
action, it is actually a complex topic that requires several steps to complete.
Figure 9-11 is a sequence diagram that outlines the selection operation.
The Selection Tool obtains a helper called a DragTracker from an
EditPart or handle below the mouse when a drag occurs. A drag is defined as
a mouse button being pressed, a mouse button being released, and any events
that occur in between. Events are forwarded to the delegate so that the drag can
be handled differently based on where and how the drag originated. For exam-
ple, clicking a handle might result in resizing a shape or moving the end of a con-
nection. Clicking on an EditPart typically drags that part to a new location or
parent.
Ironically, the Selection Tool doesn't select EditPart s. All mouse clicks are
handled as drags. When the Selection Tool receives a mousedown event over a
selectable EditPart , it asks for a drag tracker. The EditPart returns a tracker
derived from SelectEditPartTracker . The tracker also receives the mouse-
down event, as well as any other events, until the mouse button is released. When
the tracker interprets a selection gesture, it modifies the viewer's selection.
Trackers even handle events such as double-click.
To continue the discussion on the selection interaction, we must first define
selection. Selection is a list o f EditPart s that an EditPartViewer maintains.
Changes to the selection are made by invoking methods on the viewer, not by
modifying the list directly. The selection is never empty. If the selection is cleared,
the viewer's contents EditPart becomes the selection. The last EditPart in the
list is considered the primary selection.
 
Search WWH ::




Custom Search