be.ugent.caagt.swirl.dnd
Interface DropHandler


public interface DropHandler

Handles the 'drop' part of a drag-and-drop operation of a local object of given type. Used in conjunction with LocalTransferHandler. Handles objects that belong to a single class.


Method Summary
 boolean acceptDrop(javax.swing.JComponent target, java.lang.Object object, int seqNr)
          Accept an object which was dropped onto the component handled by this handler.
 boolean allowsMultipleDrops(javax.swing.JComponent target)
          Does this handler allow multiple objects of this class to be dropped at the same time?
 java.lang.Class<?> getDropClass(javax.swing.JComponent target)
          Return the class of elements that can be dropped by this handler onto the given component.
 

Method Detail

getDropClass

java.lang.Class<?> getDropClass(javax.swing.JComponent target)
Return the class of elements that can be dropped by this handler onto the given component.


allowsMultipleDrops

boolean allowsMultipleDrops(javax.swing.JComponent target)
Does this handler allow multiple objects of this class to be dropped at the same time?

Parameters:
target - Target onto which the object would be dropped.

acceptDrop

boolean acceptDrop(javax.swing.JComponent target,
                   java.lang.Object object,
                   int seqNr)
Accept an object which was dropped onto the component handled by this handler. When multiple drops are allowed, this method will be called once for every object being dropped, unless a previous drop in the same bunch was not accepted.

It is advisable not to return false except possibly for the first element in the drop, because the drag source is notified only of the fact that the entire drop did not succeed, and not of the exact number of objects that were accepted.

Parameters:
object - Object being dropped. The object is known to belong to the correct class.
target - Target onto which the object would be dropped.
seqNr - Sequence number of this object within a set of objects being dropped in one go. The first object has sequence number 0.
Returns:
true if and only if the object was accepted.