|
PageLayout is a Java Bean that subclasses
java.awt.Canvas, giving you the possibility to draw an
empty page (with many bells and whistles) where to draw
at a later time your reports. In the following diagram
you can see the role of PageLayout in the reports drawing
process:

What is the relationship between LineViewMockup and
PageLayout? I have tried to make each one independent
from the other, so you can benefit from greater
flexibility (you can easily replace one of the two steps
of the process of printing -- drawing the page layout and
drawing the actual data --with your own code). This comes
with a price, of course: you have to setup and call
methods for two distinct objects but, as you will see,
this is no rocket science. Everything has been thought to
be as intuitive as possible.
The icon for this JavaBean is the following:

It allows you to do the following things:
- Set margins for the report.
- Set information for header and footer: foreground
and background colors, alignment, fonts, text
(with macros that expand into current page
number, total number of pages, current date and
time).
- Set information for the blank page: foreground
and background colors, alignment, watermark
(centered, maximized, tiled).
- Draw all of the above in a Graphics object.
Use in IBM VisualAge for Java: you
can connect PageLayout features to other beans events and
properties, just like you would do with any other bean.
However, since this bean inherits from java.awt.Canvas,
you can use its Graphics space to draw a preview of the
page layout.
Use in Symantec Visual Café: you can
use PageLayout both as a normal class (using its methods)
or as a visual component (this bean inherits from
java.awt.Canvas). You should be warned, however, that
PageLayout doesn't do anything with its Graphics object,
and if you don't draw on it, it will remain blank.
Use of the PageLayout class with plain Jdk
import nrio.reports.PageLayout;
Is required in your Java source file.
Constructor:
- PageLayout()
Methods:
- drawPage(Graphics,
int)
- Draws a page into a Graphics object, using
current settings.
- drawPage(Graphics,
int, PageSettings)
- Draws a page into a Graphics object, using
specified settings.
- getGeneralSettings()
- Gets the current settings for this PageLayout
object.
- getNumOfPages()
- Gets the total number of pages for this report.
- getPageHeight()
- Gets the page height in pixels.
- getPageSize()
- Gets the page size (same as page height and
width, but returned as a Dimension object instead
of two integers).
- getPageWidth()
- Gets the page width in pixels.
- setGeneralSettings(PageSettings)
- Sets the current settings for this PageLayout
object.
- setNumOfPages(int)
- Sets the total number of pages for this report.
- setPageHeight(int)
- Sets the page height in pixels.
- setPageSize(Dimension)
- Sets the page size (same as page height and
width, but passed as a Dimension object instead
of two integers).
- setPageWidth(int)
- Sets the page width in pixels.
Constructor:
PageLayout
public PageLayout()
Methods:
drawPage
public void drawPage(Graphics g,
int pageNumber)
- Draws a page into a Graphics object, using
current settings.
- Parameters:
- g - Graphics
- pageNumber - int
drawPage
public void drawPage(Graphics g,
int pageNumber,
PageSettings genSettings)
- Draws a page into a Graphics object, using
specified settings.
- Parameters:
- g - Graphics
- pageNumber - int
- genSettings - nrio.reports.PageSettings
getGeneralSettings
public PageSettings getGeneralSettings()
- Gets the current settings for this PageLayout
object.
- Returns:
- The generalSettings property value.
- See Also:
- setGeneralSettings
getNumOfPages
public int getNumOfPages()
- Gets the total number of pages for this report.
- Returns:
- The numOfPages property value.
- See Also:
- setNumOfPages
getPageHeight
public int getPageHeight()
- Gets the page height in pixels.
- Returns:
- The pageHeight property value.
- See Also:
- setPageHeight
getPageSize
public Dimension getPageSize()
- Gets the page size (same as page height and
width, but returned as a Dimension object instead
of two integers).
- Returns:
- The pageSize property value.
- See Also:
- setPageSize
getPageWidth
public int getPageWidth()
- Gets the page width in pixels.
- Returns:
- The pageWidth property value.
- See Also:
- setPageWidth
setGeneralSettings
public void setGeneralSettings(PageSettings generalSettings)
- Sets the current settings for this PageLayout
object.
- Parameters:
- generalSettings - The new value for the
property.
- See Also:
- getGeneralSettings
setNumOfPages
public void setNumOfPages(int numOfPages)
- Sets the total number of pages for this report.
- Parameters:
- numOfPages - The new value for the
property.
- See Also:
- getNumOfPages
setPageHeight
public void setPageHeight(int pageHeight)
- Sets the page height in pixels.
- Parameters:
- pageHeight - The new value for the
property.
- See Also:
- getPageHeight
setPageSize
public void setPageSize(Dimension pageSize)
- Sets the page size (same as page height and
width, but passed as a Dimension object instead
of two integers).
- Parameters:
- pageSize - The new value for the
property.
- See Also:
- getPageSize
setPageWidth
public void setPageWidth(int pageWidth)
- Sets the page width in pixels.
- Parameters:
- pageWidth - The new value for the
property.
- See Also:
- getPageWidth
|