http://www.jpicedt.org

jpicedt.graphic.toolkit
Class TransferableGraphic

java.lang.Object
  extended by jpicedt.graphic.toolkit.TransferableGraphic
All Implemented Interfaces:
ClipboardOwner, Transferable

public class TransferableGraphic
extends Object
implements Transferable, ClipboardOwner

Wrapper for Element's that can be transfered to/from a Clipboard. Contrary to a BranchElement implementation:


Field Summary
static DataFlavor JPICEDT_DATA_FLAVOR
          the DataFlavor for Element's
 
Constructor Summary
TransferableGraphic(Element[] elements, String formatted, PECanvas sourceBoard)
          Construct a new TransferableGraphic from a clone of the given elements and the given String containing the formatted representation of the elements (this depends on the ContentType of of the caller).
 
Method Summary
 PECanvas getSourceBoard()
           
 Object getTransferData(DataFlavor flavor)
           
 DataFlavor[] getTransferDataFlavors()
           
 boolean isDataFlavorSupported(DataFlavor flavor)
           
 void lostOwnership(Clipboard c, Transferable contents)
          Notifies this object that it is no longer the owner of the content of the clipboard This implementation does nothing.
 void setSourceBoard(PECanvas board)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JPICEDT_DATA_FLAVOR

public static final DataFlavor JPICEDT_DATA_FLAVOR
the DataFlavor for Element's

Constructor Detail

TransferableGraphic

public TransferableGraphic(Element[] elements,
                           String formatted,
                           PECanvas sourceBoard)
Construct a new TransferableGraphic from a clone of the given elements and the given String containing the formatted representation of the elements (this depends on the ContentType of of the caller).

Parameters:
elements - an array of elements to be set as the content of this Transferable
formatted - the text representation of the given elements (can be null)
sourceBoard - the board from which the elements are copied (can be null)
Since:
jPicEdt 1.3.2
Method Detail

getSourceBoard

public PECanvas getSourceBoard()

setSourceBoard

public void setSourceBoard(PECanvas board)

getTransferData

public Object getTransferData(DataFlavor flavor)
Specified by:
getTransferData in interface Transferable
Parameters:
flavor - the requested flavor for the data
Returns:
An Object which represents the data to be transferred. Current implementation returns an array of elements if flavor is of type JPICEDT_DATA_FLAVOR, or a string representation of the elements (as given in the constructor) is flavor is of type DataFlavor.stringFlavor.
Since:
jPicEdt 1.3.2

getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()
Specified by:
getTransferDataFlavors in interface Transferable
Returns:
An array of DataFlavor objects indicating the flavors the data can be provided in.
Since:
jPicEdt 1.3.2

isDataFlavorSupported

public boolean isDataFlavorSupported(DataFlavor flavor)
Specified by:
isDataFlavorSupported in interface Transferable
Returns:
whether or not the specified data flavor is supported for this TransferableGraphic Currently only stringFlavor and javaJVMLocalObjectMimeType are supported.
Since:
jPicEdt 1.3.2

lostOwnership

public void lostOwnership(Clipboard c,
                          Transferable contents)
Notifies this object that it is no longer the owner of the content of the clipboard This implementation does nothing.

Specified by:
lostOwnership in interface ClipboardOwner
Since:
jPicEdt 1.3.2

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org