APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.awt.dnd

public abstract Class SunDropTargetContextPeer

extends Object
implements DropTargetContextPeer, Transferable
Class Inheritance
All Implemented Interfaces
java.awt.datatransfer.Transferable, java.awt.dnd.peer.DropTargetContextPeer
Known Direct Subclasses
sun.awt.X11.XDropTargetContextPeer
Imports
java.awt.Component, .Point, java.awt.datatransfer.DataFlavor, .Transferable, .UnsupportedFlavorException, java.awt.dnd.DnDConstants, .DropTarget, .DropTargetContext, .DropTargetListener, .DropTargetEvent, .DropTargetDragEvent, .DropTargetDropEvent, .InvalidDnDOperationException, java.awt.dnd.peer.DropTargetContextPeer, java.util.HashSet, .Map, .Arrays, sun.awt.AWTAccessor, .AWTAccessor.DropTargetContextAccessor, .SunToolkit, sun.util.logging.PlatformLogger, java.io.IOException, .InputStream, sun.awt.datatransfer.DataTransferer, .ToolkitThreadBlockedHandler

The SunDropTargetContextPeer class is the generic class responsible for handling the interaction between a windowing systems DnD system and Java.

Since
1.3.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class

Field Summary

Modifier and TypeField and Description
protected static final Object
private int
private int
private DropTarget
private DropTargetContext
protected static Transferable
private int
private long[]
public static final boolean
private static final PlatformLogger
private boolean
protected boolean
pack-priv boolean
protected int
private Transferable
private long
private int
protected static final int
protected static final int
protected static final int
protected static final int

Constructor Summary

AccessConstructor and Description
public
SunDropTargetContextPeer()

create the peer

Method Summary

Modifier and TypeMethod and Description
public synchronized void
acceptDrag(int dragOperation)

Implements java.awt.dnd.peer.DropTargetContextPeer.acceptDrag.

acceptDrag

public synchronized void
acceptDrop(int dropOperation)

Implements java.awt.dnd.peer.DropTargetContextPeer.acceptDrop.

acceptDrop

protected abstract void
doDropDone(boolean success, int dropAction, boolean isLocal)

public synchronized void
dropComplete(boolean success)

Implements java.awt.dnd.peer.DropTargetContextPeer.dropComplete.

signal drop complete

protected void
protected void
eventProcessed(SunDropTargetEvent e, int returnValue, boolean dispatcherDone)

public DropTarget

Returns:

the DropTarget associated with this peer
getDropTarget
()

Implements java.awt.dnd.peer.DropTargetContextPeer.getDropTarget.

get the DropTarget associated with this peer

private static Transferable
getJVMLocalSourceTransferable()

obtain the transferable iff the operation is in the same VM

protected abstract Object
getNativeData(long format)

protected synchronized long
public int

Returns:

the current target actions
getTargetActions
()

Implements java.awt.dnd.peer.DropTargetContextPeer.getTargetActions.

get the current Target actions

public Transferable
getTransferable()

Implements java.awt.dnd.peer.DropTargetContextPeer.getTransferable.

get the Transferable associated with the drop

public Object

Returns:

the data
getTransferData
(DataFlavor df)

Implements java.awt.datatransfer.Transferable.getTransferData.

Returns an object which represents the data to be transferred.

public DataFlavor[]

Returns:

current DataFlavors available
getTransferDataFlavors
()

Implements java.awt.dnd.peer.DropTargetContextPeer.getTransferDataFlavors, java.awt.datatransfer.Transferable.getTransferDataFlavors.

get the (remote) DataFlavors from the peer

private void
handleDropMessage(final Component component, final int x, final int y, final int dropAction, final int actions, final long[] formats, final long nativeCtxt)

upcall to handle the Drop message

private int
handleEnterMessage(final Component component, final int x, final int y, final int dropAction, final int actions, final long[] formats, final long nativeCtxt)

private void
handleExitMessage(final Component component, final long nativeCtxt)

upcall to handle exit messages

private int
handleMotionMessage(final Component component, final int x, final int y, final int dropAction, final int actions, final long[] formats, final long nativeCtxt)

public boolean

Returns:

true if the flavor is supported, otherwise false
isDataFlavorSupported
(DataFlavor df)

Implements java.awt.datatransfer.Transferable.isDataFlavorSupported.

Returns whether or not the specified data flavor is supported for this object.

public boolean

Returns:

true if the transfer is a local one, otherwise false
isTransferableJVMLocal
()

Implements java.awt.dnd.peer.DropTargetContextPeer.isTransferableJVMLocal.

Return whether or not the DragSource Transferable is in the same JVM as the Target.

private int
mapOperation(int operation)

mapOperation

protected int
postDropTargetEvent(final Component component, final int x, final int y, final int dropAction, final int actions, final long[] formats, final long nativeCtxt, final int eventID, final boolean dispatchType)

protected void
protected void
processEnterMessage(SunDropTargetEvent event)

actual processing on EventQueue Thread

