org.openide.util.datatransfer
Class ExTransferable

java.lang.Object
  extended by org.openide.util.datatransfer.ExTransferable
All Implemented Interfaces:
java.awt.datatransfer.Transferable

public class ExTransferable
extends java.lang.Object
implements java.awt.datatransfer.Transferable

Provides additional operations on a transferable.

Author:
Jaroslav Tulach

Nested Class Summary
static class ExTransferable.Multi
          Transferable object for multiple transfer.
static class ExTransferable.Single
          Support for transferable owner with only one data flavor.
 
Field Summary
static java.awt.datatransfer.Transferable EMPTY
          An implementation of Transferable that contains no data.
static java.awt.datatransfer.DataFlavor multiFlavor
          Flavor for transfer of multiple objects.
 
Method Summary
 void addTransferListener(TransferListener l)
          Adds a listener to watch the life-cycle of this object.
static ExTransferable create(java.awt.datatransfer.Transferable t)
          Method to create a new extended transferable from a plain transferable.
(package private)  void fireAccepted(int action)
          Fires notification to all listeners about accepting the drag.
(package private)  void fireOwnershipLost()
          Fires notification to all listeners about accepting the drag.
(package private)  void fireRejected()
          Fires notification to all listeners about accepting the drag.
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
           
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
           
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
           
 void put(ExTransferable.Single single)
          Add a new flavor with its data.
 void remove(java.awt.datatransfer.DataFlavor flavor)
          Remove a flavor from the supported set.
 void removeTransferListener(TransferListener l)
          Removes a listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final java.awt.datatransfer.Transferable EMPTY
An implementation of Transferable that contains no data.


multiFlavor

public static final java.awt.datatransfer.DataFlavor multiFlavor
Flavor for transfer of multiple objects.

Method Detail

put

public void put(ExTransferable.Single single)
Add a new flavor with its data.

Parameters:
single - the single transferable to use

remove

public void remove(java.awt.datatransfer.DataFlavor flavor)
Remove a flavor from the supported set.

Parameters:
flavor - the flavor to remove

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
Throws:
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException

create

public static ExTransferable create(java.awt.datatransfer.Transferable t)
Method to create a new extended transferable from a plain transferable. If the given transferable is already ExTransferable, then it is returned as is. Otherwise the data is copied.

Parameters:
t - transferable to create support for
Returns:
extended transferable

addTransferListener

public final void addTransferListener(TransferListener l)
Adds a listener to watch the life-cycle of this object.

Parameters:
l - the listener

removeTransferListener

public final void removeTransferListener(TransferListener l)
Removes a listener.


fireAccepted

final void fireAccepted(int action)
Fires notification to all listeners about accepting the drag.

Parameters:
action - one of java.awt.dnd.DnDConstants.ACTION_*

fireRejected

final void fireRejected()
Fires notification to all listeners about accepting the drag.


fireOwnershipLost

final void fireOwnershipLost()
Fires notification to all listeners about accepting the drag.