public class PageNumberPrint extends java.lang.Object implements Print
PagePrint
. To properly display page numbers, instances of this class
should be created using the PageNumber
argument which is passed to
the PageDecoration.createPrint(PageNumber)
method by PagePrint.
PageNumberPrints are never greedy with layout space, even with center- or right-alignment. (Greedy prints take up all the available space on the page.) Therefore, when center- or right-alignment is required, it is necessary to wrap the page number in a Print which will enforce the same alignment. Usually this is a center:default:grow or right:default:grow column in a GridPrint.
PagePrint
,
PageDecoration
,
PageNumber
,
PageNumberFormat
,
DefaultPageNumberFormat
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ALIGN
The default alignment for a PageNumberPrint.
|
static org.eclipse.swt.graphics.FontData |
DEFAULT_FONT_DATA
The default font data for a PageNumberPrint.
|
static TextStyle |
DEFAULT_TEXT_STYLE
The default text style.
|
(package private) PageNumberFormat |
format |
(package private) PageNumber |
pageNumber |
(package private) TextStyle |
textStyle |
Constructor and Description |
---|
PageNumberPrint(PageNumber pageNumber)
Constructs a PageNumberPrint for the given page number.
|
PageNumberPrint(PageNumber pageNumber,
org.eclipse.swt.graphics.FontData fontData)
Constructs a PageNumberPrint for the given page number and font.
|
PageNumberPrint(PageNumber pageNumber,
org.eclipse.swt.graphics.FontData fontData,
int align)
Constructs a PageNumberPrint for the given page number, font and
alignment.
|
PageNumberPrint(PageNumber pageNumber,
int align)
Constructs a PageNumberPrint for the given page number and alignment.
|
PageNumberPrint(PageNumber pageNumber,
TextStyle textStyle)
Constructs a PageNumberPrint for the given page number and text style.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
getAlign()
Returns the horizontal text alignment.
|
org.eclipse.swt.graphics.FontData |
getFontData()
Returns the text font.
|
PageNumber |
getPageNumber()
Returns the page number of this Print.
|
PageNumberFormat |
getPageNumberFormat()
Returns the page number format.
|
org.eclipse.swt.graphics.RGB |
getRGB()
Returns the text color.
|
TextStyle |
getTextStyle()
Returns the text style that will be used to render the page number
|
int |
hashCode() |
PrintIterator |
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 |
setAlign(int align)
Sets the horizontal text alignment to the argument.
|
void |
setFontData(org.eclipse.swt.graphics.FontData fontData)
Sets the text font to the argument.
|
void |
setPageNumber(PageNumber pageNumber)
Sets the page number to the argument.
|
void |
setPageNumberFormat(PageNumberFormat format)
Sets the format that will be used to convert the page number to a text
string.
|
void |
setRGB(org.eclipse.swt.graphics.RGB foreground)
Sets the text color.
|
void |
setTextStyle(TextStyle textStyle)
Sets the text style that will be used to render the page number
|
public static final org.eclipse.swt.graphics.FontData DEFAULT_FONT_DATA
public static final int DEFAULT_ALIGN
public static final TextStyle DEFAULT_TEXT_STYLE
PageNumber pageNumber
TextStyle textStyle
PageNumberFormat format
public PageNumberPrint(PageNumber pageNumber)
pageNumber
- the page number of the page this Print will appear on.public PageNumberPrint(PageNumber pageNumber, org.eclipse.swt.graphics.FontData fontData)
pageNumber
- the page number of the page this Print will appear on.fontData
- the font that this Print will appear in.public PageNumberPrint(PageNumber pageNumber, int align)
pageNumber
- the page number of the page this Print will appear on.align
- the horizontal alignment of the text.public PageNumberPrint(PageNumber pageNumber, org.eclipse.swt.graphics.FontData fontData, int align)
pageNumber
- the page number of the page this Print will appear on.fontData
- the font that this Print will appear in.align
- the horizontal alignment of the text.public PageNumberPrint(PageNumber pageNumber, TextStyle textStyle)
pageNumber
- the page number of the page this Print will appear on.textStyle
- the text style that this Print will appear in.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public void setPageNumber(PageNumber pageNumber)
pageNumber
- the new page number.public PageNumber getPageNumber()
public void setFontData(org.eclipse.swt.graphics.FontData fontData)
fontData
- the new text font.public org.eclipse.swt.graphics.FontData getFontData()
public void setAlign(int align)
align
- the horizontal alignment. Must be one of SWT.LEFT
,
SWT.CENTER
or SWT.RIGHT
.public int getAlign()
public TextStyle getTextStyle()
public void setTextStyle(TextStyle textStyle)
textStyle
- the text stylepublic void setPageNumberFormat(PageNumberFormat format)
format
- the new page number format.public PageNumberFormat getPageNumberFormat()
Page 1 of 5
public void setRGB(org.eclipse.swt.graphics.RGB foreground)
foreground
- the new text color.public org.eclipse.swt.graphics.RGB getRGB()
public PrintIterator iterator(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc)
Print