|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlt.monarch.print.AbstractPrintable
lt.monarch.chart.print.ChartPrintable
public class ChartPrintable extends AbstractPrintable
Printable implementation for printing views of charts. Size of view before
printing, scaling and alignment of printout can be customized using provided methods. If assigned
view is instance of MultiSeriesChartBase or instance of CompositeView
having an instance of MultiSeriesChartBase as subview, the visible ranges of
scrollable mappers of x and y axes of chart can be adjusted or paged. Note that only one instance
of ChartPrintable can be created at the same time for the same view.
After printing is finished instance of ChartPrintable must be disposed by calling
the dispose() method (you shouldn't care about this only if you use
ChartPrintable with
SimplePrintPreviewDialog - it does this
automatically).
| Modifier and Type | Field and Description |
|---|---|
static int |
VIEW_SIZE_FILL_PAGES
Indicates that view should be resized to cover entire printable area of [rows x cols] pages layouted in a grid. |
static int |
VIEW_SIZE_ORIGINAL
Indicates that view should be printed without changing its current size. |
static int |
VIEW_SIZE_SPECIFIED
Indicates that view should be resized to user-specified dimensions when printing. |
static int |
VISIBLE_RANGE_FULL
Indicates that full data range of scrollable (x or y) mapper should be made visible when printing the chart. |
static int |
VISIBLE_RANGE_ORIGINAL
Indicates that chart should be printed without changing the current visible range of scrollable (x or y) mapper. |
static int |
VISIBLE_RANGE_PAGED
If this mode is used, data range of scrollable (x or y) mapper is divided into subranges and one chart view is printed for each such subrange. |
static int |
VISIBLE_RANGE_SPECIFIED
Indicates that user-specified range should be used as visible range of scrollable mapper (x or y) when printing the chart. |
| Fields inherited from class lt.monarch.print.AbstractPrintable |
|---|
headerFooterRenderer, horizontalAlignment, lastValidPageIndex, scaligFactorSpecified, scalingFitToPagesGridCols, scalingFitToPagesGridRows, scalingMode, verticalAlignment |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Fields inherited from interface lt.monarch.print.PrintableConstants |
|---|
ALIGNMENT_BOTTOM, ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ALIGNMENT_TOP, SCALING_FACTOR_SPECIFIED, SCALING_FIT_TO_PAGES |
| Constructor and Description |
|---|
ChartPrintable(View viewToPrint)
Creates new instance of ChartPrintable for printing given view. |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Clears instance of ChartPrintable. |
int |
print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
Implements the print method of Printable interface. |
void |
setViewSizeFillPagesGrid(int rows,
int cols)
Defines number of rows and columns in the grid of pages, which is used, if the view sizing mode is set as ChartPrintable.VIEW_SIZE_FILL_PAGES (using the
setViewSizingMode(int) method). |
void |
setViewSizeSpecified(int width,
int height)
The view will be resized to the specified size before printing it, if the view sizing mode is set as ChartPrintable.VIEW_SIZE_SPECIFIED (using the
setViewSizingMode(int) method). |
void |
setViewSizingMode(int mode)
Defines whether size of view should be changed in any way when printing the view. |
void |
setXVisibleRangeChangingMode(int mode)
Defines whether visible range of scrollable x mapper should be changed in any way when printing the chart. |
void |
setXVisibleRangePaging(double start,
double end,
double step)
This method specifies which part of x data range should be paged and what step should be used for this purpose, in case if the changing mode of x visible range is set as ChartPrintable.VISIBLE_RANGE_PAGED (using the
setXVisibleRangeChangingMode(int) method). |
void |
setXVisibleRangeSpecified(double min,
double max)
Specified visible range will be assigned to scrollable x mapper when printing the chart, if the changing mode of x visible range is set as ChartPrintable.VISIBLE_RANGE_SPECIFIED (using the
setXVisibleRangeChangingMode(int) method). |
void |
setXVisibleRangeSpecified(java.lang.Object minObject,
java.lang.Object maxObject)
Specified visible range will be assigned to scrollable x mapper when printing the chart, if the changing mode of x visible range is set as ChartPrintable.VISIBLE_RANGE_SPECIFIED (using the
setXVisibleRangeChangingMode(int) method). |
void |
setYVisibleRangeChangingMode(int mode)
Defines whether visible range of scrollable y mapper should be changed in any way when printing the chart. |
void |
setYVisibleRangePaging(double start,
double end,
double step)
This method specifies which part of y data range should be paged and what step should be used for this purpose, in case if the changing mode of y visible range is set as ChartPrintable.VISIBLE_RANGE_PAGED (using the
setYVisibleRangeChangingMode(int) method). |
void |
setYVisibleRangeSpecified(double min,
double max)
Specified visible range will be assigned to scrollable y mapper when printing the chart, if the changing mode of y visible range is set as ChartPrintable.VISIBLE_RANGE_SPECIFIED (using the
setYVisibleRangeChangingMode(int) method). |
void |
setYVisibleRangeSpecified(java.lang.Object minObject,
java.lang.Object maxObject)
Specified visible range will be assigned to scrollable y mapper when printing the chart, if the changing mode of y visible range is set as ChartPrintable.VISIBLE_RANGE_SPECIFIED (using the
setYVisibleRangeChangingMode(int) method). |
void |
setYVisibleRangeSpecified(java.lang.Object minObject,
java.lang.Object maxObject,
AbstractAxisMapper yMapper)
Specified visible range will be assigned to scrollable y mapper when printing the chart, if the changing mode of y visible range is set as ChartPrintable.VISIBLE_RANGE_SPECIFIED (using the
setYVisibleRangeChangingMode(int) method). |
| Methods inherited from class lt.monarch.print.AbstractPrintable |
|---|
getHeaderFooterRenderer, setHeaderFooterRenderer, setHorizontalAlignment, setScalingFactorSpecified, setScalingFitToPagesGrid, setScalingMode, setVerticalAlignment |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int VISIBLE_RANGE_ORIGINAL
public static final int VISIBLE_RANGE_FULL
public static final int VISIBLE_RANGE_SPECIFIED
setXVisibleRangeSpecified(double,double)setXVisibleRangeSpecified(Object,Object)setYVisibleRangeSpecified(double,double)setYVisibleRangeSpecified(Object,Object)
public static final int VISIBLE_RANGE_PAGED
ChartPrintable instance). To change defaults
setXVisibleRangePaging(double,double,double)
and
setYVisibleRangePaging(double,double,double)
can be used for x and y axes respectively.
public static final int VIEW_SIZE_ORIGINAL
public static final int VIEW_SIZE_SPECIFIED
setViewSizeSpecified(int,int) method.
public static final int VIEW_SIZE_FILL_PAGES
setViewSizeFillPagesGrid(int,int) method. By
default 1 x 1 grid of pages (i.e. one page) is used.
| Constructor Detail |
|---|
public ChartPrintable(View viewToPrint)
ChartPrintable for printing given view. Note that only
one instance of ChartPrintable can be created at the same time for the same
view. After printing is finished instance of ChartPrintable must be disposed
by calling the dispose() method.
viewToPrint - view for printing.| Method Detail |
|---|
public void setXVisibleRangeChangingMode(int mode)
VISIBLE_RANGE_XXX constants.
mode - the constant indicating required changes to visible range when printing the
chart. Possible values are:
ChartPrintable.VISIBLE_RANGE_ORIGINAL (default),ChartPrintable.VISIBLE_RANGE_FULL,ChartPrintable.VISIBLE_RANGE_SPECIFIED,ChartPrintable.VISIBLE_RANGE_PAGED.
public void setXVisibleRangeSpecified(double min,
double max)
ChartPrintable.VISIBLE_RANGE_SPECIFIED (using the
setXVisibleRangeChangingMode(int) method).
min - normalized value (in range [0.0, 1.0]) of minimum of visible range.max - normalized value (in range [0.0, 1.0]) of maximum of visible range.
public void setXVisibleRangeSpecified(java.lang.Object minObject,
java.lang.Object maxObject)
ChartPrintable.VISIBLE_RANGE_SPECIFIED (using the
setXVisibleRangeChangingMode(int) method).
minObject - object that can be mapped using scrollable mapper of x axis of chart and
represents minimum value of desired visible range.maxObject - object that can be mapped using scrollable mapper of x axis of chart and
represents maximum value of desired visible range.
public void setXVisibleRangePaging(double start,
double end,
double step)
ChartPrintable.VISIBLE_RANGE_PAGED (using the
setXVisibleRangeChangingMode(int) method). By
default 0.0d is used as start and 1.0d is used as end, i.e. full range of x data is paged.
Default step is equal to extent of current visible range of x axis of chart (current =
displayed in GUI before initializing ChartPrintable instance).
start - normalized value indicating the start of data range for paging.end - normalized value indicating the start of data range for paging.step - normalized value indicating the step to be used for paging of given [start,end]
range into subranges.public void setYVisibleRangeChangingMode(int mode)
VISIBLE_RANGE_XXX constants.
mode - the constant indicating required changes to visible range when printing the
chart. Possible values are:
ChartPrintable.VISIBLE_RANGE_ORIGINAL (default),ChartPrintable.VISIBLE_RANGE_FULL,ChartPrintable.VISIBLE_RANGE_SPECIFIED,ChartPrintable.VISIBLE_RANGE_PAGED.
public void setYVisibleRangeSpecified(double min,
double max)
ChartPrintable.VISIBLE_RANGE_SPECIFIED (using the
setYVisibleRangeChangingMode(int) method).
min - normalized value (in range [0.0, 1.0]) of minimum of visible range.max - normalized value (in range [0.0, 1.0]) of maximum of visible range.
public void setYVisibleRangeSpecified(java.lang.Object minObject,
java.lang.Object maxObject)
ChartPrintable.VISIBLE_RANGE_SPECIFIED (using the
setYVisibleRangeChangingMode(int) method). This
method can be used if chart contains only one scrollable y axis.
minObject - object that can be mapped using scrollable mapper of y axis of chart and
represents minimum value of desired visible range.maxObject - object that can be mapped using scrollable mapper of y axis of chart and
represents maximum value of desired visible range.
public void setYVisibleRangeSpecified(java.lang.Object minObject,
java.lang.Object maxObject,
AbstractAxisMapper yMapper)
ChartPrintable.VISIBLE_RANGE_SPECIFIED (using the
setYVisibleRangeChangingMode(int) method). If
chart contains only one scrollable y axis, the
setYVisibleRangeSpecified(Object,Object)
method can be used instead of this method.
minObject - object that can be mapped using given yMapper and represents minimum value
of desired visible range.maxObject - object that can be mapped using given yMapper and represents maximum value
of desired visible range.yMapper - yMapper scrollable y mapper for mapping minimum and maximum objects.
public void setYVisibleRangePaging(double start,
double end,
double step)
ChartPrintable.VISIBLE_RANGE_PAGED (using the
setYVisibleRangeChangingMode(int) method). By
default 0.0d is used as start and 1.0d is used as end, i.e. full range of y data is paged.
Default step is equal to extent of current visible range of y axis of chart (current =
displayed in GUI before initializing ChartPrintable instance).
start - normalized value indicating the start of data range for paging.end - normalized value indicating the start of data range for paging.step - normalized value indicating the step to be used for paging of given [start,end]
range into subranges.public void setViewSizingMode(int mode)
VIEW_SIZE_XXX constants.
mode - the constant indicating required changes to size of view when printing the view.
Possible values are:
ChartPrintable.VIEW_SIZE_ORIGINAL (default),ChartPrintable.VIEW_SIZE_SPECIFIED,ChartPrintable.VIEW_SIZE_FILL_PAGE.
public void setViewSizeSpecified(int width,
int height)
ChartPrintable.VIEW_SIZE_SPECIFIED (using the
setViewSizingMode(int) method).
width - desired width of view when printing.height - desired height of view when printing.
public void setViewSizeFillPagesGrid(int rows,
int cols)
ChartPrintable.VIEW_SIZE_FILL_PAGES (using the
setViewSizingMode(int) method). In this case the printable
view is resized to cover entire printable area of [rows x cols] pages layouted in a grid. By
default [1 x 1] grid of pages (i.e. one page) is used.
rows - positive non-zero value meaning number of rows in grid of pages.cols - positive non-zero value meaning number of columns in grid of pages.
public int print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
throws java.awt.print.PrinterException
print method of Printable interface.
graphics - Graphics contextpageFormat - format of pagepageIndex - index of pagejava.awt.print.PrinterExceptionpublic void dispose()
ChartPrintable. This method must be invoked after printing
of view is finished and instance of ChartPrintable is not necessary anymore.
dispose in class AbstractPrintable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||