Methods Summary |
---|
protected void | acceptDrag(int dragOperation)accept the Drag.
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.acceptDrag(dragOperation);
}
|
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.
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.acceptDrop(dropOperation);
}
|
public void | addNotify(java.awt.dnd.peer.DropTargetContextPeer dtcp)Called when associated with the DropTargetContextPeer .
dropTargetContextPeer = dtcp;
|
protected java.awt.datatransfer.Transferable | createTransferableProxy(java.awt.datatransfer.Transferable t, boolean local)Creates a TransferableProxy to proxy for the specified
Transferable.
return new TransferableProxy(t, local);
|
public void | dropComplete(boolean success)This method signals that the drop is completed and
if it was successful or not.
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.dropComplete(success);
}
|
public java.awt.Component | getComponent()This method returns the Component associated with
this DropTargetContext .
return dropTarget.getComponent();
|
protected java.awt.datatransfer.DataFlavor[] | getCurrentDataFlavors()get the available DataFlavors of the
Transferable operand of this operation.
DropTargetContextPeer peer = getDropTargetContextPeer();
return peer != null ? peer.getTransferDataFlavors() : new DataFlavor[0];
|
protected java.util.List | getCurrentDataFlavorsAsList()This method returns a the currently available DataFlavors
of the Transferable operand
as a java.util.List .
return Arrays.asList(getCurrentDataFlavors());
|
public java.awt.dnd.DropTarget | getDropTarget()This method returns the DropTarget associated with this
DropTargetContext .
return dropTarget;
|
java.awt.dnd.peer.DropTargetContextPeer | getDropTargetContextPeer()Get the DropTargetContextPeer
return dropTargetContextPeer;
|
protected int | getTargetActions()This method returns an int representing the
current actions this DropTarget will accept.
DropTargetContextPeer peer = getDropTargetContextPeer();
return ((peer != null)
? peer.getTargetActions()
: dropTarget.getDefaultActions()
);
|
protected java.awt.datatransfer.Transferable | getTransferable()get the Transferable (proxy) operand of this operation
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer == null) {
throw new InvalidDnDOperationException();
} else {
if (transferable == null) {
Transferable t = peer.getTransferable();
boolean isLocal = peer.isTransferableJVMLocal();
synchronized (this) {
if (transferable == null) {
transferable = createTransferableProxy(t, isLocal);
}
}
}
return transferable;
}
|
protected boolean | isDataFlavorSupported(java.awt.datatransfer.DataFlavor df)This method returns a boolean
indicating if the given DataFlavor is
supported by this DropTargetContext .
return getCurrentDataFlavorsAsList().contains(df);
|
protected void | rejectDrag()reject the Drag.
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.rejectDrag();
}
|
protected void | rejectDrop()called to signal that the drop is unacceptable.
must be called during DropTargetListener.drop method invocation.
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
peer.rejectDrop();
}
|
public void | removeNotify()Called when disassociated with the DropTargetContextPeer .
dropTargetContextPeer = null;
transferable = null;
|
protected void | setTargetActions(int actions)This method sets the current actions acceptable to
this DropTarget .
DropTargetContextPeer peer = getDropTargetContextPeer();
if (peer != null) {
synchronized (peer) {
peer.setTargetActions(actions);
getDropTarget().doSetDefaultActions(actions);
}
} else {
getDropTarget().doSetDefaultActions(actions);
}
|