java.awt.dnd
Class DropTargetContext

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.dnd.DropTargetContext
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable

public class DropTargetContext
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Serializable sample code for java.io.Serializable definition code for java.io.Serializable

A DropTargetContext is created whenever the logical cursor associated with a Drag and Drop operation coincides with the visible geometry of a Component associated with a DropTarget. The DropTargetContext provides the mechanism for a potential receiver of a drop operation to both provide the end user with the appropriate drag under feedback, but also to effect the subsequent data transfer if appropriate.

Since:
1.2
See Also:
Serialized Form

Nested Class Summary
protected  class DropTargetContext.TransferableProxy sample code for java.awt.dnd.DropTargetContext.TransferableProxy definition code for java.awt.dnd.DropTargetContext.TransferableProxy
          TransferableProxy is a helper inner class that implements Transferable interface and serves as a proxy for another Transferable object which represents data transfer for a particular drag-n-drop operation.
 
Method Summary
protected  void acceptDrag sample code for java.awt.dnd.DropTargetContext.acceptDrag(int) definition code for java.awt.dnd.DropTargetContext.acceptDrag(int) (int dragOperation)
          accept the Drag.
protected  void acceptDrop sample code for java.awt.dnd.DropTargetContext.acceptDrop(int) definition code for java.awt.dnd.DropTargetContext.acceptDrop(int) (int dropOperation)
          called to signal that the drop is acceptable using the specified operation.
 void addNotify sample code for java.awt.dnd.DropTargetContext.addNotify(java.awt.dnd.peer.DropTargetContextPeer) definition code for java.awt.dnd.DropTargetContext.addNotify(java.awt.dnd.peer.DropTargetContextPeer) (DropTargetContextPeer sample code for java.awt.dnd.peer.DropTargetContextPeer definition code for java.awt.dnd.peer.DropTargetContextPeer  dtcp)
          Called when associated with the DropTargetContextPeer.
protected  Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable createTransferableProxy sample code for java.awt.dnd.DropTargetContext.createTransferableProxy(java.awt.datatransfer.Transferable, boolean) definition code for java.awt.dnd.DropTargetContext.createTransferableProxy(java.awt.datatransfer.Transferable, boolean) (Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  t, boolean local)
          Creates a TransferableProxy to proxy for the specified Transferable.
 void dropComplete sample code for java.awt.dnd.DropTargetContext.dropComplete(boolean) definition code for java.awt.dnd.DropTargetContext.dropComplete(boolean) (boolean success)
          This method signals that the drop is completed and if it was successful or not.
 Component sample code for java.awt.Component definition code for java.awt.Component getComponent sample code for java.awt.dnd.DropTargetContext.getComponent() definition code for java.awt.dnd.DropTargetContext.getComponent() ()
          This method returns the Component associated with this DropTargetContext.
protected  DataFlavor sample code for java.awt.datatransfer.DataFlavor definition code for java.awt.datatransfer.DataFlavor [] getCurrentDataFlavors sample code for java.awt.dnd.DropTargetContext.getCurrentDataFlavors() definition code for java.awt.dnd.DropTargetContext.getCurrentDataFlavors() ()
          get the available DataFlavors of the Transferable operand of this operation.
protected  List sample code for java.util.List definition code for java.util.List <DataFlavor sample code for java.awt.datatransfer.DataFlavor definition code for java.awt.datatransfer.DataFlavor > getCurrentDataFlavorsAsList sample code for java.awt.dnd.DropTargetContext.getCurrentDataFlavorsAsList() definition code for java.awt.dnd.DropTargetContext.getCurrentDataFlavorsAsList() ()
          This method returns a the currently available DataFlavors of the Transferable operand as a java.util.List.
 DropTarget sample code for java.awt.dnd.DropTarget definition code for java.awt.dnd.DropTarget getDropTarget sample code for java.awt.dnd.DropTargetContext.getDropTarget() definition code for java.awt.dnd.DropTargetContext.getDropTarget() ()
          This method returns the DropTarget associated with this DropTargetContext.
protected  int getTargetActions sample code for java.awt.dnd.DropTargetContext.getTargetActions() definition code for java.awt.dnd.DropTargetContext.getTargetActions() ()
          This method returns an int representing the current actions this DropTarget will accept.
