Package uk.ac.starlink.datanode.tree
Class BasicTransferable
java.lang.Object
uk.ac.starlink.datanode.tree.BasicTransferable
- All Implemented Interfaces:
Transferable
- Direct Known Subclasses:
DataNodeTransferable
A basic implementation of the Transferable interface used
to implement drag'n'drop operations. It initially supports no
DataFlavor
s, but they can be added
by using the various add* methods provided. They should
be called in order of priority (most specific first).- Author:
- Mark Taylor (Starlink)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataSource
(uk.ac.starlink.util.DataSource datsrc, String mimeType) Adds streamed data.void
addLocalObject
(Object obj, Class clazz, String type) Adds an object which can be transferred within a single JVM.void
addSerializableObject
(Serializable obj, Class clazz, String type) Adds aSerializable
object which can be serialized and thus passed outside of this JVM.void
Adds a plain text string.void
Adds a URL.getTransferData
(DataFlavor flavor) boolean
isDataFlavorSupported
(DataFlavor flavor)
-
Constructor Details
-
BasicTransferable
public BasicTransferable()
-
-
Method Details
-
addLocalObject
Adds an object which can be transferred within a single JVM.- Parameters:
obj
- the objectclazz
- the class as which it should be declared in the MIME typetype
- a human-readable description of the type
-
addSerializableObject
Adds aSerializable
object which can be serialized and thus passed outside of this JVM.- Parameters:
obj
- the serializable objectclazz
- the class as which it should be declared in the MIME typetype
- a human-readable description of the type
-
addURL
Adds a URL. This is currently installed as both a local and a serializable object.- Parameters:
url
- the URL
-
addString
Adds a plain text string.- Parameters:
text
- the string
-
addDataSource
Adds streamed data.- Parameters:
datsrc
- the DataSource holding the datamimeType
- the MIME type with which the data should declare itself
-
getTransferDataFlavors
- Specified by:
getTransferDataFlavors
in interfaceTransferable
-
isDataFlavorSupported
- Specified by:
isDataFlavorSupported
in interfaceTransferable
-
getTransferData
- Specified by:
getTransferData
in interfaceTransferable
- Throws:
IOException
UnsupportedFlavorException
-