GEF v2.0

org.eclipse.gef.dnd
Class DelegatingDropAdapter

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

public class DelegatingDropAdapter
extends Object
implements DropTargetListener

A DropTargetListener that allows many TransferDropTargetListeners to be added to it. When the DropTarget fires a DropTargetEvent, this listener calculates which one of the added listeners is able to complete the drop operation and forwards the event to that listener.


Constructor Summary
DelegatingDropAdapter()
           
 
Method Summary
 void addDropTargetListener(TransferDropTargetListener listener)
          Adds the given TransferDropTargetListener to the list of listeners.
 void dragEnter(DropTargetEvent event)
          Updates the current listener and forwards this event to that listener.
 void dragLeave(DropTargetEvent event)
          Forwards this event to the current listener.
 void dragOperationChanged(DropTargetEvent event)
          Updates the current listener and forwards this event to that listener.
 void dragOver(DropTargetEvent event)
          Updates the current listener and forwards this event to that listener.
 void drop(DropTargetEvent event)
          Forwards this event to the current listener, if it is not null.
 void dropAccept(DropTargetEvent event)
          Forwards this event to the current 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 events to.
 void removeDropTargetListener(TransferDropTargetListener listener)
          Removes the given TransferDropTargetListener 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

DelegatingDropAdapter

public DelegatingDropAdapter()
Method Detail

addDropTargetListener

public void addDropTargetListener(TransferDropTargetListener listener)
Adds the given TransferDropTargetListener to the list of listeners.

dragEnter

public void dragEnter(DropTargetEvent event)
Updates the current listener and forwards this event to that listener.
Specified by:
dragEnter in interface DropTargetListener
See Also:
DropTargetListener.dragEnter(DropTargetEvent)

dragLeave

public void dragLeave(DropTargetEvent event)
Forwards this event to the current listener.
Specified by:
dragLeave in interface DropTargetListener
See Also:
DropTargetListener.dragLeave(DropTargetEvent)

dragOperationChanged

public void dragOperationChanged(DropTargetEvent event)
Updates the current listener and forwards this event to that listener.
Specified by:
dragOperationChanged in interface DropTargetListener
See Also:
DropTargetListener.dragOperationChanged(DropTargetEvent)

dragOver

public void dragOver(DropTargetEvent event)
Updates the current listener and forwards this event to that listener. If the current listener is null, event.detail is set to DND.DROP_NONE, which causes the NOT cursor to appear.
Specified by:
dragOver in interface DropTargetListener
See Also:
DropTargetListener.dragOver(DropTargetEvent)

drop

public void drop(DropTargetEvent event)
Forwards this event to the current listener, if it is not null. Then sets the current listener to null.
Specified by:
drop in interface DropTargetListener
See Also:
DropTargetListener.drop(DropTargetEvent)

dropAccept

public void dropAccept(DropTargetEvent event)
Forwards this event to the current listener.
Specified by:
dropAccept in interface DropTargetListener
See Also:
DropTargetListener.dropAccept(DropTargetEvent)

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 events to.

removeDropTargetListener

public void removeDropTargetListener(TransferDropTargetListener listener)
Removes the given TransferDropTargetListener from the list of listeners.

GEF v2.0