protected  Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable getTransferable sample code for java.awt.dnd.DropTargetContext.getTransferable() definition code for java.awt.dnd.DropTargetContext.getTransferable() ()
          get the Transferable (proxy) operand of this operation
protected  boolean isDataFlavorSupported sample code for java.awt.dnd.DropTargetContext.isDataFlavorSupported(java.awt.datatransfer.DataFlavor) definition code for java.awt.dnd.DropTargetContext.isDataFlavorSupported(java.awt.datatransfer.DataFlavor) (DataFlavor sample code for java.awt.datatransfer.DataFlavor definition code for java.awt.datatransfer.DataFlavor  df)
          This method returns a boolean indicating if the given DataFlavor is supported by this DropTargetContext.
protected  void rejectDrag sample code for java.awt.dnd.DropTargetContext.rejectDrag() definition code for java.awt.dnd.DropTargetContext.rejectDrag() ()
          reject the Drag.
protected  void rejectDrop sample code for java.awt.dnd.DropTargetContext.rejectDrop() definition code for java.awt.dnd.DropTargetContext.rejectDrop() ()
          called to signal that the drop is unacceptable.
 void removeNotify sample code for java.awt.dnd.DropTargetContext.removeNotify() definition code for java.awt.dnd.DropTargetContext.removeNotify() ()
          Called when disassociated with the DropTargetContextPeer.
protected  void setTargetActions sample code for java.awt.dnd.DropTargetContext.setTargetActions(int) definition code for java.awt.dnd.DropTargetContext.setTargetActions(int) (int actions)
          This method sets the current actions acceptable to this DropTarget.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Method Detail

getDropTarget sample code for java.awt.dnd.DropTargetContext.getDropTarget() definition code for java.awt.dnd.DropTargetContext.getDropTarget()

public DropTarget sample code for java.awt.dnd.DropTarget definition code for java.awt.dnd.DropTarget  getDropTarget()
This method returns the DropTarget associated with this DropTargetContext.

Returns:
the DropTarget associated with this DropTargetContext

getComponent sample code for java.awt.dnd.DropTargetContext.getComponent() definition code for java.awt.dnd.DropTargetContext.getComponent()

public Component sample code for java.awt.Component definition code for java.awt.Component  getComponent()
This method returns the Component associated with this DropTargetContext.

Returns:
the Component associated with this Context

addNotify sample code for java.awt.dnd.DropTargetContext.addNotify(java.awt.dnd.peer.DropTargetContextPeer) definition code for java.awt.dnd.DropTargetContext.addNotify(java.awt.dnd.peer.DropTargetContextPeer)

public void addNotify(DropTargetContextPeer sample code for java.awt.dnd.peer.DropTargetContextPeer definition code for java.awt.dnd.peer.DropTargetContextPeer  dtcp)
Called when associated with the DropTargetContextPeer.

Parameters:
dtcp - the DropTargetContextPeer

removeNotify sample code for java.awt.dnd.DropTargetContext.removeNotify() definition code for java.awt.dnd.DropTargetContext.removeNotify()

public void removeNotify()
Called when disassociated with the DropTargetContextPeer.


setTargetActions sample code for java.awt.dnd.DropTargetContext.setTargetActions(int) definition code for java.awt.dnd.DropTargetContext.setTargetActions(int)

protected void setTargetActions(int actions)
This method sets the current actions acceptable to this DropTarget.

Parameters:
actions - an int representing the supported action(s)

getTargetActions sample code for java.awt.dnd.DropTargetContext.getTargetActions() definition code for java.awt.dnd.DropTargetContext.getTargetActions()

protected int getTargetActions()
This method returns an int representing the current actions this DropTarget will accept.

Returns:
the current actions acceptable to this DropTarget

dropComplete sample code for java.awt.dnd.DropTargetContext.dropComplete(boolean) definition code for java.awt.dnd.DropTargetContext.dropComplete(boolean)

public void dropComplete(boolean success)
                  throws InvalidDnDOperationException sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException 
This method signals that the drop is completed and if it was successful or not.

