Package org.jfree.chart
Class ChartTransferable
java.lang.Object
org.jfree.chart.ChartTransferable
- All Implemented Interfaces:
Transferable
A class used to represent a chart on the clipboard.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate JFreeChartThe chart.private intThe height of the chart on the clipboard.(package private) final DataFlavorThe data flavor.private intThe largest height at which the chart will be drawn (if necessary, the chart will then be scaled up to fit the requested height).private intThe largest width at which the chart will be drawn (if necessary, the chart will then be scaled up to fit the requested width).private intThe smallest height at which the chart will be drawn (if necessary, the chart will then be scaled down to fit the requested height).private intThe smallest width at which the chart will be drawn (if necessary, the chart will then be scaled down to fit the requested width).private intThe width of the chart on the clipboard. -
Constructor Summary
ConstructorsConstructorDescriptionChartTransferable(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
Modifier and TypeMethodDescriptionprivate BufferedImagecreateBufferedImage(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.getTransferData(DataFlavor flavor) Returns the content for the requested flavor, if it is supported.Returns the data flavors supported.booleanisDataFlavorSupported(DataFlavor flavor) Returnstrueif the specified flavor is supported.
-
Field Details
-
imageFlavor
The data flavor. -
chart
The chart. -
width
private int widthThe width of the chart on the clipboard. -
height
private int heightThe height of the chart on the clipboard. -
minDrawWidth
private int minDrawWidthThe smallest width at which the chart will be drawn (if necessary, the chart will then be scaled down to fit the requested width). -
minDrawHeight
private int minDrawHeightThe smallest height at which the chart will be drawn (if necessary, the chart will then be scaled down to fit the requested height). -
maxDrawWidth
private int maxDrawWidthThe largest width at which the chart will be drawn (if necessary, the chart will then be scaled up to fit the requested width). -
maxDrawHeight
private int maxDrawHeightThe largest height at which the chart will be drawn (if necessary, the chart will then be scaled up to fit the requested height).
-
-
Constructor Details
-
ChartTransferable
Creates a new chart selection.- Parameters:
chart- the chart.width- the chart width.height- the chart height.
-
ChartTransferable
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 theChartPanelclass.- 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)?
-
-
Method Details
-
getTransferDataFlavors
Returns the data flavors supported.- Specified by:
getTransferDataFlavorsin interfaceTransferable- Returns:
- The data flavors supported.
-
isDataFlavorSupported
Returnstrueif the specified flavor is supported.- Specified by:
isDataFlavorSupportedin interfaceTransferable- Parameters:
flavor- the flavor.- Returns:
- A boolean.
-
getTransferData
Returns the content for the requested flavor, if it is supported.- Specified by:
getTransferDatain interfaceTransferable- Parameters:
flavor- the requested flavor.- Returns:
- The content.
- Throws:
UnsupportedFlavorException- if the flavor is not supported.IOException- if there is an IO problem.
-
createBufferedImage
private 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.- Parameters:
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.- Returns:
- A chart image.
-