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.
boolean | acceptDrop(JComponent target, Object object, int seqNr) - Accept an object which was dropped onto the component handled by this handler.
|
boolean | allowsMultipleDrops(JComponent target) - Does this handler allow multiple objects of this class to be dropped
at the same time?
|
Class> | getDropClass(JComponent target) - Return the class of elements that can be dropped by this handler
onto the given component.
|
acceptDrop
public boolean acceptDrop(JComponent target,
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.
target
- Target onto which the object would be dropped.object
- Object being dropped. The object is known to belong to the correct class.seqNr
- Sequence number of this object within a set of objects being dropped in one
go. The first object has sequence number 0.
- true if and only if the object was accepted.
allowsMultipleDrops
public boolean allowsMultipleDrops(JComponent target)
Does this handler allow multiple objects of this class to be dropped
at the same time?
target
- Target onto which the object would be dropped.
getDropClass
public Class> getDropClass(JComponent target)
Return the class of elements that can be dropped by this handler
onto the given component.