java.lang.Object
java.awt.dnd.DropTargetContext
- All Implemented Interfaces:
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
Modifier and TypeClassDescriptionprotected class
TransferableProxy
is a helper inner class that implementsTransferable
interface and serves as a proxy for anotherTransferable
object which represents data transfer for a particular drag-n-drop operation. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
acceptDrag(int dragOperation)
accept the Drag.protected void
acceptDrop(int dropOperation)
called to signal that the drop is acceptable using the specified operation.protected Transferable
createTransferableProxy(Transferable t, boolean local)
Creates a TransferableProxy to proxy for the specified Transferable.void
dropComplete(boolean success)
This method signals that the drop is completed and if it was successful or not.This method returns theComponent
associated with thisDropTargetContext
.protected DataFlavor[]
get the available DataFlavors of theTransferable
operand of this operation.protected List<DataFlavor>
This method returns a the currently available DataFlavors of theTransferable
operand as ajava.util.List
.This method returns theDropTarget
associated with thisDropTargetContext
.protected int
This method returns anint
representing the current actions thisDropTarget
will accept.protected Transferable
get the Transferable (proxy) operand of this operationprotected boolean
This method returns aboolean
indicating if the givenDataFlavor
is supported by thisDropTargetContext
.protected void
reject the Drag.protected void
called to signal that the drop is unacceptable.protected void
setTargetActions(int actions)
This method sets the current actions acceptable to thisDropTarget
.
-
Method Details
-
getDropTarget
This method returns theDropTarget
associated with thisDropTargetContext
.- Returns:
- the
DropTarget
associated with thisDropTargetContext
-
getComponent
This method returns theComponent
associated with thisDropTargetContext
.- Returns:
- the Component associated with this Context
-
setTargetActions
protected void setTargetActions(int actions)This method sets the current actions acceptable to thisDropTarget
.- Parameters:
actions
- anint
representing the supported action(s)
-
getTargetActions
protected int getTargetActions()This method returns anint
representing the current actions thisDropTarget
will accept.- Returns:
- the current actions acceptable to this
DropTarget
-
dropComplete
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
-
acceptDrag
protected void acceptDrag(int dragOperation)accept the Drag.- Parameters:
dragOperation
- the supported action(s)
-
rejectDrag
protected void rejectDrag()reject the Drag. -
acceptDrop
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
protected void rejectDrop()called to signal that the drop is unacceptable. must be called during DropTargetListener.drop method invocation. -
getCurrentDataFlavors
get the available DataFlavors of theTransferable
operand of this operation.- Returns:
- a
DataFlavor[]
containing the supportedDataFlavor
s of theTransferable
operand.
-
getCurrentDataFlavorsAsList
This method returns a the currently available DataFlavors of theTransferable
operand as ajava.util.List
.- Returns:
- the currently available
DataFlavors as a
java.util.List
-
isDataFlavorSupported
This method returns aboolean
indicating if the givenDataFlavor
is supported by thisDropTargetContext
.- Parameters:
df
- theDataFlavor
- Returns:
- if the
DataFlavor
specified is supported
-
getTransferable
get the Transferable (proxy) operand of this operation- Returns:
- the
Transferable
- Throws:
InvalidDnDOperationException
- if a drag is not outstanding/extant
-
createTransferableProxy
Creates a TransferableProxy to proxy for the specified Transferable.- Parameters:
t
- theTransferable
to be proxiedlocal
-true
ift
represents the result of a local drag-n-drop operation.- Returns:
- the new
TransferableProxy
instance.
-