package com.bbn.openmap.tools.dnd; import java.awt.Component; import java.awt.dnd.DnDConstants; import java.awt.dnd.DragGestureListener; import java.awt.dnd.DragSource; import com.bbn.openmap.util.Debug; /** * The MultiDndCatcher is a "master" catcher that holds the instance of the * MultiCactherDrageGestureListener. During find and init, this catcher will * add other drag listeners to its MultiCatcherDragGestureRecogniser. * * @author matt * @author last modified by $Author$ * @version $Revision$ $Date$ */ public class MultiDnDCatcher extends DefaultDnDCatcher { /** * Constructs a new MultiDnDCatcher given the DragSource for the Component. * * @param ds the DragSource for the Component */ public MultiDnDCatcher() { this(new DragSource()); } /** * Chained constructor. * * @param ds */ public MultiDnDCatcher(DragSource ds) { super(ds); } /** * Chained constructor. * * @param ds * @param c */ public MultiDnDCatcher(DragSource ds, Component c) { super(ds, c); } /** * Chained constructor. * * @param ds * @param c * @param act */ public MultiDnDCatcher(DragSource ds, Component c, int act) { super(ds, c, act); } /** * Chained constructor. * * @param ds * @param c * @param act * @param dgl */ public MultiDnDCatcher(DragSource ds, Component c, int act, DragGestureListener dgl) { dragSource = getDragSource(); // Create a DragGestureListener that will work with multiple catchers. dragGestureListener = new MultiCatcherDragGestureListener(this); ((MultiCatcherDragGestureListener) dragGestureListener).addCatcher(this); setSourceActions(DnDConstants.ACTION_MOVE); } /** * @param someObj * @see com.bbn.openmap.tools.dnd.DefaultDnDCatcher#findAndInit(java.lang.Object) */ public void findAndInit(Object obj) { super.findAndInit(obj); if (obj instanceof DefaultDnDCatcher && !(obj == this)) { DefaultDnDCatcher catcher = (DefaultDnDCatcher) obj; ((MultiCatcherDragGestureListener)dragGestureListener).addCatcher(catcher); Debug.message("dnd", "MultiDndCatcher added catcher of class " + obj.getClass().getName()); } } { } }