| 
JavaTM 2 Platform Std. Ed. v1.3.1  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--java.awt.dnd.DragSourceContext
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.
 An instance of this class is created as a result 
 of a DragSource's startDrag() method being successfully 
 invoked. This instance is responsible for tracking the state 
 of the operation on behalf of the
 DragSource and dispatching state changes to 
 the DragSourceListener.
 
 Note that the DragSourceContext itself 
 implements the DragSourceListener 
 interface. This is to allow the platform peer 
 (the DragSourceContextPeer instance) 
 created by the DragSource to notify 
 the DragSourceContext of
 changes in state in the ongiong operation. This allows the
 DragSourceContext to interpose 
 itself between the platform and the
 DragSourceListener provided by 
 the initiator of the operation.
| Field Summary | |
protected static int | 
CHANGED
An int used by updateCurrentCursor()
 indicating that the user operation has changed. | 
protected static int | 
DEFAULT
An int used by updateCurrentCursor() 
 indicating that the Cursor should change
 to the default (no drop) Cursor. | 
protected static int | 
ENTER
An int used by updateCurrentCursor()
 indicating that the Cursor 
 has entered a DropTarget. | 
protected static int | 
OVER
An int used by updateCurrentCursor()
 indicating that the Cursor is 
 over a DropTarget. | 
| Constructor Summary | |
DragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp,
                  DragGestureEvent trigger,
                  Cursor dragCursor,
                  Image dragImage,
                  Point offset,
                  Transferable t,
                  DragSourceListener dsl)
Called from DragSource, this constructor creates a new
 DragSourceContext given the
 DragSourceContextPeer for this Drag, the
 DragGestureEvent that triggered the Drag, the initial
 Cursor to use for the Drag, an (optional)
 Image to display while the Drag is taking place, the offset
 of the Image origin from the hotspot at the instant of the
 triggering event, the Transferable subject data, and the 
 DragSourceListener to use during the Drag and Drop
 operation. | 
|
| Method Summary | |
 void | 
addDragSourceListener(DragSourceListener dsl)
Add a DragSourceListener to this
 DragSourceContext if one has not already been added. | 
 void | 
dragDropEnd(DragSourceDropEvent dsde)
This method intercepts the DragSourceDropEvent 
 associated with dragDropEnd() from the peer. | 
 void | 
dragEnter(DragSourceDragEvent dsde)
This method intercepts the DragSourceDragEvent
 associated with dragEnter() from the peer. | 
 void | 
dragExit(DragSourceEvent dse)
This method intercepts the DragSourceEvent
 associated with dragExit() from the peer. | 
 void | 
dragOver(DragSourceDragEvent dsde)
This method intercepts the DragSourceDragEvent
 associated with dragOver() from the peer. | 
 void | 
dropActionChanged(DragSourceDragEvent dsde)
This method intercepts the DragSourceDragEvent 
 associated with dropActionChanged() from the peer. | 
 Component | 
getComponent()
This method returns the Component associated with this 
 DragSourceContext. | 
 Cursor | 
getCursor()
This method returns the current drag Cursor. | 
 DragSource | 
getDragSource()
This method returns the DragSource 
 that instantiated this DragSourceContext. | 
 int | 
getSourceActions()
This method returns an int 
 representing the current action(s) 
 associated with this DragSourceContext.
  | 
 Transferable | 
getTransferable()
This method returns the Transferable
 associated with this DragSourceContext.
  | 
 DragGestureEvent | 
getTrigger()
This method returns the DragGestureEvent
 that initially  triggered the drag. | 
 void | 
removeDragSourceListener(DragSourceListener dsl)
This method removes the specified DragSourceListener
 from  this DragSourceContext. | 
 void | 
setCursor(Cursor c)
This method sets the current drag Cursor.
  | 
 void | 
transferablesFlavorsChanged()
This method notifies the peer that the Transferable's 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 | 
protected static final int DEFAULT
int used by updateCurrentCursor() 
 indicating that the Cursor should change
 to the default (no drop) Cursor.protected static final int ENTER
int used by updateCurrentCursor()
 indicating that the Cursor 
 has entered a DropTarget.protected static final int OVER
int used by updateCurrentCursor()
 indicating that the Cursor is 
 over a DropTarget.protected static final int CHANGED
int used by updateCurrentCursor()
 indicating that the user operation has changed.| Constructor Detail | 
