chemaxon.marvin.modules.datatransfer
Interface MTransferable

All Superinterfaces:
java.awt.datatransfer.Transferable
All Known Implementing Classes:
MarvinTransferable

public interface MTransferable
extends java.awt.datatransfer.Transferable

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 DataFlavors 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
Author:
Istvan Fajth

Field Summary
static int CLIPBOARD_OPERATION_GET
          Flag that indicates an import operation
static int CLIPBOARD_OPERATION_PUT
          Flag that indicates an export operation
static int CLIPBOARD_OPERATION_UNDEFINED
          Undefined clipboard operation state identifier
 
Method Summary
 boolean isInputAvailable()
          Checks that the implementation supports input from clipboard.
 void registerNativeNames()
          Registers the Native names supported by the implementation.
 void setMolecule(Molecule mol)
          Sets the Molecule which will be represented by the transferable.
 void setProperties(java.util.Properties props)
          Sets display properties of the Molecule.
 void setTransfer(java.awt.datatransfer.Transferable transfer)
          Sets the Transferable for importing Molecule from that.
 
Methods inherited from interface java.awt.datatransfer.Transferable
getTransferData, getTransferDataFlavors, isDataFlavorSupported
 

Field Detail

CLIPBOARD_OPERATION_UNDEFINED

static final int CLIPBOARD_OPERATION_UNDEFINED
Undefined clipboard operation state identifier

See Also:
Constant Field Values

CLIPBOARD_OPERATION_PUT

static final int CLIPBOARD_OPERATION_PUT
Flag that indicates an export operation

See Also:
Constant Field Values

CLIPBOARD_OPERATION_GET

static final int CLIPBOARD_OPERATION_GET
Flag that indicates an import operation

See Also:
Constant Field Values
Method Detail

setMolecule

void setMolecule(Molecule mol)
Sets the Molecule which will be represented by the transferable.

Parameters:
mol - the Molecule object that will be exported to the clipboard.

setProperties

void setProperties(java.util.Properties props)
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 in UserSettings , and in the result of MDocument.getGUIPropertyContainer().
By default only those objects will use this that export image to the clipboard.

Parameters:
props - the properties
See Also:
ImageExportUtil

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

void setTransfer(java.awt.datatransfer.Transferable transfer)
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 - the Transferable object
See Also:
isInputAvailable()