Java Reference
In-Depth Information
As you can see, the process is nearly the reverse of the
addChild()
method.
Listeners are notified that the child is being removed, the
deactivate()
method is called,
removeNotify()
is called, its model and visual are unregis-
tered, its parent is set to null
,
and its children are removed. The
EditPart
is also
removed as the source or target of any connections, although the connection
itself is not removed unless both its source and target are set to null.
Note that
EditPart
s are not recycled. Even an Undo operation causes a
new
EditPart
object to be created, so it's important to not reference an
EditPart
directly with a
Command
, for example.
9.2.5 Tools and the Palette
Most interaction with GEF objects happens through tools selected from the
palette. Tools themselves function as state machines, responding to SWT events
(mouse and keyboard) to perform actions such as showing or hiding feedback,
updating the cursor, obtaining commands from
EditPart
s, executing com-
mands, and so on. Actually, input flows from the viewer, to the
EditDomain
, to
the active tool. Only one active tool for all viewers in the
EditDomain
exists—
typically, the one selected in the palette.
The GEF palette is available as a standalone view (
Window
→
Show View
→
Other
Palette
) or within the editor itself. The palette is an optional
feature, although most GEF applications use it. Figure 9-10 shows the
FlyoutPaletteComposite
used in the scenario diagram example.
→
General
→
Figure 9-10
GEF palette
Search WWH ::
Custom Search