|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pentaho.reporting.engine.classic.core.util.PageFormatFactory
public final class PageFormatFactory
The PageFormatFactory is used to create PageFormats on a higher level. The Factory contains templates for all PageSizes defined by Adobe:
Postscript Specifications Usage for creating an printjob on A4 paper with 2.5 cm border:Paper paper = PageFormatFactory.createPaper (PageSize.A4); PageFormatFactory.setBordersMm (paper, 25, 25, 25, 25); PageFormat format = PageFormatFactory.createPageFormat (paper, PageFormat.PORTRAIT); Defining a pageformat can be an ugly task and full of dependencies. The call to PageFormatFactory.setBorders(...) will setup the paper's border and always assumes that the paper is laid out in Portrait. Changing the PageFormat's orientation does not change the PageFormat's paper object, but it changes the way, how the paper object is interpreted.
Method Summary | |
---|---|
double |
convertInchToPoints(double inches)
Converts the given inch value to a valid point-value. |
double |
convertMmToPoints(double mm)
Converts the given millimeter value to a valid point-value. |
PageFormat |
createPageFormat(Paper paper,
int orientation)
Creates a new pageformat using the given paper and the given orientation. |
Paper |
createPaper(double width,
double height)
Creates a paper by using the paper size in points. |
Paper |
createPaper(int[] papersize)
Creates a paper by using the paper size in points found in the int-array. |
Paper |
createPaper(PageSize papersize)
Creates a paper by using the paper size in points found in the int-array. |
Paper |
createPaper(String name)
Creates a paper by looking up the given Uppercase name in this classes defined constants. |
double |
getBottomBorder(Paper p)
Returns the bottom border of the given paper. |
static PageFormatFactory |
getInstance()
Returns a single instance of the factory. |
double |
getLeftBorder(Paper p)
Returns the left border of the given paper. |
String |
getPageFormatName(double width,
double height)
|
String[] |
getPageFormats()
|
Insets |
getPageMargins(PageFormat format)
|
double |
getRightBorder(Paper p)
Returns the right border of the given paper. |
double |
getTopBorder(Paper p)
Returns the top border of the given paper. |
static boolean |
isEqual(PageFormat pf1,
PageFormat pf2)
Tests, whether the given two page format objects are equal. |
static void |
logPageFormat(PageFormat pf)
Logs the page format. |
static void |
logPaper(Paper pf)
Logs the paper size. |
void |
setBorders(Paper paper,
double top,
double left,
double bottom,
double right)
Defines the imageable area of the given paper by adjusting the border around the imagable area. |
void |
setBordersInch(Paper paper,
double top,
double left,
double bottom,
double right)
Defines the imageable area of the given paper by adjusting the border around the imagable area. |
void |
setBordersMm(Paper paper,
double top,
double left,
double bottom,
double right)
Defines the imageable area of the given paper by adjusting the border around the imagable area. |
void |
setPageMargins(PageFormat pageFormat,
Insets pageMargins)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static PageFormatFactory getInstance()
public Paper createPaper(int[] papersize)
papersize
- the definition of the papersize in a 2-element int-array
public Paper createPaper(PageSize papersize)
papersize
- the definition of the papersize in a 2-element int-array
public Paper createPaper(double width, double height)
width
- the width of the paper in pointsheight
- the height of the paper in points
public void setBorders(Paper paper, double top, double left, double bottom, double right)
paper
- the paper that should be modifiedtop
- the bordersize of the top-borderleft
- the border in points in the leftbottom
- the border in points in the bottomright
- the border in points in the rightpublic void setBordersInch(Paper paper, double top, double left, double bottom, double right)
paper
- the paper that should be modifiedtop
- the bordersize of the top-borderleft
- the border in points in the leftbottom
- the border in points in the bottomright
- the border in points in the rightpublic void setBordersMm(Paper paper, double top, double left, double bottom, double right)
paper
- the paper that should be modifiedtop
- the bordersize of the top-borderleft
- the border in points in the leftbottom
- the border in points in the bottomright
- the border in points in the rightpublic double convertInchToPoints(double inches)
inches
- the size in inch
public double convertMmToPoints(double mm)
mm
- the size in inch
public PageFormat createPageFormat(Paper paper, int orientation)
paper
- the paper to use in the new pageformatorientation
- one of PageFormat.PORTRAIT, PageFormat.LANDSCAPE or PageFormat.REVERSE_LANDSCAPE
NullPointerException
- if the paper given was nullpublic Paper createPaper(String name)
name
- the name of the constant defining the papersize
public static void logPageFormat(PageFormat pf)
pf
- the page format.public static void logPaper(Paper pf)
pf
- the paper size.public static boolean isEqual(PageFormat pf1, PageFormat pf2)
pf1
- the first page format that should be compared.pf2
- the second page format that should be compared.
public double getLeftBorder(Paper p)
p
- the paper that defines the borders.
public double getRightBorder(Paper p)
p
- the paper that defines the borders.
public double getTopBorder(Paper p)
p
- the paper that defines the borders.
public double getBottomBorder(Paper p)
p
- the paper that defines the borders.
public Insets getPageMargins(PageFormat format)
public String getPageFormatName(double width, double height)
public String[] getPageFormats()
public void setPageMargins(PageFormat pageFormat, Insets pageMargins)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |