Interface Transferable<S>
-
- Type Parameters:
S
- The source of the transfer.
- All Known Implementing Classes:
AbstractImageComponent.DefaultTransferable
,AbstractLabel.DefaultTransferable
,AbstractObjectTransferable
,AbstractTransferable
,TextControl.DefaultTransferable
,TreeControl.TreeNodeTransferable
public interface Transferable<S>
An object that can be transferred, such as between components using drag and drop.- Author:
- Garret Wilson
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canTransfer(com.globalmentor.net.ContentType contentType)
Determines whether this transferable can transfer data with the given content type.com.globalmentor.net.ContentType[]
getContentTypes()
S
getSource()
java.lang.Object
transfer(com.globalmentor.net.ContentType contentType)
Transfers data using the given content type.<T> T
transfer(java.lang.Class<T> objectClass)
Transfers data of the given class.
-
-
-
Method Detail
-
getSource
S getSource()
- Returns:
- The source of the transferable data.
-
getContentTypes
com.globalmentor.net.ContentType[] getContentTypes()
- Returns:
- The content types available for this transfer.
-
canTransfer
boolean canTransfer(com.globalmentor.net.ContentType contentType)
Determines whether this transferable can transfer data with the given content type.- Parameters:
contentType
- The type of data requested, which may include wildcards.- Returns:
true
if this object can transfer data with the requested content type.
-
transfer
java.lang.Object transfer(com.globalmentor.net.ContentType contentType)
Transfers data using the given content type.- Parameters:
contentType
- The type of data expected.- Returns:
- The transferred data, which may be
null
. - Throws:
java.lang.IllegalArgumentException
- if the given content type is not supported.
-
transfer
<T> T transfer(java.lang.Class<T> objectClass)
Transfers data of the given class.- Type Parameters:
T
- The type of object to be transferred.- Parameters:
objectClass
- The class of object to return.- Returns:
- The transferred data object, which may be
null
. - Throws:
java.lang.IllegalArgumentException
- if the given class is not supported.
-
-