站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Class DropTargetContext - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

java.awt.dnd
Class DropTargetContext

java.lang.Object
  |
  +--java.awt.dnd.DropTargetContext

public class DropTargetContext
extends Object

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:
JDK1.2

Inner Class Summary
protected  class DropTargetContext.TransferableProxy
          The TransferableProxy is a nested helper class that supports the DropTargetContext in managing the transfer of data.
 
Method Summary
protected  void acceptDrag(int dragOperation)
          accept the Drag.
protected  void acceptDrop(int dropOperation)
          called to signal that the drop is acceptable using the specified operation.
 void addNotify(java.awt.dnd.peer.DropTargetContextPeer dtcp)
          Called when associated with the DropTargetContextPeer.
protected  Transferable createTransferableProxy(Transferable t, boolean local)
          subclasses may override this to supply their own Proxy Transferable
 void dropComplete(boolean success)
          This method signals that the drop is completed and if it was successful or not.
 Component getComponent()
          This method returns the Component associated with this DropTargetContext.
protected  DataFlavor[] getCurrentDataFlavors()
          get the available DataFlavors of the Transferable operand of this operation.
protected  List getCurrentDataFlavorsAsList()
          This method returns a the currently available DataFlavors of the Transferable operand as a java.util.List.
 DropTarget getDropTarget()
          This method returns the DropTarget associated with this DropTargetContext.
protected  int getTargetActions()
          This method returns an int representing the current actions this DropTarget will accept.
protected  Transferable getTransferable()
          get the Transferable (proxy) operand of this operation
protected  boolean isDataFlavorSupported(DataFlavor df)
          This method returns a boolean indicating if the given DataFlavor is supported by this DropTargetContext.
protected  void rejectDrag()
          reject the Drag.
protected  void rejectDrop()
          called to signal that the drop is unacceptable.
 void removeNotify()
          Called when disassociated with the DropTargetContextPeer.
protected  void setTargetActions(int actions)
          This method sets the current actions acceptable to this DropTarget.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDropTarget

public DropTarget getDropTarget()
This method returns the DropTarget associated with this DropTargetContext.

Returns:
the DropTarget associated with this DropTargetContext

getComponent

public Component getComponent()
This method returns the Component associated with this DropTargetContext.

Returns:
the Component associated with this Context

addNotify

public void addNotify(java.awt.dnd.peer.DropTargetContextPeer dtcp)
Called when associated with the DropTargetContextPeer.

Parameters:
dtcp - the DropTargetContextPeer

removeNotify

public void removeNotify()
Called when disassociated with the DropTargetContextPeer.

setTargetActions

protected void setTargetActions(int actions)
This method sets the current actions acceptable to this DropTarget.

Parameters:
actions - an int representing the supported action(s)

getTargetActions

protected int getTargetActions()
This method returns an int representing the current actions this DropTarget will accept.

Returns:
the current actions acceptable to this DropTarget

dropComplete

public void dropComplete(boolean success)
                  throws InvalidDnDOperationException
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

protected DataFlavor[] getCurrentDataFlavors()
get the available DataFlavors of the Transferable operand of this operation.

Returns:
a DataFlavor[] containing the supported DataFlavors of the Transferable operand.

getCurrentDataFlavorsAsList

protected List getCurrentDataFlavorsAsList()
This method returns a the currently available DataFlavors of the Transferable operand as a java.util.List.

Returns:
the currently available DataFlavors as a java.util.List

isDataFlavorSupported

protected boolean isDataFlavorSupported(DataFlavor df)
This method returns a boolean indicating if the given DataFlavor is supported by this DropTargetContext.

Parameters:
df - the DataFlavor

Returns:
if the DataFlavor specified is supported

getTransferable

protected Transferable getTransferable()
                                throws InvalidDnDOperationException
get the Transferable (proxy) operand of this operation

Returns:
the Transferable
Throws:
InvalidDnDOperationException - if a drag is not outstanding/extant


createTransferableProxy

protected Transferable createTransferableProxy(Transferable t,
                                               boolean local)
subclasses may override this to supply their own Proxy Transferable

Parameters:
t - the Transferable
local - boolean

Returns:
the Transferable

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.