public class BasicTransferable
extends java.lang.Object
implements java.awt.datatransfer.Transferable
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).Constructor and Description |
---|
BasicTransferable() |
Modifier and Type | Method and Description |
---|---|
void |
addDataSource(uk.ac.starlink.util.DataSource datsrc,
java.lang.String mimeType)
Adds streamed data.
|
void |
addLocalObject(java.lang.Object obj,
java.lang.Class clazz,
java.lang.String type)
Adds an object which can be transferred within a single JVM.
|
void |
addSerializableObject(java.io.Serializable obj,
java.lang.Class clazz,
java.lang.String type)
Adds a
Serializable object which can be serialized
and thus passed outside of this JVM. |
void |
addString(java.lang.String text)
Adds a plain text string.
|
void |
addURL(java.net.URL url)
Adds a URL.
|
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor flavor) |
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors() |
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor) |
public void addLocalObject(java.lang.Object obj, java.lang.Class clazz, java.lang.String type)
obj
- the objectclazz
- the class as which it should be declared in the MIME typetype
- a human-readable description of the typepublic void addSerializableObject(java.io.Serializable obj, java.lang.Class clazz, java.lang.String type)
Serializable
object which can be serialized
and thus passed outside of this JVM.obj
- the serializable objectclazz
- the class as which it should be declared in the MIME typetype
- a human-readable description of the typepublic void addURL(java.net.URL url)
url
- the URLpublic void addString(java.lang.String text)
text
- the stringpublic void addDataSource(uk.ac.starlink.util.DataSource datsrc, java.lang.String mimeType)
datsrc
- the DataSource holding the datamimeType
- the MIME type with which the data should declare
itselfpublic java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors
in interface java.awt.datatransfer.Transferable
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
isDataFlavorSupported
in interface java.awt.datatransfer.Transferable
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.io.IOException, java.awt.datatransfer.UnsupportedFlavorException
getTransferData
in interface java.awt.datatransfer.Transferable
java.io.IOException
java.awt.datatransfer.UnsupportedFlavorException
Copyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.