org.artoflife.util.dnd
Class ThumbnailTransferable

java.lang.Object
  |
  +--org.artoflife.util.dnd.ThumbnailTransferable
All Implemented Interfaces:
java.awt.datatransfer.Transferable
Direct Known Subclasses:
PaintableIndividualTransferable

public abstract class ThumbnailTransferable
extends java.lang.Object
implements java.awt.datatransfer.Transferable

To accommodate drag images (even where the JVM doesn't support them, for example on Win32) this Transferable base class includes a ThumbnailIcon containing an Icon and a cursor offset within the icon so that DropTargetListeners can draw the image.

Use by subclassing custom Transferables, but note that subclasses must include the THUMBNAIL_ICON_FLAVOR in the flavors they understand and must call setThumbnailIcon() here from their constructor.

Author:
Steve Meyfroidt

Field Summary
static java.awt.datatransfer.DataFlavor THUMBNAIL_ICON_FLAVOR
          Need to add this to the flavors of concrete subclasses!
 
Constructor Summary
ThumbnailTransferable()
           
 
Method Summary
 ThumbnailIcon getThumbnailIcon()
           
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
          Must call this in the 'else' of concrete subclasses' getTransferData() to handle the THUMBNAIL_ICON_FLAVOR.
protected  void setThumbnailIcon(ThumbnailIcon thumbnailIcon)
          This must be called from subclasses on creation in order to populate the THUMBNAIL_ICON_FLAVOR data flavor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.datatransfer.Transferable
getTransferDataFlavors, isDataFlavorSupported
 

Field Detail

THUMBNAIL_ICON_FLAVOR

public static final java.awt.datatransfer.DataFlavor THUMBNAIL_ICON_FLAVOR
Need to add this to the flavors of concrete subclasses!

Constructor Detail

ThumbnailTransferable

public ThumbnailTransferable()
Method Detail

setThumbnailIcon

protected void setThumbnailIcon(ThumbnailIcon thumbnailIcon)
This must be called from subclasses on creation in order to populate the THUMBNAIL_ICON_FLAVOR data flavor. * @param thumbnailIcon the icon to be painted by ThumbnailIconDropTargetListeners.


getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
Must call this in the 'else' of concrete subclasses' getTransferData() to handle the THUMBNAIL_ICON_FLAVOR.

Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException
See Also:
Transferable.getTransferData(java.awt.datatransfer.DataFlavor)

getThumbnailIcon

public ThumbnailIcon getThumbnailIcon()
Returns:
the icon to be painted by ThumbnailIconDropTargetListeners.

artoflife pre0.1.0-dev

Copyright © 2002 the Art Of Life team. All Rights Reserved.