Class nrio.reports.FormViewPagePrinter
java.lang.Object | +----nrio.reports.FormViewPagePrinter
public class FormViewPagePrinter extends Object
FormViewPagePrinter is an object that serves one sole purpose: to draw a page of a form view report; it doesn´t set margins, page layout or anything else for what matters. If you are looking for an object that can do everything (that regards form view reports) in a single place, go to the "Page Preview" section of this document.
You may already know that forms can have several tabs (pages), and therefore you may be wondering how this object composes a (screen/paper) page. The answer is quite simple: FormViewPagePrinter decides how many form pages can fit into a screen or paper page (or just uses the numbers you give it), and then starts drawing the form pages one after the other.
Example: let's say that we have a (screen/paper) page that can contain 6 forms (eg, 2 hor. by 3 ver.), and we decide to use a form which has 5 pages. We want to print screen/paper page 2, therefore we get a (screen/paper) page which contains form page 2 of the second record, plus all of the five form pages of the third record.
In order to print a page, you should set all of this object properties (calling all the 'setXXXX' methods), then call drawPage(int, Graphics) passing as parameters the page to be printed and the Graphics object (that has to be already initialized) on which to print.
FormViewPagePrinter() FormViewPagePrinter constructor.
drawPage(int, Graphics) Draws one page of the report into a Graphics object. getBackground() Gets the form background color. getBottomRightMargin() Gets the bottom right margin for the printable area of the page, in pixels. getForeground() Gets the form foreground color. getFormInit() Gets the form init string. getFormSize() Gets the form size. getHorCopies() Gets the number of forms to be printed in a page (in the horizontal direction). getNumberOfPages() Gets the total number of pages of which this report is composed. getPageSize() Gets the page size. getTopLeftMargin() Gets the top left margin for the printable area of the page, in pixels. getVerCopies() Gets the number of forms to be printed in a page (in the vertical direction). setBackground(Color) Sets the form background color. setBottomRightMargin(Point) Sets the bottom right margin for the printable area of the page, in pixels. setDbStruct(String[][]) Sets the database fields structure. setForeground(Color) Sets the form foreground color. setFormInit(String) Sets the form init string. setFormSize(Dimension) Sets the form size. setHorCopies(int) Sets the number of forms to be printed in a page (in the horizontal direction). setPageSize(Dimension) Sets the page size. setRecords(String[][]) Sets the currently set records. setTopLeftMargin(Point) Sets the top left margin for the printable area of the page, in pixels. setVerCopies(int) Sets the number of forms to be printed in a page (in the vertical direction).
FormViewPagePrinter
public FormViewPagePrinter()
FormViewPagePrinter constructor.
drawPage
public int drawPage(int page, Graphics g)
Draws one page of the report into a Graphics object.
getBackground
public Color getBackground()
Gets the form background color.
getBottomRightMargin
public Point getBottomRightMargin()
Gets the bottom right margin for the printable area of the page, in pixels. This measure is considered to be relative to the bottom right margin of the document (eg. [10, 15] means 10 pixels from the right of the document and 15 from the bottom).
getForeground
public Color getForeground()
Gets the form foreground color.
getFormInit
public String getFormInit()
Gets the form init string. The form init string is not human readable, it's just what the VFD produces and saves into .mfr files.
getFormSize
public Dimension getFormSize()
Gets the form size (in pixels).
getHorCopies
public int getHorCopies()
Gets the number of forms to be printed in a page (in the horizontal direction). If you get 0 (zero) as the return value for this method, it means that an optimal number of forms (as many as they will fit into a page) will be drawn.
getNumberOfPages
public int getNumberOfPages()
Gets the total number of pages of which this report is composed.
getPageSize
public Dimension getPageSize()
Gets the page size (in pixels). This includes header and footer (basically the whole page size is returned).
getTopLeftMargin
public Point getTopLeftMargin()
Gets the top left margin for the printable area of the page, in pixels. This measure is considered to be relative to the bottom right margin of the document (eg. [10, 15] means 10 pixels from the left of the document and 15 from the top).
getVerCopies
public int getVerCopies()
Gets the number of forms to be printed in a page (in the vertical direction). If you get 0 (zero) as the return value for this method, it means that an optimal number of forms (as many as they will fit into a page) will be drawn.
setBackground
public void setBackground(Color background)
Sets the form background color.
setBottomRightMargin
public void setBottomRightMargin(Point bottomRightMargin)
Sets the bottom right margin for the printable area of the page, in pixels. This measure is considered to be relative to the bottom right margin of the document (eg. [10, 15] means 10 pixels from the right of the document and 15 from the bottom).
setDbStruct
public void setDbStruct(String dbs[][])
Sets the database fields structure, exactly as it would be returned by RXDbase or MaxBase dbinfo method (hint hint).
setForeground
public void setForeground(Color foreground)
Sets the form foreground color.
setFormInit
public void setFormInit(String formInit)
Sets the form init string. The form init string is not human readable, it's just what the VFD produces and saves into .mfr files.
setFormSize
public void setFormSize(Dimension formSize)
Sets the form size (in pixels). Warning: this is not the page size.
setHorCopies
public void setHorCopies(int horCopies)
Sets the number of forms to be printed in a page (in the horizontal direction). If you set 0 (zero) as the parameter for this method, it means that an optimal number of forms (as many as they will fit into a page) will be drawn.
setPageSize
public void setPageSize(Dimension pageSize)
Sets the page size (in pixels). This includes header and footer (basically the whole page size).
setRecords
public void setRecords(String rcs[][])
Sets the currently set records, exactly as they were returned by RXDbase or MaxBase loadrecwithfilter method (it's always a wise thing to do to pass the array loadrecwithfilter returns, to this method).
setTopLeftMargin
public void setTopLeftMargin(Point topLeftMargin)
Sets the top left margin for the printable area of the page, in pixels. This measure is considered to be relative to the bottom right margin of the document (eg. [10, 15] means 10 pixels from the left of the document and 15 from the top).
setVerCopies
public void setVerCopies(int verCopies)
Sets the number of forms to be printed in a page (in the vertical direction). If you set 0 (zero) as the parameter for this method, it means that an optimal number of forms (as many as they will fit into a page) will be drawn.
|