Parameters:
success - true for success, false if not

Throws:
InvalidDnDOperationException sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException - if a drop is not outstanding/extant

acceptDrag sample code for java.awt.dnd.DropTargetContext.acceptDrag(int) definition code for java.awt.dnd.DropTargetContext.acceptDrag(int)

protected void acceptDrag(int dragOperation)
accept the Drag.

Parameters:
dragOperation - the supported action(s)

rejectDrag sample code for java.awt.dnd.DropTargetContext.rejectDrag() definition code for java.awt.dnd.DropTargetContext.rejectDrag()

protected void rejectDrag()
reject the Drag.


acceptDrop sample code for java.awt.dnd.DropTargetContext.acceptDrop(int) definition code for java.awt.dnd.DropTargetContext.acceptDrop(int)

protected void acceptDrop(int dropOperation)
called to signal that the drop is acceptable using the specified operation. must be called during DropTargetListener.drop method invocation.

Parameters:
dropOperation - the supported action(s)

rejectDrop sample code for java.awt.dnd.DropTargetContext.rejectDrop() definition code for java.awt.dnd.DropTargetContext.rejectDrop()

protected void rejectDrop()
called to signal that the drop is unacceptable. must be called during DropTargetListener.drop method invocation.


getCurrentDataFlavors sample code for java.awt.dnd.DropTargetContext.getCurrentDataFlavors() definition code for java.awt.dnd.DropTargetContext.getCurrentDataFlavors()

protected DataFlavor sample code for java.awt.datatransfer.DataFlavor definition code for java.awt.datatransfer.DataFlavor [] getCurrentDataFlavors()
get the available DataFlavors of the Transferable operand of this operation.

Returns:
a DataFlavor[] containing the supported DataFlavors of the Transferable operand.

getCurrentDataFlavorsAsList sample code for java.awt.dnd.DropTargetContext.getCurrentDataFlavorsAsList() definition code for java.awt.dnd.DropTargetContext.getCurrentDataFlavorsAsList()

protected List sample code for java.util.List definition code for java.util.List <DataFlavor sample code for java.awt.datatransfer.DataFlavor definition code for java.awt.datatransfer.DataFlavor > getCurrentDataFlavorsAsList()
This method returns a the currently available DataFlavors of the Transferable operand as a java.util.List.

Returns:
the currently available DataFlavors as a java.util.List

isDataFlavorSupported sample code for java.awt.dnd.DropTargetContext.isDataFlavorSupported(java.awt.datatransfer.DataFlavor) definition code for java.awt.dnd.DropTargetContext.isDataFlavorSupported(java.awt.datatransfer.DataFlavor)

protected boolean isDataFlavorSupported(DataFlavor sample code for java.awt.datatransfer.DataFlavor definition code for java.awt.datatransfer.DataFlavor  df)
This method returns a boolean indicating if the given DataFlavor is supported by this DropTargetContext.

Parameters:
df - the DataFlavor

Returns:
if the DataFlavor specified is supported

getTransferable sample code for java.awt.dnd.DropTargetContext.getTransferable() definition code for java.awt.dnd.DropTargetContext.getTransferable()

protected Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  getTransferable()
                                throws InvalidDnDOperationException sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException 
get the Transferable (proxy) operand of this operation

Returns:
the Transferable
Throws:
InvalidDnDOperationException sample code for java.awt.dnd.InvalidDnDOperationException definition code for java.awt.dnd.InvalidDnDOperationException - if a drag is not outstanding/extant


createTransferableProxy sample code for java.awt.dnd.DropTargetContext.createTransferableProxy(java.awt.datatransfer.Transferable, boolean) definition code for java.awt.dnd.DropTargetContext.createTransferableProxy(java.awt.datatransfer.Transferable, boolean)

protected Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  createTransferableProxy(Transferable sample code for java.awt.datatransfer.Transferable definition code for java.awt.datatransfer.Transferable  t,
                                               boolean local)
Creates a TransferableProxy to proxy for the specified Transferable.

Parameters:
t - the Transferable to be proxied
local - true if t represents the result of a local drag-n-drop operation.
Returns:
the new TransferableProxy instance.