Java Platform 1.2

java.awt.dnd
Class DragSourceContext

java.lang.Object
  |
  +--java.awt.dnd.DragSourceContext

public class DragSourceContext
extends Object
implements DragSourceListener

The DragSourceContext class is responsible for managing the initiator side of the Drag and Drop protocol. In particular it is responsible for managing event notifications to the DragSourceListener, and providing the Transferable state to enable the data transfer.

Since:
JDK1.2

Field Summary
protected static int CHANGED
           
protected static int DEFAULT
           
protected static int ENTER
           
protected static int OVER
           
 
Constructor Summary
DragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp, DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point offset, Transferable t, DragSourceListener dsl)
          construct a DragSourceContext (called from DragSource)
 
Method Summary
 void addDragSourceListener(DragSourceListener dsl)
          change the DragSourceListener
 void dragDropEnd(DragSourceDropEvent dsde)
          intercept the dragDropEnd event from the peer
 void dragEnter(DragSourceDragEvent dsde)
          intercept the dragEnter event from the peer
 void dragExit(DragSourceEvent dse)
          intercept the dragExit event from the peer
 void dragOver(DragSourceDragEvent dsde)
          intercept the dragOver event from the peer
 void dropActionChanged(DragSourceDragEvent dsde)
          intercept the dragGestureChanged event from the peer
 Component getComponent()
           
 Cursor getCursor()
           
 DragSource getDragSource()
           
 int getSourceActions()
           
 Transferable getTransferable()
           
 DragGestureEvent getTrigger()
           
 void removeDragSourceListener(DragSourceListener dsl)
          change the DragSourceListener
 void setCursor(Cursor c)
          change the drag cursor
 void transferablesFlavorsChanged()
          notify the peer that the Transferables DataFlavors have changed
protected  void updateCurrentCursor(int dropOp, int targetAct, int status)
          check the cursor for updates and implement defaults
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

protected static final int DEFAULT

ENTER

protected static final int ENTER

OVER

protected static final int OVER

CHANGED

protected static final int CHANGED
Constructor Detail

DragSourceContext

public DragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp,
                         DragGestureEvent trigger,
                         Cursor dragCursor,
                         Image dragImage,
                         Point offset,
                         Transferable t,
                         DragSourceListener dsl)
construct a DragSourceContext (called from DragSource)
Parameters:
dscp - The DragSourceContextPeer for this Drag
trigger - The triggering event
dragCursor - The initial Cursor
dragImage - The image to drag (or null)
offset - The offset of the image origin from the hotspot at the instant of the triggering event
t - The Transferable
dsl - The DragSourceListener
Method Detail

getDragSource

public DragSource getDragSource()
Returns:
the DragSource that instantiated this DragSourceContext

getComponent

public Component getComponent()
Returns:
the Component that started the Drag

getTrigger

public DragGestureEvent getTrigger()
Returns:
the Event that triggered the Drag

getSourceActions

public int getSourceActions()
Returns:
the current actions

setCursor

public void setCursor(Cursor c)
change the drag cursor

getCursor

public Cursor getCursor()
Returns:
the current drag cursor

addDragSourceListener

public void addDragSourceListener(DragSourceListener dsl)
                           throws TooManyListenersException
change the DragSourceListener

removeDragSourceListener

public void removeDragSourceListener(DragSourceListener dsl)
change the DragSourceListener

transferablesFlavorsChanged

public void transferablesFlavorsChanged()
notify the peer that the Transferables DataFlavors have changed

dragEnter

public void dragEnter(DragSourceDragEvent dsde)
intercept the dragEnter event from the peer
Specified by:
dragEnter in interface DragSourceListener

dragOver

public void dragOver(DragSourceDragEvent dsde)
intercept the dragOver event from the peer
Specified by:
dragOver in interface DragSourceListener

dragExit

public void dragExit(DragSourceEvent dse)
intercept the dragExit event from the peer
Specified by:
dragExit in interface DragSourceListener

dropActionChanged

public void dropActionChanged(DragSourceDragEvent dsde)
intercept the dragGestureChanged event from the peer
Specified by:
dropActionChanged in interface DragSourceListener

dragDropEnd

public void dragDropEnd(DragSourceDropEvent dsde)
intercept the dragDropEnd event from the peer
Specified by:
dragDropEnd in interface DragSourceListener

getTransferable

public Transferable getTransferable()

updateCurrentCursor

protected void updateCurrentCursor(int dropOp,
                                   int targetAct,
                                   int status)
check the cursor for updates and implement defaults

Java Platform 1.2

Submit a bug or feature Version 1.2 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.