Holger's Java API

## com.antelmann.util
Class DefaultTransferable

    java.lang.Object
      com.antelmann.util.DefaultTransferable

All Implemented Interfaces:
  ClipboardOwner, Transferable

Direct Known Subclasses:
  DBEntrySelection

    public class DefaultTransferable

extends Object
implements Transferable, ClipboardOwner

provides a simple standard way to generate a transferable object quickly. Besides the given DataFlavor in the constructor, this implementation by default also supports `DataFlavor.stringFlavor` as a second choice. If the given object implements `DetailedString`, it is that detailed String that is provided when accessing the transfer data based on the String flavor.

Since:
  08.01.2009, 16:30:48
Author:
  Holger Antelmann
See Also:
  `DataFlavor.stringFlavor`, `DetailedString`

Field Summary
`static DataFlavor` `HTML_FLAVOR`

Constructor Summary
`DefaultTransferable(DataFlavor flavor, Object object)`
`DefaultTransferable(Object object)` uses a generated DataFlavor based on the class of the given object

Method Summary
`protected void` `addSupportedFlavor(DataFlavor flavor)`
`DataFlavor` `getFlavor()`
`Object` `getObject()`
`Object` `getTransferData(DataFlavor flavor)`
`DataFlavor[]` `getTransferDataFlavors()`
`boolean` `isDataFlavorSupported(DataFlavor flavor)` implemented based on `getTransferDataFlavors()`
`void` `lostOwnership(Clipboard clipboard, Transferable contents)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### HTML_FLAVOR

    public static final DataFlavor HTML_FLAVOR

Constructor Detail

### DefaultTransferable

    public DefaultTransferable(Object object)

  uses a generated DataFlavor based on the class of the given object

### DefaultTransferable

    public DefaultTransferable(DataFlavor flavor,
                               Object object)

Method Detail

### addSupportedFlavor

    protected void addSupportedFlavor(DataFlavor flavor)

### getFlavor

    public DataFlavor getFlavor()

### getObject

    public Object getObject()

### getTransferData

    public Object getTransferData(DataFlavor flavor)
                           throws UnsupportedFlavorException,
                                  IOException

  Specified by:
    `getTransferData` in interface `Transferable`
  Throws:
    `UnsupportedFlavorException`
    `IOException`

### getTransferDataFlavors

    public DataFlavor[] getTransferDataFlavors()

  Specified by:
    `getTransferDataFlavors` in interface `Transferable`

### isDataFlavorSupported

    public boolean isDataFlavorSupported(DataFlavor flavor)

  implemented based on `getTransferDataFlavors()`

  Specified by:
    `isDataFlavorSupported` in interface `Transferable`

### lostOwnership

    public void lostOwnership(Clipboard clipboard,
                              Transferable contents)

  Specified by:
    `lostOwnership` in interface `ClipboardOwner`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads