|
Eclipse GEF 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.gef.dnd.DelegatingDragAdapter
A DragSourceListener that maintains and delegates to a set of TransferDragSourceListener
s. Each TransferDragSourceListener can then be implemented
as if it were the DragSource's only DragSourceListener.
When a native Drag is started, a subset of all TransferDragSourceListeners
is generated and stored in a list of active listeners. This subset is calculated
by forwarding DragSourceListener.dragStart(DragSourceEvent)
to every listener,
and inspecting changes to the doit
field. The
DragSource
's set of supported Transfer types (DragSource.setTransfer(Transfer[])
) is updated to reflect the Transfer types
corresponding to the active listener subset.
If and when dragSetData(DragSourceEvent)
is called, a single
TransferDragSourceListener
is chosen, and only it is allowed to set the
drag data. The chosen listener is the first listener in the subset of active listeners
whose Transfer supports (Transfer.isSupportedType(TransferData)
) the dataType
on the DragSourceEvent
.
Constructor Summary | |
DelegatingDragAdapter()
|
Method Summary | |
void |
addDragSourceListener(TransferDragSourceListener listener)
Adds the given TransferDragSourceListener. |
void |
dragFinished(DragSourceEvent event)
The drop has successfully completed. |
void |
dragSetData(DragSourceEvent event)
Updates the current listener and then forwards the event to it. |
void |
dragStart(DragSourceEvent event)
Forwards this event to each listener. |
Transfer[] |
getTransferTypes()
Combines the Transfer s from every TransferDragSourceListener. |
boolean |
isEmpty()
Returns true if there are no listeners to delegate the events to. |
void |
removeDragSourceListener(TransferDragSourceListener listener)
Adds the given TransferDragSourceListener. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DelegatingDragAdapter()
Method Detail |
public void addDragSourceListener(TransferDragSourceListener listener)
listener
- the new listenerpublic void dragFinished(DragSourceEvent event)
dragFinished
in interface DragSourceListener
DragSourceListener.dragFinished(DragSourceEvent)
public void dragSetData(DragSourceEvent event)
dragSetData
in interface DragSourceListener
DragSourceListener.dragSetData(DragSourceEvent)
public void dragStart(DragSourceEvent event)
event.doit
to false
if it cannot handle the drag operation.
If a listener can handle the drag, it is added to the list of active listeners. The
drag is aborted if there are no listeners that can handle it.
dragStart
in interface DragSourceListener
DragSourceListener.dragStart(DragSourceEvent)
public Transfer[] getTransferTypes()
Transfer
s from every TransferDragSourceListener.
Transfer
spublic boolean isEmpty()
true
if there are no listeners to delegate the events to.
true
if there are no TransferDragSourceListeners
public void removeDragSourceListener(TransferDragSourceListener listener)
listener
- the listener being removed
|
Eclipse GEF 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |