org.jfree.chart

## Class ChartTransferable

- java.lang.Object
- - org.jfree.chart.ChartTransferable

- All Implemented Interfaces:
    java.awt.datatransfer.Transferable

      public class ChartTransferable
      extends java.lang.Object
      implements java.awt.datatransfer.Transferable

  A class used to represent a chart on the clipboard.
  Since:
    1.0.13

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) java.awt.datatransfer.DataFlavor` | `imageFlavor` The data flavor.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChartTransferable(JFreeChart chart, int width, int height)` Creates a new chart selection.
    `ChartTransferable(JFreeChart chart, int width, int height, boolean cloneData)` Creates a new chart selection.
    `ChartTransferable(JFreeChart chart, int width, int height, int minDrawW, int minDrawH, int maxDrawW, int maxDrawH, boolean cloneData)` Creates a new chart selection.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `getTransferData(java.awt.datatransfer.DataFlavor flavor)` Returns the content for the requested flavor, if it is supported.
    `java.awt.datatransfer.DataFlavor[]` | `getTransferDataFlavors()` Returns the data flavors supported.
    `boolean` | `isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)` Returns `true` if the specified flavor is supported.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### imageFlavor

          final java.awt.datatransfer.DataFlavor imageFlavor

      The data flavor.

  - ### Constructor Detail

    - #### ChartTransferable

          public ChartTransferable(JFreeChart chart,
                                   int width,
                                   int height)

      Creates a new chart selection.
      Parameters:
        `chart` - the chart.
        `width` - the chart width.
        `height` - the chart height.

    - #### ChartTransferable

          public ChartTransferable(JFreeChart chart,
                                   int width,
                                   int height,
                                   boolean cloneData)

      Creates a new chart selection.
      Parameters:
        `chart` - the chart.
        `width` - the chart width.
        `height` - the chart height.
        `cloneData` - clone the dataset(s)?

    - #### ChartTransferable

          public ChartTransferable(JFreeChart chart,
                                   int width,
                                   int height,
                                   int minDrawW,
                                   int minDrawH,
                                   int maxDrawW,
                                   int maxDrawH,
                                   boolean cloneData)

      Creates a new chart selection. The minimum and maximum drawing dimensions are used to match the scaling behaviour in the `ChartPanel` class.
      Parameters:
        `chart` - the chart.
        `width` - the chart width.
        `height` - the chart height.
        `minDrawW` - the minimum drawing width.
        `minDrawH` - the minimum drawing height.
        `maxDrawW` - the maximum drawing width.
        `maxDrawH` - the maximum drawing height.
        `cloneData` - clone the dataset(s)?
      Since:
        1.0.14

  - ### Method Detail

    - #### getTransferDataFlavors

          public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()

      Returns the data flavors supported.
      Specified by:
        `getTransferDataFlavors` in interface `java.awt.datatransfer.Transferable`
      Returns:
        The data flavors supported.

    - #### isDataFlavorSupported

          public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)

      Returns `true` if the specified flavor is supported.
      Specified by:
        `isDataFlavorSupported` in interface `java.awt.datatransfer.Transferable`
      Parameters:
        `flavor` - the flavor.
      Returns:
        A boolean.

    - #### getTransferData

          public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                           throws java.awt.datatransfer.UnsupportedFlavorException,
                                                  java.io.IOException

      Returns the content for the requested flavor, if it is supported.
      Specified by:
        `getTransferData` in interface `java.awt.datatransfer.Transferable`
      Parameters:
        `flavor` - the requested flavor.
      Returns:
        The content.
      Throws:
        `java.awt.datatransfer.UnsupportedFlavorException` - if the flavor is not supported.
        `java.io.IOException` - if there is an IO problem.