Class DropTargetContext
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classTransferableProxyis a helper inner class that implementsTransferableinterface and serves as a proxy for anotherTransferableobject which represents data transfer for a particular drag-n-drop operation. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidacceptDrag(int dragOperation) accept the Drag.protected voidacceptDrop(int dropOperation) called to signal that the drop is acceptable using the specified operation. must be called during DropTargetListener.drop method invocation.protected TransferablecreateTransferableProxy(Transferable t, boolean local) Creates a TransferableProxy to proxy for the specified Transferable.voiddropComplete(boolean success) This method signals that the drop is completed and if it was successful or not.This method returns theComponentassociated with thisDropTargetContext.protected DataFlavor[]get the available DataFlavors of theTransferableoperand of this operation.protected List<DataFlavor> This method returns the currently available DataFlavors of theTransferableoperand as ajava.util.List.This method returns theDropTargetassociated with thisDropTargetContext.protected intThis method returns anintrepresenting the current actions thisDropTargetwill accept.protected Transferableget the Transferable (proxy) operand of this operationprotected booleanThis method returns abooleanindicating if the givenDataFlavoris supported by thisDropTargetContext.protected voidreject the Drag.protected voidcalled to signal that the drop is unacceptable. must be called during DropTargetListener.drop method invocation.protected voidsetTargetActions(int actions) This method sets the current actions acceptable to thisDropTarget.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Method Details
-
getDropTarget
This method returns theDropTargetassociated with thisDropTargetContext.- Returns:
- the
DropTargetassociated with thisDropTargetContext
-
getComponent
This method returns theComponentassociated 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- anintrepresenting the supported action(s)
-
getTargetActions
protected int getTargetActions()This method returns anintrepresenting the current actions thisDropTargetwill 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 theTransferableoperand of this operation.- Returns:
- a
DataFlavor[]containing the supportedDataFlavors of theTransferableoperand.
-
getCurrentDataFlavorsAsList
This method returns the currently available DataFlavors of theTransferableoperand as ajava.util.List.- Returns:
- the currently available
DataFlavors as a
java.util.List
-
isDataFlavorSupported
This method returns abooleanindicating if the givenDataFlavoris supported by thisDropTargetContext.- Parameters:
df- theDataFlavorto test- Returns:
trueif theDataFlavorspecified is supported, otherwisefalse
-
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- theTransferableto be proxiedlocal-trueiftrepresents the result of a local drag-n-drop operation.- Returns:
- the new
TransferableProxyinstance.
-