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.
| Modifier and Type | Class and Description |
|---|---|
| protected class | DropTargetContext.
|
| Modifier and Type | Field and Description |
|---|---|
| private final DropTarget | dropTarget
The DropTarget associated with this DropTargetContext. |
| private transient DropTargetContextPeer | |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.4 for interoperability. |
| private transient Transferable |
| Access | Constructor and Description |
|---|---|
| pack-priv | DropTargetContext(DropTarget
the DropTarget to associate with dt)Construct a |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected void | acceptDrop(int
the supported action(s) dropOperation)called to signal that the drop is acceptable using the specified operation. |
| protected Transferable | Returns: the newTransferableProxy instance.the t, boolean Transferable to be proxiedtrue if t represents
the result of a local drag-n-drop operation.Creates a TransferableProxy to proxy for the specified Transferable. |
| public void | dropComplete(boolean
true for success, false if not success)This method signals that the drop is completed and if it was successful or not. |
| public Component | Returns: the Component associated with this ContextThis method returns the |
| protected DataFlavor[] | Returns: aDataFlavor[] containing the
supported DataFlavors of the
Transferable operand.get the available DataFlavors of the
|
| protected List | Returns: the currently available DataFlavors as ajava.util.ListThis method returns the currently available DataFlavors
of the |
| public DropTarget | Returns: theDropTarget associated with this DropTargetContextThis method returns the |
| pack-priv DropTargetContextPeer | |
| protected int | Returns: the current actions acceptable to thisDropTargetThis method returns an |
| protected Transferable | |
| protected boolean | Returns: true if the DataFlavor specified is supported,
otherwise falsethe df)DataFlavor to testThis method returns a |
| protected void | |
| protected void | |
| pack-priv void | |
| pack-priv void | |
| protected void | setTargetActions(int
an actions)int representing the supported action(s)This method sets the current actions acceptable to
this |
| dropTarget | back to summary |
|---|---|
| private final DropTarget dropTarget The DropTarget associated with this DropTargetContext. | |
| dropTargetContextPeer | back to summary |
|---|---|
| private transient DropTargetContextPeer dropTargetContextPeer | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Use serialVersionUID from JDK 1.4 for interoperability. | |
| transferable | back to summary |
|---|---|
| private transient Transferable transferable | |
| DropTargetContext | back to summary |
|---|---|
| pack-priv DropTargetContext(DropTarget dt) Construct a
| |
| acceptDrag | back to summary |
|---|---|
| protected void acceptDrag(int dragOperation) accept the Drag.
| |
| acceptDrop | back to summary |
|---|---|
| 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.
| |
| createTransferableProxy | back to summary |
|---|---|
| protected Transferable createTransferableProxy(Transferable t, boolean local) Creates a TransferableProxy to proxy for the specified Transferable.
| |
| dropComplete | back to summary |
|---|---|
| public void dropComplete(boolean success) throws InvalidDnDOperationException This method signals that the drop is completed and if it was successful or not.
| |
| getComponent | back to summary |
|---|---|
| public Component getComponent() This method returns the
| |
| getCurrentDataFlavors | back to summary |
|---|---|
| protected DataFlavor[] getCurrentDataFlavors() get the available DataFlavors of the
| |
| getCurrentDataFlavorsAsList | back to summary |
|---|---|
| protected List This method returns the currently available DataFlavors
of the
| |
| getDropTarget | back to summary |
|---|---|
| public DropTarget getDropTarget() This method returns the
| |
| getDropTargetContextPeer | back to summary |
|---|---|
| pack-priv DropTargetContextPeer getDropTargetContextPeer() Get the
| |
| getTargetActions | back to summary |
|---|---|
| protected int getTargetActions() This method returns an
| |
| getTransferable | back to summary |
|---|---|
| protected Transferable getTransferable() throws InvalidDnDOperationException get the Transferable (proxy) operand of this operation
| |
| isDataFlavorSupported | back to summary |
|---|---|
| protected boolean isDataFlavorSupported(DataFlavor df) This method returns a
| |
| rejectDrag | back to summary |
|---|---|
| protected void rejectDrag() reject the Drag. | |
| rejectDrop | back to summary |
|---|---|
| protected void rejectDrop() called to signal that the drop is unacceptable. must be called during DropTargetListener.drop method invocation. | |
| reset | back to summary |
|---|---|
| pack-priv void reset() Called when disassociated with the | |
| setDropTargetContextPeer | back to summary |
|---|---|
| pack-priv void setDropTargetContextPeer(final DropTargetContextPeer dtcp) Sets the | |
| setTargetActions | back to summary |
|---|---|
| protected void setTargetActions(int actions) This method sets the current actions acceptable to
this
| |
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.
The proxy forwards all requests to the encapsulated transferable and automatically performs additional conversion on the data returned by the encapsulated transferable in case of local transfer.
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | isLocal
A |
| private TransferableProxy | |
| protected Transferable | transferable
The encapsulated |
| Access | Constructor and Description |
|---|---|
| pack-priv | TransferableProxy(Transferable
the t, boolean Transferable objecttrue, if t represents
the result of local drag-n-drop operationConstructs a |
| Modifier and Type | Method and Description |
|---|---|
| public Object | getTransferData(DataFlavor
the requested flavor for the data df)Implements java. Returns an object which represents the data provided by the encapsulated transferable for the requested data flavor. |
| public DataFlavor[] | Returns: an array of data flavors in which the data can be provided by the encapsulated transferableImplements java. Returns an array of DataFlavor objects indicating the flavors the data can be provided in by the encapsulated transferable. |
| public boolean | Returns: true if the data flavor is supported,
false otherwisethe requested flavor for the data flavor)Implements java. Returns whether or not the specified data flavor is supported by the encapsulated transferable. |
| isLocal | back to summary |
|---|---|
| protected boolean isLocal A | |
| proxy | back to summary |
|---|---|
| private TransferableProxy proxy | |
| transferable | back to summary |
|---|---|
| protected Transferable transferable The encapsulated | |
| TransferableProxy | back to summary |
|---|---|
| pack-priv TransferableProxy(Transferable t, boolean local) Constructs a
| |
| getTransferData | back to summary |
|---|---|
| public Object getTransferData(DataFlavor df) throws UnsupportedFlavorException, IOException Implements java. Returns an object which represents the data provided by the encapsulated transferable for the requested data flavor. In case of local transfer a serialized copy of the object returned by the encapsulated transferable is provided when the data is requested in application/x-java-serialized-object data flavor.
| |
| getTransferDataFlavors | back to summary |
|---|---|
| public DataFlavor[] getTransferDataFlavors() Implements java. Returns an array of DataFlavor objects indicating the flavors the data can be provided in by the encapsulated transferable.
| |
| isDataFlavorSupported | back to summary |
|---|---|
| public boolean isDataFlavorSupported(DataFlavor flavor) Implements java. Returns whether or not the specified data flavor is supported by the encapsulated transferable.
| |