jpicedt.graphic.toolkit
Class TransferableGraphic
java.lang.Object
jpicedt.graphic.toolkit.TransferableGraphic
- All Implemented Interfaces:
- java.awt.datatransfer.ClipboardOwner, java.awt.datatransfer.Transferable
public class TransferableGraphic
- extends java.lang.Object
- implements java.awt.datatransfer.Transferable, java.awt.datatransfer.ClipboardOwner
Wrapper for Element's that can be transfered to/from a Clipboard. Contrary to a BranchElement
implementation :
- this object stores a reference to a CLONE of the Element(s) of interest, not to the Element(s)
itself (this allow the source Element to be further modified w/o affecting the content of this
TransferableGraphic, which is necessary for proper ClipBoard behaviour)
- As a result, Element's added to this TransferableGraphic have no parent, no view,...
Field Summary |
static java.awt.datatransfer.DataFlavor |
JPICEDT_DATA_FLAVOR
the DataFlavor for Element's |
Constructor Summary |
TransferableGraphic(Element[] elements,
java.lang.String formatted)
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 |
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor flavor)
|
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors()
|
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
|
void |
lostOwnership(java.awt.datatransfer.Clipboard c,
java.awt.datatransfer.Transferable contents)
Notifies this object that it is no longer the owner of the content of the clipboard
This implementation does nothing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JPICEDT_DATA_FLAVOR
public static final java.awt.datatransfer.DataFlavor JPICEDT_DATA_FLAVOR
- the DataFlavor for Element's
TransferableGraphic
public TransferableGraphic(Element[] elements,
java.lang.String formatted)
- 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 Transferableformatted
- the text representation of the given elements (can be null)- Since:
- jPicEdt 1.3.2
getTransferData
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
- Specified by:
getTransferData
in interface java.awt.datatransfer.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 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
- Specified by:
getTransferDataFlavors
in interface java.awt.datatransfer.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(java.awt.datatransfer.DataFlavor flavor)
- Specified by:
isDataFlavorSupported
in interface java.awt.datatransfer.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(java.awt.datatransfer.Clipboard c,
java.awt.datatransfer.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 java.awt.datatransfer.ClipboardOwner
- Since:
- jPicEdt 1.3.2
Submit a bug : syd@jpicedt.org