GEF v2.0

org.eclipse.gef.dnd
Class DelegatingDragAdapter

java.lang.Object
  |
  +--org.eclipse.gef.dnd.DelegatingDragAdapter
All Implemented Interfaces:
DragSourceListener, EventListener, org.eclipse.swt.internal.SWTEventListener

public class DelegatingDragAdapter
extends Object
implements DragSourceListener

A DragSourceListener that allows many TransferDragSourceListeners to be added to it. When the DragSource fires a DragSourceEvent, this listener calculates which one of the added listeners is able to complete the drag operation and forwards the event to that listener.


Constructor Summary
DelegatingDragAdapter()
           
 
Method Summary
 void addDragSourceListener(TransferDragSourceListener listener)
          Adds the given TransferDragSourceListener to the list of listeners.
 void dragFinished(DragSourceEvent event)
          Forwards this event to the current listener.
 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()
          Adds the Transfer from each listener to an array and returns that array.
 boolean isEmpty()
          Returns true if there are no listeners to delegate the events to.
 void removeDragSourceListener(TransferDragSourceListener listener)
          Removes the given TransferDragSourceListener from the list of listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingDragAdapter

public DelegatingDragAdapter()
Method Detail

addDragSourceListener

public void addDragSourceListener(TransferDragSourceListener listener)
Adds the given TransferDragSourceListener to the list of listeners.

dragFinished

public void dragFinished(DragSourceEvent event)
Forwards this event to the current listener. Doesn't update the current listener, since the current listener is already the one that completed the drag operation.
Specified by:
dragFinished in interface DragSourceListener
See Also:
DragSourceListener.dragFinished(DragSourceEvent)

dragSetData

public void dragSetData(DragSourceEvent event)
Updates the current listener and then forwards the event to it.
Specified by:
dragSetData in interface DragSourceListener
See Also:
DragSourceListener.dragSetData(DragSourceEvent)

dragStart

public void dragStart(DragSourceEvent event)
Forwards this event to each listener. It is expected that a listener will set 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.
Specified by:
dragStart in interface DragSourceListener
See Also:
DragSourceListener.dragStart(DragSourceEvent)

getTransferTypes

public Transfer[] getTransferTypes()
Adds the Transfer from each listener to an array and returns that array.

isEmpty

public boolean isEmpty()
Returns true if there are no listeners to delegate the events to.

removeDragSourceListener

public void removeDragSourceListener(TransferDragSourceListener listener)
Removes the given TransferDragSourceListener from the list of listeners.

GEF v2.0