com.rolemodelsoft.drawlet.basics
Class FigureTransfer

java.lang.Object
  |
  +--com.rolemodelsoft.drawlet.basics.FigureTransfer

public class FigureTransfer
extends java.lang.Object
implements java.awt.datatransfer.ClipboardOwner, java.awt.datatransfer.Transferable

Used to transfer objects from the DrawingCanvas to the clipboard.


Field Summary
protected  java.util.Vector figures
          The figures that this FigureTransfer represents.
static java.awt.datatransfer.DataFlavor figuresFlavor
          The DataFlavor that FigureTransfers represent.
 
Constructor Summary
FigureTransfer(java.util.Vector figures)
          Create a new FigureTransfer, and initialize it with the given Vector, which is assumed to contain Figures.
 
Method Summary
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
          Return the data that the receiver holds, in the given flavor.
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
          Answer the DataFlavors currently held.
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
          Answer whether or not the given flavor is supported.
 void lostOwnership(java.awt.datatransfer.Clipboard clipboard, java.awt.datatransfer.Transferable contents)
          Called when the receiver no longer hold ownership of the clipboard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

figures

protected java.util.Vector figures
The figures that this FigureTransfer represents.

figuresFlavor

public static java.awt.datatransfer.DataFlavor figuresFlavor
The DataFlavor that FigureTransfers represent.
Constructor Detail

FigureTransfer

public FigureTransfer(java.util.Vector figures)
Create a new FigureTransfer, and initialize it with the given Vector, which is assumed to contain Figures.
Parameters:
figures - a vector of the figures to be associated with this FigureTransfer
Method Detail

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                 throws java.io.IOException,
                                        java.awt.datatransfer.UnsupportedFlavorException
Return the data that the receiver holds, in the given flavor.
Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
Parameters:
flavor - the DataFlavor that the data should be returned as.
Returns:
an Object that is the data.

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Answer the DataFlavors currently held.
Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable
Returns:
an array of the DataFlavors currently contained in this FigureTransfer.

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Answer whether or not the given flavor is supported.
Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable
Parameters:
flavor - the flavor to check
Returns:
boolean value of true if the flavor is supported; false otherwise.

lostOwnership

public void lostOwnership(java.awt.datatransfer.Clipboard clipboard,
                          java.awt.datatransfer.Transferable contents)
Called when the receiver no longer hold ownership of the clipboard.
Specified by:
lostOwnership in interface java.awt.datatransfer.ClipboardOwner
Parameters:
clipboard - the Clipboard whose ownership was lost.
contents - the contents of the Clipboard when ownership was lost.