protected void
protected void
processMotionMessage(SunDropTargetEvent event, boolean operationChanged)

public synchronized void
public synchronized void
public static void
public synchronized void
setTargetActions(int
set the current actions
actions
)

Implements java.awt.dnd.peer.DropTargetContextPeer.setTargetActions.

update the peer's notion of the Target's actions

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_globalLockback to summary
protected static final Object _globalLock
currentAback to summary
private int currentA
currentDAback to summary
private int currentDA
currentDTback to summary
private DropTarget currentDT
currentDTCback to summary
private DropTargetContext currentDTC
currentJVMLocalSourceTransferableback to summary
protected static Transferable currentJVMLocalSourceTransferable
currentSAback to summary
private int currentSA
currentTback to summary
private long[] currentT
DISPATCH_SYNCback to summary
public static final boolean DISPATCH_SYNC
dndLogback to summary
private static final PlatformLogger dndLog
dragRejectedback to summary
private boolean dragRejected
dropCompleteback to summary
protected boolean dropComplete
dropInProcessback to summary
pack-priv boolean dropInProcess
dropStatusback to summary
protected int dropStatus
localback to summary
private Transferable local
nativeDragContextback to summary
private long nativeDragContext
previousDAback to summary
private int previousDA
STATUS_ACCEPTback to summary
protected static final int STATUS_ACCEPT
STATUS_NONEback to summary
protected static final int STATUS_NONE
STATUS_REJECTback to summary
protected static final int STATUS_REJECT
STATUS_WAITback to summary
protected static final int STATUS_WAIT

Constructor Detail

SunDropTargetContextPeerback to summary
public SunDropTargetContextPeer()

create the peer

Method Detail

acceptDragback to summary
public synchronized void acceptDrag(int dragOperation)

Implements java.awt.dnd.peer.DropTargetContextPeer.acceptDrag.

acceptDrag

acceptDropback to summary
public synchronized void acceptDrop(int dropOperation)

Implements java.awt.dnd.peer.DropTargetContextPeer.acceptDrop.

acceptDrop

doDropDoneback to summary
protected abstract void doDropDone(boolean success, int dropAction, boolean isLocal)
dropCompleteback to summary
public synchronized void dropComplete(boolean success)

Implements java.awt.dnd.peer.DropTargetContextPeer.dropComplete.

signal drop complete

eventPostedback to summary
protected void eventPosted(SunDropTargetEvent e)
eventProcessedback to summary
protected void eventProcessed(SunDropTargetEvent e, int returnValue, boolean dispatcherDone)
getDropTargetback to summary
public DropTarget getDropTarget()

Implements java.awt.dnd.peer.DropTargetContextPeer.getDropTarget.

Doc from java.awt.dnd.peer.DropTargetContextPeer.getDropTarget.

get the DropTarget associated with this peer

Returns:DropTarget

the DropTarget associated with this peer

getJVMLocalSourceTransferableback to summary
private static Transferable getJVMLocalSourceTransferable()

obtain the transferable iff the operation is in the same VM

getNativeDataback to summary
protected abstract Object getNativeData(long format) throws IOException
getNativeDragContextback to summary
protected synchronized long getNativeDragContext()
getTargetActionsback to summary
public int getTargetActions()

Implements java.awt.dnd.peer.DropTargetContextPeer.getTargetActions.

Doc from java.awt.dnd.peer.DropTargetContextPeer.getTargetActions.

get the current Target actions

Returns:int

the current target actions

getTransferableback to summary
public Transferable getTransferable()

Implements java.awt.dnd.peer.DropTargetContextPeer.getTransferable.

get the Transferable associated with the drop

getTransferDataback to summary
public Object getTransferData(DataFlavor df) throws UnsupportedFlavorException, IOException, InvalidDnDOperationException

Implements java.awt.datatransfer.Transferable.getTransferData.

Doc from java.awt.datatransfer.Transferable.getTransferData.

Returns an object which represents the data to be transferred. The class of the object returned is defined by the representation class of the flavor.

Returns:Object

the data

Exceptions
UnsupportedFlavorException:
if the requested data flavor is not supported
IOException:
if the data is no longer available in the requested flavor
getTransferDataFlavorsback to summary
public DataFlavor[] getTransferDataFlavors()

Implements java.awt.dnd.peer.DropTargetContextPeer.getTransferDataFlavors, java.awt.datatransfer.Transferable.getTransferDataFlavors.

Doc from java.awt.dnd.peer.DropTargetContextPeer.getTransferDataFlavors.

get the (remote) DataFlavors from the peer

Returns:DataFlavor[]

current DataFlavors available

handleDropMessageback to summary
private void handleDropMessage(final Component component, final int x, final int y, final int dropAction, final int actions, final long[] formats, final long nativeCtxt)

upcall to handle the Drop message

handleEnterMessageback to summary
private int handleEnterMessage(final Component component, final int x, final int y, final int dropAction, final int actions, final long[] formats, final long nativeCtxt)
handleExitMessageback to summary
private void handleExitMessage(final Component component, final long nativeCtxt)

