public class ChartTransferable
extends java.lang.Object
implements java.awt.datatransfer.Transferable
| Modifier and Type | Field and Description |
|---|---|
private JFreeChart |
chart
The chart.
|
private int |
height
The height of the chart on the clipboard.
|
(package private) java.awt.datatransfer.DataFlavor |
imageFlavor
The data flavor.
|
private int |
maxDrawHeight
The largest height at which the chart will be drawn (if necessary, the
chart will then be scaled up to fit the requested height).
|
private int |
maxDrawWidth
The largest width at which the chart will be drawn (if necessary, the
chart will then be scaled up to fit the requested width).
|
private int |
minDrawHeight
The smallest height at which the chart will be drawn (if necessary, the
chart will then be scaled down to fit the requested height).
|
private int |
minDrawWidth
The smallest width at which the chart will be drawn (if necessary, the
chart will then be scaled down to fit the requested width).
|
private int |
width
The width of the chart on the clipboard.
|
| 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.
|
| Modifier and Type | Method and Description |
|---|---|
private java.awt.image.BufferedImage |
createBufferedImage(JFreeChart chart,
int w,
int h,
int minDrawW,
int minDrawH,
int maxDrawW,
int maxDrawH)
A utility method that creates an image of a chart, with scaling.
|
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. |
final java.awt.datatransfer.DataFlavor imageFlavor
private JFreeChart chart
private int width
private int height
private int minDrawWidth
private int minDrawHeight
private int maxDrawWidth
private int maxDrawHeight
public ChartTransferable(JFreeChart chart, int width, int height)
chart - the chart.width - the chart width.height - the chart height.public ChartTransferable(JFreeChart chart, int width, int height, boolean cloneData)
chart - the chart.width - the chart width.height - the chart height.cloneData - clone the dataset(s)?public ChartTransferable(JFreeChart chart, int width, int height, int minDrawW, int minDrawH, int maxDrawW, int maxDrawH, boolean cloneData)
ChartPanel class.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)?public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors in interface java.awt.datatransfer.Transferablepublic boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
true if the specified flavor is supported.isDataFlavorSupported in interface java.awt.datatransfer.Transferableflavor - the flavor.public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
throws java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException
getTransferData in interface java.awt.datatransfer.Transferableflavor - the requested flavor.java.awt.datatransfer.UnsupportedFlavorException - if the flavor
is not supported.java.io.IOException - if there is an IO problem.private java.awt.image.BufferedImage createBufferedImage(JFreeChart chart, int w, int h, int minDrawW, int minDrawH, int maxDrawW, int maxDrawH)
chart - the chart.w - the image width.h - the image height.minDrawW - the minimum width for chart drawing.minDrawH - the minimum height for chart drawing.maxDrawW - the maximum width for chart drawing.maxDrawH - the maximum height for chart drawing.