Added callback in DragSource so that the source can reject the target
before the target even gets a chance to ask if the drop is ok with it. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1134 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DnDManager.java,v 1.18 2003/05/15 22:02:11 mdb Exp $
|
||||
// $Id: DnDManager.java,v 1.19 2003/05/20 17:35:51 ray Exp $
|
||||
|
||||
package com.samskivert.swing.dnd;
|
||||
|
||||
@@ -228,6 +228,7 @@ public class DnDManager
|
||||
target = (comp == _sourceComp) ? null
|
||||
: (DropTarget) _droppers.get(comp);
|
||||
if ((target != null) && comp.isEnabled() &&
|
||||
_source.checkDrop(target) &&
|
||||
target.checkDrop(_source, _data[0])) {
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DragSource.java,v 1.1 2002/08/20 02:49:19 ray Exp $
|
||||
// $Id: DragSource.java,v 1.2 2003/05/20 17:35:51 ray Exp $
|
||||
|
||||
package com.samskivert.swing.dnd;
|
||||
|
||||
@@ -24,6 +24,12 @@ public interface DragSource
|
||||
*/
|
||||
public boolean startDrag (Cursor[] cursors, Object[] data);
|
||||
|
||||
/**
|
||||
* Is the drop target an acceptable one?
|
||||
* @param a potential DropTarget
|
||||
*/
|
||||
public boolean checkDrop (DropTarget target);
|
||||
|
||||
/**
|
||||
* A callback to let the source know that the drop completed successfully.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user