public DragSourceContext(java.awt.dnd.peer.DragSourceContextPeer dscp,
                         DragGestureEvent trigger,
                         Cursor dragCursor,
                         Image dragImage,
                         Point offset,
                         Transferable t,
                         DragSourceListener dsl)
DragSource, this constructor creates a new
 DragSourceContext given the
 DragSourceContextPeer for this Drag, the
 DragGestureEvent that triggered the Drag, the initial
 Cursor to use for the Drag, an (optional)
 Image to display while the Drag is taking place, the offset
 of the Image origin from the hotspot at the instant of the
 triggering event, the Transferable subject data, and the 
 DragSourceListener to use during the Drag and Drop
 operation.dscp - the DragSourceContextPeer for this dragtrigger - the triggering eventdragCursor - the initial CursordragImage - the Image to drag (or null)offset - the offset of the image origin from the hotspot at the
                   instant of the triggering eventt - the Transferabledsl - the DragSourceListenerIllegalArgumentException - if trigger instance is incompleteNullPointerException - if dscp, dsl, trigger, or t are null, or
         if dragImage is non-null and offset is null| Method Detail | 
public DragSource getDragSource()
DragSource 
 that instantiated this DragSourceContext.
 DragSource that 
 instantiated this DragSourceContextpublic Component getComponent()
Component associated with this 
 DragSourceContext.
 Component that started the dragpublic DragGestureEvent getTrigger()
DragGestureEvent
 that initially  triggered the drag.
 public int getSourceActions()
int 
 representing the current action(s) 
 associated with this DragSourceContext.
 public void setCursor(Cursor c)
Cursor.
 c - the Cursor to display.
 Note that while null is not prohibited,
 it is not an acceptable value for this parameter.public Cursor getCursor()
Cursor. 
 Cursor
public void addDragSourceListener(DragSourceListener dsl)
                           throws TooManyListenersException
DragSourceListener to this
 DragSourceContext if one has not already been added.
 If a DragSourceListener already exists, 
 this method throws a TooManyListenersException.
 dsl - the DragSourceListener to add.
 Note that while null is not prohibited,
 it is not acceptable as a parameter.
 TooManyListenersException - if
 a DragSourceListener has already been addedpublic void removeDragSourceListener(DragSourceListener dsl)
DragSourceListener
 from  this DragSourceContext.
 dsl - the DragSourceListener to remove.
 Note that while null is not prohibited,
 it is not acceptable as a parameter.public void transferablesFlavorsChanged()
public void dragEnter(DragSourceDragEvent dsde)
DragSourceDragEvent
 associated with dragEnter() from the peer.
 Note: This method is called by the peer implementation, not the user.
dragEnter in interface DragSourceListenerdsde - the intercepted DragSourceDragEventpublic void dragOver(DragSourceDragEvent dsde)
DragSourceDragEvent
 associated with dragOver() from the peer.
 Note: This method is called by the peer implementation, not the user.
dragOver in interface DragSourceListenerdsde - the intercepted DragSourceDragEventpublic void dragExit(DragSourceEvent dse)
DragSourceEvent
 associated with dragExit() from the peer.
 Note: This method is called by the peer implementation, not the user.
dragExit in interface DragSourceListenerdse - the intercepted DragSourceEventpublic void dropActionChanged(DragSourceDragEvent dsde)
DragSourceDragEvent 
 associated with dropActionChanged() from the peer.
 Note: This method is called by the peer implementation, not the user.
dropActionChanged in interface DragSourceListenerdsde - the intercepted DragSourceDragEventpublic void dragDropEnd(DragSourceDropEvent dsde)
DragSourceDropEvent 
 associated with dragDropEnd() from the peer.
 
 Note: This method is called by the peer implementation, not the user.
 The value of null is not acceptable as a parameter
 to this method.
 
dragDropEnd in interface DragSourceListenerdsde - the intercepted DragSourceDropEventpublic Transferable getTransferable()
Transferable
 associated with this DragSourceContext.
 Transferable
protected void updateCurrentCursor(int dropOp,
                                   int targetAct,
                                   int status)
dropOp - the user's currently selected operationtargetAct - the current target's supported actionsstatus - the constant
  | 
JavaTM 2 Platform Std. Ed. v1.3.1  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A.  All Rights Reserved.