< prev index next >
src/java.desktop/share/classes/java/awt/dnd/DropTargetContext.java
Print this page
*** 41,55 ****
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.DropTargetContextAccessor;
/**
! * A <code>DropTargetContext</code> is created
* whenever the logical cursor associated
* with a Drag and Drop operation coincides with the visible geometry of
! * a <code>Component</code> associated with a <code>DropTarget</code>.
! * The <code>DropTargetContext</code> 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.
*
--- 41,55 ----
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.DropTargetContextAccessor;
/**
! * A {@code DropTargetContext} is created
* whenever the logical cursor associated
* with a Drag and Drop operation coincides with the visible geometry of
! * a {@code Component} associated with a {@code DropTarget}.
! * The {@code 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.
*
*** 72,83 ****
dtc.setDropTargetContextPeer(dtcp);
}
});
}
/**
! * Construct a <code>DropTargetContext</code>
! * given a specified <code>DropTarget</code>.
*
* @param dt the DropTarget to associate with
*/
DropTargetContext(DropTarget dt) {
--- 72,83 ----
dtc.setDropTargetContextPeer(dtcp);
}
});
}
/**
! * Construct a {@code DropTargetContext}
! * given a specified {@code DropTarget}.
*
* @param dt the DropTarget to associate with
*/
DropTargetContext(DropTarget dt) {
*** 85,124 ****
dropTarget = dt;
}
/**
! * This method returns the <code>DropTarget</code> associated with this
! * <code>DropTargetContext</code>.
*
! * @return the <code>DropTarget</code> associated with this <code>DropTargetContext</code>
*/
public DropTarget getDropTarget() { return dropTarget; }
/**
! * This method returns the <code>Component</code> associated with
! * this <code>DropTargetContext</code>.
*
* @return the Component associated with this Context
*/
public Component getComponent() { return dropTarget.getComponent(); }
/**
! * Called when disassociated with the <code>DropTargetContextPeer</code>.
*/
void reset() {
dropTargetContextPeer = null;
transferable = null;
}
/**
* This method sets the current actions acceptable to
! * this <code>DropTarget</code>.
*
! * @param actions an <code>int</code> representing the supported action(s)
*/
protected void setTargetActions(int actions) {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
--- 85,124 ----
dropTarget = dt;
}
/**
! * This method returns the {@code DropTarget} associated with this
! * {@code DropTargetContext}.
*
! * @return the {@code DropTarget} associated with this {@code DropTargetContext}
*/
public DropTarget getDropTarget() { return dropTarget; }
/**
! * This method returns the {@code Component} associated with
! * this {@code DropTargetContext}.
*
* @return the Component associated with this Context
*/
public Component getComponent() { return dropTarget.getComponent(); }
/**
! * Called when disassociated with the {@code DropTargetContextPeer}.
*/
void reset() {
dropTargetContextPeer = null;
transferable = null;
}
/**
* This method sets the current actions acceptable to
! * this {@code DropTarget}.
*
! * @param actions an {@code int} representing the supported action(s)
*/
protected void setTargetActions(int actions) {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
*** 130,143 ****
getDropTarget().doSetDefaultActions(actions);
}
}
/**
! * This method returns an <code>int</code> representing the
! * current actions this <code>DropTarget</code> will accept.
*
! * @return the current actions acceptable to this <code>DropTarget</code>
*/
protected int getTargetActions() {
DropTargetContextPeer peer = getDropTargetContextPeer();
return ((peer != null)
--- 130,143 ----
getDropTarget().doSetDefaultActions(actions);
}
}
/**
! * This method returns an {@code int} representing the
! * current actions this {@code DropTarget} will accept.
*
! * @return the current actions acceptable to this {@code DropTarget}
*/
protected int getTargetActions() {
DropTargetContextPeer peer = getDropTargetContextPeer();
return ((peer != null)
*** 213,255 ****
}
}
/**
* get the available DataFlavors of the
! * <code>Transferable</code> operand of this operation.
*
! * @return a <code>DataFlavor[]</code> containing the
! * supported <code>DataFlavor</code>s of the
! * <code>Transferable</code> operand.
*/
protected DataFlavor[] getCurrentDataFlavors() {
DropTargetContextPeer peer = getDropTargetContextPeer();
return peer != null ? peer.getTransferDataFlavors() : new DataFlavor[0];
}
/**
* This method returns a the currently available DataFlavors
! * of the <code>Transferable</code> operand
! * as a <code>java.util.List</code>.
*
* @return the currently available
! * DataFlavors as a <code>java.util.List</code>
*/
protected List<DataFlavor> getCurrentDataFlavorsAsList() {
return Arrays.asList(getCurrentDataFlavors());
}
/**
! * This method returns a <code>boolean</code>
! * indicating if the given <code>DataFlavor</code> is
! * supported by this <code>DropTargetContext</code>.
*
! * @param df the <code>DataFlavor</code>
*
! * @return if the <code>DataFlavor</code> specified is supported
*/
protected boolean isDataFlavorSupported(DataFlavor df) {
return getCurrentDataFlavorsAsList().contains(df);
}
--- 213,255 ----
}
}
/**
* get the available DataFlavors of the
! * {@code Transferable} operand of this operation.
*
! * @return a {@code DataFlavor[]} containing the
! * supported {@code DataFlavor}s of the
! * {@code Transferable} operand.
*/
protected DataFlavor[] getCurrentDataFlavors() {
DropTargetContextPeer peer = getDropTargetContextPeer();
return peer != null ? peer.getTransferDataFlavors() : new DataFlavor[0];
}
/**
* This method returns a the currently available DataFlavors
! * of the {@code Transferable} operand
! * as a {@code java.util.List}.
*
* @return the currently available
! * DataFlavors as a {@code java.util.List}
*/
protected List<DataFlavor> getCurrentDataFlavorsAsList() {
return Arrays.asList(getCurrentDataFlavors());
}
/**
! * This method returns a {@code boolean}
! * indicating if the given {@code DataFlavor} is
! * supported by this {@code DropTargetContext}.
*
! * @param df the {@code DataFlavor}
*
! * @return if the {@code DataFlavor} specified is supported
*/
protected boolean isDataFlavorSupported(DataFlavor df) {
return getCurrentDataFlavorsAsList().contains(df);
}
*** 257,267 ****
/**
* get the Transferable (proxy) operand of this operation
*
* @throws InvalidDnDOperationException if a drag is not outstanding/extant
*
! * @return the <code>Transferable</code>
*/
protected Transferable getTransferable() throws InvalidDnDOperationException {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer == null) {
--- 257,267 ----
/**
* get the Transferable (proxy) operand of this operation
*
* @throws InvalidDnDOperationException if a drag is not outstanding/extant
*
! * @return the {@code Transferable}
*/
protected Transferable getTransferable() throws InvalidDnDOperationException {
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer == null) {
*** 280,290 ****
return transferable;
}
}
/**
! * Get the <code>DropTargetContextPeer</code>
*
* @return the platform peer
*/
DropTargetContextPeer getDropTargetContextPeer() {
return dropTargetContextPeer;
--- 280,290 ----
return transferable;
}
}
/**
! * Get the {@code DropTargetContextPeer}
*
* @return the platform peer
*/
DropTargetContextPeer getDropTargetContextPeer() {
return dropTargetContextPeer;
*** 299,342 ****
/**
* Creates a TransferableProxy to proxy for the specified
* Transferable.
*
! * @param t the <tt>Transferable</tt> to be proxied
! * @param local <tt>true</tt> if <tt>t</tt> represents
* the result of a local drag-n-drop operation.
! * @return the new <tt>TransferableProxy</tt> instance.
*/
protected Transferable createTransferableProxy(Transferable t, boolean local) {
return new TransferableProxy(t, local);
}
/****************************************************************************/
/**
! * <code>TransferableProxy</code> is a helper inner class that implements
! * <code>Transferable</code> interface and serves as a proxy for another
! * <code>Transferable</code> object which represents data transfer for
* a particular drag-n-drop operation.
* <p>
* 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.
*/
protected class TransferableProxy implements Transferable {
/**
! * Constructs a <code>TransferableProxy</code> given
! * a specified <code>Transferable</code> object representing
* data transfer for a particular drag-n-drop operation and
! * a <code>boolean</code> which indicates whether the
* drag-n-drop operation is local (within the same JVM).
*
! * @param t the <code>Transferable</code> object
! * @param local <code>true</code>, if <code>t</code> represents
* the result of local drag-n-drop operation
*/
TransferableProxy(Transferable t, boolean local) {
proxy = new sun.awt.datatransfer.TransferableProxy(t, local);
transferable = t;
--- 299,342 ----
/**
* Creates a TransferableProxy to proxy for the specified
* Transferable.
*
! * @param t the {@code Transferable} to be proxied
! * @param local {@code true} if {@code t} represents
* the result of a local drag-n-drop operation.
! * @return the new {@code TransferableProxy} instance.
*/
protected Transferable createTransferableProxy(Transferable t, boolean local) {
return new TransferableProxy(t, local);
}
/****************************************************************************/
/**
! * {@code TransferableProxy} is a helper inner class that implements
! * {@code Transferable} interface and serves as a proxy for another
! * {@code Transferable} object which represents data transfer for
* a particular drag-n-drop operation.
* <p>
* 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.
*/
protected class TransferableProxy implements Transferable {
/**
! * Constructs a {@code TransferableProxy} given
! * a specified {@code Transferable} object representing
* data transfer for a particular drag-n-drop operation and
! * a {@code boolean} which indicates whether the
* drag-n-drop operation is local (within the same JVM).
*
! * @param t the {@code Transferable} object
! * @param local {@code true}, if {@code t} represents
* the result of local drag-n-drop operation
*/
TransferableProxy(Transferable t, boolean local) {
proxy = new sun.awt.datatransfer.TransferableProxy(t, local);
transferable = t;
*** 356,367 ****
/**
* Returns whether or not the specified data flavor is supported by
* the encapsulated transferable.
* @param flavor the requested flavor for the data
! * @return <code>true</code> if the data flavor is supported,
! * <code>false</code> otherwise
*/
public boolean isDataFlavorSupported(DataFlavor flavor) {
return proxy.isDataFlavorSupported(flavor);
}
--- 356,367 ----
/**
* Returns whether or not the specified data flavor is supported by
* the encapsulated transferable.
* @param flavor the requested flavor for the data
! * @return {@code true} if the data flavor is supported,
! * {@code false} otherwise
*/
public boolean isDataFlavorSupported(DataFlavor flavor) {
return proxy.isDataFlavorSupported(flavor);
}
*** 395,411 ****
// subclasses of DropTargetContext can access it. And DropTargetContext
// cannot be subclassed by client code because it does not have a
// public constructor.
/**
! * The encapsulated <code>Transferable</code> object.
*/
protected Transferable transferable;
/**
! * A <code>boolean</code> indicating if the encapsulated
! * <code>Transferable</code> object represents the result
* of local drag-n-drop operation (within the same JVM).
*/
protected boolean isLocal;
private sun.awt.datatransfer.TransferableProxy proxy;
--- 395,411 ----
// subclasses of DropTargetContext can access it. And DropTargetContext
// cannot be subclassed by client code because it does not have a
// public constructor.
/**
! * The encapsulated {@code Transferable} object.
*/
protected Transferable transferable;
/**
! * A {@code boolean} indicating if the encapsulated
! * {@code Transferable} object represents the result
* of local drag-n-drop operation (within the same JVM).
*/
protected boolean isLocal;
private sun.awt.datatransfer.TransferableProxy proxy;
< prev index next >