public class DelegatingDragAdapter extends DelegatingDragAdapter
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 DelegatingDragAdapter.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 and Description |
---|
DelegatingDragAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
addDragSourceListener(TransferDragSourceListener listener)
Deprecated.
|
Transfer[] |
getTransferTypes()
Deprecated.
call getTransfers() instead.
|
void |
removeDragSourceListener(TransferDragSourceListener listener)
Deprecated.
|
addDragSourceListener, dragFinished, dragSetData, dragStart, getTransfers, isEmpty, removeDragSourceListener
public void addDragSourceListener(TransferDragSourceListener listener)
listener
- the new listenerpublic Transfer[] getTransferTypes()
Transfer
s from every
TransferDragSourceListener.Transfer
spublic void removeDragSourceListener(TransferDragSourceListener listener)
listener
- the listener being removedCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.