public class

DropTargetContext

extends Object
implements Serializable
java.lang.Object
   ↳ java.awt.dnd.DropTargetContext

Class Overview

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.

Summary

Nested Classes
class 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. 
Public Methods
void addNotify(DropTargetContextPeer dtcp)
Called when associated with the DropTargetContextPeer.
void dropComplete(boolean success)
This method signals that the drop is completed and if it was successful or not.
Component getComponent()
This method returns the Component associated with this DropTargetContext.
DropTarget getDropTarget()
This method returns the DropTarget associated with this DropTargetContext.
void removeNotify()
Called when disassociated with the DropTargetContextPeer.
Protected Methods
void acceptDrag(int dragOperation)
accept the Drag.
void acceptDrop(int dropOperation)
called to signal that the drop is acceptable using the specified operation.
Transferable createTransferableProxy(Transferable t, boolean local)
Creates a TransferableProxy to proxy for the specified Transferable.
DataFlavor[] getCurrentDataFlavors()
get the available DataFlavors of the Transferable operand of this operation.
List<DataFlavor> getCurrentDataFlavorsAsList()
This method returns a the currently available DataFlavors of the Transferable operand as a java.util.List.
int getTargetActions()
This method returns an int representing the current actions this DropTarget will accept.
Transferable getTransferable()
get the Transferable (proxy) operand of this operation

boolean isDataFlavorSupported(DataFlavor df)
This method returns a boolean indicating if the given DataFlavor is supported by this DropTargetContext.
void rejectDrag()
reject the Drag.
void rejectDrop()
called to signal that the drop is unacceptable.
void setTargetActions(int actions)
This method sets the current actions acceptable to this DropTarget.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void addNotify (DropTargetContextPeer dtcp)

Called when associated with the DropTargetContextPeer.

Parameters
dtcp the DropTargetContextPeer

public void dropComplete (boolean success)

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 if a drop is not outstanding/extant

public Component getComponent ()

This method returns the Component associated with this DropTargetContext.

Returns
  • the Component associated with this Context

public DropTarget getDropTarget ()

This method returns the DropTarget associated with this DropTargetContext.

Returns
  • the DropTarget associated with this DropTargetContext

public void removeNotify ()

Called when disassociated with the DropTargetContextPeer.

Protected Methods

protected void acceptDrag (int dragOperation)

accept the Drag.

Parameters
dragOperation the supported action(s)

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)

protected Transferable createTransferableProxy (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.

protected DataFlavor[] getCurrentDataFlavors ()

get the available DataFlavors of the Transferable operand of this operation.

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

protected List<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

protected int getTargetActions ()

This method returns an int representing the current actions this DropTarget will accept.

Returns
  • the current actions acceptable to this DropTarget

protected Transferable getTransferable ()

get the Transferable (proxy) operand of this operation

Returns
  • the Transferable
Throws
InvalidDnDOperationException if a drag is not outstanding/extant

protected boolean isDataFlavorSupported (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

protected void rejectDrag ()

reject the Drag.

protected void rejectDrop ()

called to signal that the drop is unacceptable. must be called during DropTargetListener.drop method invocation.

protected void setTargetActions (int actions)

This method sets the current actions acceptable to this DropTarget.

Parameters
actions an int representing the supported action(s)