upcall to handle exit messages

handleMotionMessageback to summary
private int handleMotionMessage(final Component component, final int x, final int y, final int dropAction, final int actions, final long[] formats, final long nativeCtxt)
isDataFlavorSupportedback to summary
public boolean isDataFlavorSupported(DataFlavor df)

Implements java.awt.datatransfer.Transferable.isDataFlavorSupported.

Doc from java.awt.datatransfer.Transferable.isDataFlavorSupported.

Returns whether or not the specified data flavor is supported for this object.

Returns:boolean

true if the flavor is supported, otherwise false

isTransferableJVMLocalback to summary
public boolean isTransferableJVMLocal()

Implements java.awt.dnd.peer.DropTargetContextPeer.isTransferableJVMLocal.

Doc from java.awt.dnd.peer.DropTargetContextPeer.isTransferableJVMLocal.

Return whether or not the DragSource Transferable is in the same JVM as the Target.

Returns:boolean

true if the transfer is a local one, otherwise false

mapOperationback to summary
private int mapOperation(int operation)

mapOperation

postDropTargetEventback to summary
protected int postDropTargetEvent(final Component component, final int x, final int y, final int dropAction, final int actions, final long[] formats, final long nativeCtxt, final int eventID, final boolean dispatchType)
processDropMessageback to summary
protected void processDropMessage(SunDropTargetEvent event)
processEnterMessageback to summary
protected void processEnterMessage(SunDropTargetEvent event)

actual processing on EventQueue Thread

processExitMessageback to summary
protected void processExitMessage(SunDropTargetEvent event)
processMotionMessageback to summary
protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged)
rejectDragback to summary
public synchronized void rejectDrag()

Implements java.awt.dnd.peer.DropTargetContextPeer.rejectDrag.

rejectDrag

rejectDropback to summary
public synchronized void rejectDrop()

Implements java.awt.dnd.peer.DropTargetContextPeer.rejectDrop.

reject Drop

setCurrentJVMLocalSourceTransferableback to summary
public static void setCurrentJVMLocalSourceTransferable(Transferable t) throws InvalidDnDOperationException
setTargetActionsback to summary
public synchronized void setTargetActions(int actions)

Implements java.awt.dnd.peer.DropTargetContextPeer.setTargetActions.

Doc from java.awt.dnd.peer.DropTargetContextPeer.setTargetActions.

update the peer's notion of the Target's actions

Parameters
actions:int

set the current actions

sun.awt.dnd back to summary

protected Class SunDropTargetContextPeer.EventDispatcher

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final int
private boolean
private final boolean
private final int
private final HashSet<SunDropTargetEvent>
private final long[]
pack-priv static final ToolkitThreadBlockedHandler
private long
private final SunDropTargetContextPeer
private int

Constructor Summary

AccessConstructor and Description
pack-priv
EventDispatcher(SunDropTargetContextPeer peer, int dropAction, int actions, long[] formats, long nativeCtxt, boolean dispatchType)

Method Summary

Modifier and TypeMethod and Description
private void
private void
pack-priv void
private void
private void
pack-priv int
pack-priv boolean
pack-priv void
pack-priv void
setReturnValue(int ret)

public void
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

actionsback to summary
private final int actions
dispatcherDoneback to summary
private boolean dispatcherDone
dispatchTypeback to summary
private final boolean dispatchType
dropActionback to summary
private final int dropAction
eventSetback to summary
private final HashSet<SunDropTargetEvent> eventSet
formatsback to summary
private final long[] formats
handlerback to summary
pack-priv static final ToolkitThreadBlockedHandler handler
nativeCtxtback to summary
private long nativeCtxt
peerback to summary
private final SunDropTargetContextPeer peer
returnValueback to summary
private int returnValue

Constructor Detail

EventDispatcherback to summary
pack-priv EventDispatcher(SunDropTargetContextPeer peer, int dropAction, int actions, long[] formats, long nativeCtxt, boolean dispatchType)

Method Detail

dispatchDropEventback to summary
private void dispatchDropEvent(SunDropTargetEvent e)
dispatchEnterEventback to summary
private void dispatchEnterEvent(SunDropTargetEvent e)
dispatchEventback to summary
pack-priv void dispatchEvent(SunDropTargetEvent e)
dispatchExitEventback to summary
private void dispatchExitEvent(SunDropTargetEvent e)
dispatchMotionEventback to summary
private void dispatchMotionEvent(SunDropTargetEvent e)
getReturnValueback to summary
pack-priv int getReturnValue()
isDoneback to summary
pack-priv boolean isDone()
registerEventback to summary
pack-priv void registerEvent(SunDropTargetEvent e)
setReturnValueback to summary
pack-priv void setReturnValue(int ret)
unregisterAllEventsback to summary
public void unregisterAllEvents()
unregisterEventback to summary
pack-priv void unregisterEvent(SunDropTargetEvent e)