|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.Graph2DPrinter
public class Graph2DPrinter
This class is responsible for printing the contents of
a Graph2DView
on one or more pages.
This class implements the Printable
interface and can thus be passed to a PrinterJob instance for printing.
Nested Class Summary | |
---|---|
static class |
Graph2DPrinter.AbstractFooterDrawable
Abstract footer drawable that defines the position of the footer on a page and manages the background color. |
static class |
Graph2DPrinter.AbstractTextBarDrawable
Abstract base drawable for titles and footers. |
static class |
Graph2DPrinter.AbstractTitleDrawable
Abstract title drawable that defines the position of the footer on a page and manages the background color. |
static class |
Graph2DPrinter.DefaultFooterDrawable
Default footer drawable implementation. |
static class |
Graph2DPrinter.DefaultTitleDrawable
Default title drawable implementation. |
static interface |
Graph2DPrinter.FooterDrawable
Interface for classes that want to add a footer to the printed page. |
static class |
Graph2DPrinter.PrintContext
Class that encapsulates contextual information when printing a page. |
static class |
Graph2DPrinter.RepeatingFooterDrawable
A footer drawable that paints a footer on every page. |
static class |
Graph2DPrinter.RepeatingTitleDrawable
A title drawable that paints a footer on every page. |
static interface |
Graph2DPrinter.TitleDrawable
Interface for classes that want to add a title to the printed page. |
Field Summary | |
---|---|
static byte |
CLIP_CUSTOM
Clip type specifier constant. |
static byte |
CLIP_GRAPH
Clip type specifier constant. |
static byte |
CLIP_VIEW
Clip type specifier constant. |
static byte |
SCALING_AUTO
Scaling type specifier constant. |
static byte |
SCALING_FIX
Scaling type specifier constant. |
static byte |
TITLE_AND_FOOTER_FOR_ENTIRE_POSTER
|
static byte |
TITLE_AND_FOOTER_FOR_EVERY_PAGE
|
Fields inherited from interface java.awt.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary | |
---|---|
Graph2DPrinter(Graph2DView view)
Instantiates a new Graph2DPrinter for the given Graph2DView. |
Method Summary | |
---|---|
protected GraphicsContext |
createGraphicsContext(Graph2DView view,
java.awt.Graphics2D g2d)
Creates the GraphicsContext that will be used for the
graphics object during printing. |
byte |
getClipType()
Returns the clipping type to be applied for printing. |
java.awt.geom.Rectangle2D |
getCustomClip()
Returns the custom area clip measured in world coordinates. |
java.awt.Dimension |
getFixedScalingPosterDimension(java.awt.print.PageFormat pf)
Returns the best-fit poster dimension measured in number of page columns and page rows. |
Graph2DPrinter.FooterDrawable |
getFooterDrawable()
Returns the footer drawable of this class. |
int |
getPosterColumns()
Returns the number of page columns to be used for printing. |
int |
getPosterRows()
Returns the number of page rows to be used for printing. |
boolean |
getPrintPosterCoords()
Whether or not to number the pages by poster coordinates. |
java.awt.RenderingHints |
getRenderingHints()
Returns the default rendering hints to be used when printing the graph. |
double |
getScalingFactor()
Returns the scale factor which is used when scale type is set to SCALING_FIX . |
byte |
getScalingType()
Sets the scaling type to be applied for printing. |
byte |
getTextBarType()
Returns the type of title and footer. |
Graph2DPrinter.TitleDrawable |
getTitleDrawable()
Returns the title drawable of this class. |
protected void |
initializePosterCoordsFont(java.awt.Graphics2D gfx,
Graph2DPrinter.PrintContext context)
Initialize the font for the page's coordinates (column, row) in the poster that are drawn in the upper left corner of the page. |
boolean |
isCenterContentsOnPageEnabled()
Whether or not to center the contents on the page(s). |
int |
print(java.awt.Graphics g1d,
java.awt.print.PageFormat pf,
int pi)
Printable implementation. |
protected void |
printGraph(java.awt.Graphics2D gfx,
Graph2DView view,
java.awt.Rectangle area)
Renders the content of the given view for printing. |
protected void |
printPosterCoords(java.awt.Graphics2D gfx,
Graph2DPrinter.PrintContext context)
Draws the page's coordinates (column, row) in the poster in the upper left corner of the page. |
void |
setCenterContentsOnPageEnabled(boolean centerOnPage)
Whether or not to center the contents on the page(s). |
void |
setClipType(byte clipType)
Sets the clipping type to be applied for printing. |
void |
setCustomClip(java.awt.geom.Rectangle2D clip)
Sets the custom area clip measured in world coordinates. |
void |
setFooterDrawable(Graph2DPrinter.FooterDrawable fd)
Sets the footer drawable of this class. |
void |
setPosterColumns(int columns)
Sets the number of page columns to be used for printing. |
void |
setPosterRows(int rows)
Sets the number of page rows to be used for printing. |
void |
setPrintPosterCoords(boolean ppc)
Whether or not to number the pages by poster coordinates. |
void |
setRenderingHints(java.awt.RenderingHints renderingHints)
Sets the default rendering hints to be used when printing the graph. |
void |
setScalingFactor(double scalingFactor)
Sets the scale factor which is used when the scaling type is set to SCALING_FIX . |
void |
setScalingType(byte scalingType)
Sets the scaling type to be applied for printing. |
void |
setTextBarType(byte type)
Sets the type of title and footer. |
void |
setTitleDrawable(Graph2DPrinter.TitleDrawable td)
Sets the title drawable of this class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte TITLE_AND_FOOTER_FOR_ENTIRE_POSTER
public static final byte TITLE_AND_FOOTER_FOR_EVERY_PAGE
public static final byte SCALING_AUTO
public static final byte SCALING_FIX
setScalingFactor(double)
,
Constant Field Valuespublic static final byte CLIP_VIEW
setClipType(byte)
,
Constant Field Valuespublic static final byte CLIP_GRAPH
setClipType(byte)
,
Constant Field Valuespublic static final byte CLIP_CUSTOM
setCustomClip(Rectangle2D)
setClipType(byte)
,
Constant Field ValuesConstructor Detail |
---|
public Graph2DPrinter(Graph2DView view)
Method Detail |
---|
public void setPrintPosterCoords(boolean ppc)
public boolean getPrintPosterCoords()
setPrintPosterCoords(boolean)
public void setCenterContentsOnPageEnabled(boolean centerOnPage)
isCenterContentsOnPageEnabled()
public boolean isCenterContentsOnPageEnabled()
setCenterContentsOnPageEnabled(boolean)
public void setPosterRows(int rows)
public void setPosterColumns(int columns)
public int getPosterRows()
setPosterRows(int)
public int getPosterColumns()
setPosterColumns(int)
public void setClipType(byte clipType)
CLIP_GRAPH
is set.
clipType
- One of CLIP_VIEW
, CLIP_GRAPH
.public byte getClipType()
setClipType(byte)
public void setScalingFactor(double scalingFactor)
SCALING_FIX
.
scalingFactor
- scale factor, must be positive.public double getScalingFactor()
SCALING_FIX
.
setScalingFactor(double)
public void setScalingType(byte scalingType)
scalingType
- One of SCALING_AUTO
, SCALING_FIX
.public byte getScalingType()
SCALING_AUTO
, SCALING_FIX
.setScalingType(byte)
public void setCustomClip(java.awt.geom.Rectangle2D clip)
CLIP_CUSTOM
is specified.
public java.awt.geom.Rectangle2D getCustomClip()
CLIP_CUSTOM
is specified.
public byte getTextBarType()
TITLE_AND_FOOTER_FOR_ENTIRE_POSTER
or TITLE_AND_FOOTER_FOR_EVERY_PAGE
.public void setTextBarType(byte type)
type
- either TITLE_AND_FOOTER_FOR_ENTIRE_POSTER
or TITLE_AND_FOOTER_FOR_EVERY_PAGE
.public int print(java.awt.Graphics g1d, java.awt.print.PageFormat pf, int pi) throws java.awt.print.PrinterException
getPosterColumns()*getPosterRows()
number
of pages. The clipped part of the document will be printed
centered on these pages with maximum uniform scaling
applied.
This method can also be used to produce (print) preview images. In such cases
it is important that there is a clip defined on the given graphics context.
print
in interface java.awt.print.Printable
java.awt.print.PrinterException
protected void printGraph(java.awt.Graphics2D gfx, Graph2DView view, java.awt.Rectangle area)
Called from print(Graphics, PageFormat, int)
.
gfx
- the configured graphics context associated with the print
operation.view
- the view whose content has to be rendered.area
- the area in view coordinates that should be rendered.protected void printPosterCoords(java.awt.Graphics2D gfx, Graph2DPrinter.PrintContext context)
gfx
- the current graphics contextcontext
- information about the page to be printedprotected void initializePosterCoordsFont(java.awt.Graphics2D gfx, Graph2DPrinter.PrintContext context)
gfx
- the current graphics contextcontext
- information about the page to be printedpublic java.awt.Dimension getFixedScalingPosterDimension(java.awt.print.PageFormat pf)
protected GraphicsContext createGraphicsContext(Graph2DView view, java.awt.Graphics2D g2d)
GraphicsContext
that will be used for the
graphics object during printing.
This implementation sets the GraphicsContext.isPrinting()
property to true
.
view
- the view that will be used for the painting.g2d
- the graphics object to use for the painting
null
.public void setTitleDrawable(Graph2DPrinter.TitleDrawable td)
public Graph2DPrinter.TitleDrawable getTitleDrawable()
public void setFooterDrawable(Graph2DPrinter.FooterDrawable fd)
public Graph2DPrinter.FooterDrawable getFooterDrawable()
public void setRenderingHints(java.awt.RenderingHints renderingHints)
RenderingHints.KEY_FRACTIONALMETRICS
= RenderingHints.VALUE_FRACTIONALMETRICS_ON
.
getRenderingHints()
public java.awt.RenderingHints getRenderingHints()
RenderingHints.KEY_FRACTIONALMETRICS
= RenderingHints.VALUE_FRACTIONALMETRICS_ON
.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |