Package net.sf.paperclips
Class PagePrint
java.lang.Object
net.sf.paperclips.PagePrint
- All Implemented Interfaces:
Print
A decorator Print which displays page headers and footers around a document
body, with page numbering capabilities.
PagePrint is horizontally and vertically greedy. Greedy prints take up all the available space on the page.
Note: Avoid wrapping PagePrint in prints with space-optimizing semantics (e.g. ColumnPrint equalizes columns on the last page), as this may cause the total page count to be incorrect on some pages. At this time there is no known fix. If wrapping a PagePrint is unavoidable, consider using a custom PageNumberFormat which does not display the total page count.
-
Constructor Summary
ConstructorsConstructorDescriptionPagePrint
(PageDecoration header, int headerGap, Print body) Constructs a PagePrint with the given header and body.PagePrint
(PageDecoration header, int headerGap, Print body, int footerGap, PageDecoration footer) Constructs a PagePrint with the given body, header and footer.PagePrint
(PageDecoration header, Print body) Constructs a PagePrint with the given header and body.PagePrint
(PageDecoration header, Print body, PageDecoration footer) Constructs a PagePrint with the given body, header and footer.Constructs a PagePrint with the given body.PagePrint
(Print body, int footerGap, PageDecoration footer) Constructs a PagePrint with the given body, header and footer.PagePrint
(Print body, PageDecoration footer) Constructs a PagePrint with the given body and footer.PagePrint
(Print body, PageDecoration header, PageDecoration footer) Deprecated.PagePrint(PageDecoration, Print, PageDecoration) instead. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getBody()
Returns the page body.Returns the page footer.int
Returns the gap between the body and footer, expressed in points.Returns the page header.int
Returns the gap between the header and body, expressed in points.int
hashCode()
iterator
(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc) Returns a PrintIterator for laying out the contents of this Print.void
Sets the page body to the argument.void
setFooter
(PageDecoration footer) Sets the page footer to the argument.void
setFooterGap
(int points) Sets the gap between the body and footer to the argument, expressed in points.void
setHeader
(PageDecoration header) Sets the page header to the argument.void
setHeaderGap
(int points) Sets the gap between the header and body to the argument, expressed in points.
-
Constructor Details
-
PagePrint
Constructs a PagePrint with the given header and body.- Parameters:
header
- a PageDecoration for creating the header. May be null.headerGap
- the gap between the header and body, in points.body
- the Print being decorated.
-
PagePrint
Constructs a PagePrint with the given header and body.- Parameters:
header
- a PageDecoration for creating the header. May be null.body
- the Print being decorated.
-
PagePrint
Constructs a PagePrint with the given body.- Parameters:
body
- the Print being decorated.
-
PagePrint
Constructs a PagePrint with the given body and footer.- Parameters:
body
- the Print being decorated.footer
- a PageDecoration for creating the footer. may be null.
-
PagePrint
Constructs a PagePrint with the given body, header and footer.- Parameters:
body
- the Print being decorated.footerGap
- the gap between the body and footer, in points.footer
- a PageDecoration for creating the footer. May be null.
-
PagePrint
Deprecated.PagePrint(PageDecoration, Print, PageDecoration) instead.Constructs a PagePrint with the given body, header and footer.- Parameters:
body
- the Print being decorated.header
- a PageDecoration for creating the header. May be null.footer
- a PageDecoration for creating the footer. may be null.
-
PagePrint
Constructs a PagePrint with the given body, header and footer.- Parameters:
header
- a PageDecoration for creating the header. May be null.body
- the Print being decorated.footer
- a PageDecoration for creating the footer. may be null.
-
PagePrint
public PagePrint(PageDecoration header, int headerGap, Print body, int footerGap, PageDecoration footer) Constructs a PagePrint with the given body, header and footer.- Parameters:
header
- a PageDecoration for creating the header. May be null.headerGap
- the gap between the header and body, in points.body
- the Print being decorated.footerGap
- the gap between the body and footer, in points.footer
- a PageDecoration for creating the footer. May be null.
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getHeader
Returns the page header.- Returns:
- the page header.
-
setHeader
Sets the page header to the argument.- Parameters:
header
- a PageDecoration which creates the header. May be null.
-
getHeaderGap
public int getHeaderGap()Returns the gap between the header and body, expressed in points.- Returns:
- the gap between the header and body, expressed in points.
-
setHeaderGap
public void setHeaderGap(int points) Sets the gap between the header and body to the argument, expressed in points.- Parameters:
points
- the new gap between the header and body, expressed in points. 72 points = 1".
-
getBody
Returns the page body.- Returns:
- the page body.
-
setBody
Sets the page body to the argument.- Parameters:
body
- the new page body.
-
iterator
public PrintIterator iterator(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc) Description copied from interface:Print
Returns a PrintIterator for laying out the contents of this Print. The iterator uses a snapshot of the print at the time this method is invoked, so subsequent changes to the Print will not affect the output of the iterator.
-