Interface MTransferable
- All Superinterfaces:
Transferable
- All Known Implementing Classes:
MarvinTransferable
The interface of Marvin transferable implementations.
This interface extends the functionality of the standard Java transferable interface.
Marvin utilizes the transferable objects to put Molecule objects to the clipboard in various
formats, and to retrieve Molecule data back from the clipboard. The
Transferable.getTransferData(java.awt.datatransfer.DataFlavor)
function is responsible to place the
data to the clipboard in a format specified by its DataFlavor
s and
as a Molecule object when importing from clipboard, if the implementation supports the input from
clipboard.
Every implementation should have a name which identifies the MTransferable in the registry. While
naming the MTransferable the developer should keep in mind that the name will be displayed in the
Copy As dialog window, if the TransferableDescriptor
object of the MTransferable
in the registry is configured so.
In the default java clipboard handling there are some native formats which will be registered
into the SystemFlavorMap
. If any of the DataFlavors supported by
the implementation requires a native format to be registered to the SystemFlavorMap, then the
implementation should define the registerNativeNames()
function which will be called
automatically by ClipboardHandler
.
- Since:
- Marvin 5.3 07/27/2009
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Flag that indicates an import operationstatic final int
Flag that indicates an export operationstatic final int
Undefined clipboard operation state identifierstatic final String
Temporary property name to mark the molecule if it comes from a file via the clipboard -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks that the implementation supports input from clipboard.void
Registers the Native names supported by the implementation.void
setMolecule
(Molecule mol) Sets the Molecule which will be represented by the transferable.void
setProperties
(Properties props) Sets display properties of the Molecule.void
setTransfer
(Transferable transfer) Sets the Transferable for importing Molecule from that.Methods inherited from interface java.awt.datatransfer.Transferable
getTransferData, getTransferDataFlavors, isDataFlavorSupported
-
Field Details
-
CLIPBOARD_OPERATION_UNDEFINED
static final int CLIPBOARD_OPERATION_UNDEFINEDUndefined clipboard operation state identifier- See Also:
-
CLIPBOARD_OPERATION_PUT
static final int CLIPBOARD_OPERATION_PUTFlag that indicates an export operation- See Also:
-
CLIPBOARD_OPERATION_GET
static final int CLIPBOARD_OPERATION_GETFlag that indicates an import operation- See Also:
-
CLIPBOARD_ORIGIN_IS_FILE
Temporary property name to mark the molecule if it comes from a file via the clipboard- See Also:
-
-
Method Details
-
setMolecule
Sets the Molecule which will be represented by the transferable.- Parameters:
mol
- the Molecule object that will be exported to the clipboard.
-
setProperties
Sets display properties of the Molecule. This parameter is useful when transferring Molecule images to clipboard, and can be one of, or the union of properties stored inUserSettings
, and in the result ofMDocument.getGUIPropertyContainer()
.
By default only those objects will use this that export image to the clipboard.- Parameters:
props
- the properties- See Also:
-
registerNativeNames
void registerNativeNames()Registers the Native names supported by the implementation. This has to be done for all native formats which are not supported by default in Java.
This function will be called from ClipboardHandler before performing the first clipboard operation. -
isInputAvailable
boolean isInputAvailable()Checks that the implementation supports input from clipboard.- Returns:
- true if the representation could read a Molecule from Clipboard false otherwise
-
setTransfer
Sets the Transferable for importing Molecule from that. This method should not be called if the implementation does not support input from clipboard.- Parameters:
transfer
- theTransferable
object- See Also:
-