@PublicAPI 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 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
.
Modifier and Type | Field and Description |
---|---|
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
|
static java.lang.String |
CLIPBOARD_ORIGIN_IS_FILE
Temporary property name to mark the molecule if it comes from a file via the clipboard
|
Modifier and Type | Method and Description |
---|---|
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.
|
static final int CLIPBOARD_OPERATION_UNDEFINED
static final int CLIPBOARD_OPERATION_PUT
static final int CLIPBOARD_OPERATION_GET
static final java.lang.String CLIPBOARD_ORIGIN_IS_FILE
void setMolecule(Molecule mol)
mol
- the Molecule object that will be exported to the clipboard.void setProperties(java.util.Properties props)
UserSettings
, and in the result of
MDocument.getGUIPropertyContainer()
.props
- the propertiesImageExportUtil
void registerNativeNames()
boolean isInputAvailable()
void setTransfer(java.awt.datatransfer.Transferable transfer)
transfer
- the Transferable
objectisInputAvailable()