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

    Modifier and Type
    Method
    Description
    boolean
    canTransfer(com.globalmentor.net.MediaType contentType)
    Determines whether this transferable can transfer data with the given content type.
    com.globalmentor.net.MediaType[]
     
     
    transfer(com.globalmentor.net.MediaType contentType)
    Transfers data using the given content type.
    <T> T
    transfer(Class<T> objectClass)
    Transfers data of the given class.
  • Method Details

    • getSource

      S getSource()
      Returns:
      The source of the transferable data.
    • getContentTypes

      com.globalmentor.net.MediaType[] getContentTypes()
      Returns:
      The content types available for this transfer.
    • canTransfer

      boolean canTransfer(com.globalmentor.net.MediaType 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

      Object transfer(com.globalmentor.net.MediaType contentType)
      Transfers data using the given content type.
      Parameters:
      contentType - The type of data expected.
      Returns:
      The transferred data, which may be null.
      Throws:
      IllegalArgumentException - if the given content type is not supported.
    • transfer

      <T> T transfer(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:
      IllegalArgumentException - if the given class is not supported.