JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.page
Class JCDocument

java.lang.Object
  |
  +--com.klg.jclass.page.JCDocument

public class JCDocument
extends Object

JCDocument contains a list of pages which are governed by a flow.


Field Summary
static List BLANK_11X17
          Blank (no headers or footers) 11 x 17 inch page.
static List BLANK_11X8p5
          Blank (no headers or footers) 11 x 8.5 inch (landscape) page.
static List BLANK_8p5X11
          Blank (no headers or footers) 8.5 x 11 inch page.
static List BLANK_8p5X14
          Blank (no headers or footers) 8.5 x 14 inch page.
static List BLANK_A3
          Blank (no headers or footers) A3 page.
static List BLANK_A4
          Blank (no headers or footers) A4 page.
static List BLANK_A5
          Blank (no headers or footers) A5 page.
protected  com.klg.jclass.page.JCFlow flow
          The flow which governs the addition of content to the document.
static int FLUSH_POLICY_ALWAYS_SAVE
          Always saves (does not flush) all pages (default).
static int FLUSH_POLICY_ON_OUTPUT
          Flushes pages as they are completed and printed.
protected  int flushPolicy
          Indicates whether pages are to be discarded once printed.
protected  int lastPage
          For immediate-mode printing, track the last page we successfully printed.
protected  String name
          The name of the document.
static int OUTPUT_POLICY_IMMEDIATE
          Outputs each page as it is completed (if all predecessors are complete).
static int OUTPUT_POLICY_ON_REQUEST
          Holds all completed pages in memory until the document is printed (default).
protected  int outputPolicy
          Indicates whether pages are to be held for printing.
protected  int pageCount
          The number of printable pages created.
protected  List pageList
          The list of printable pages created in the document.
protected  com.klg.jclass.page.JCPrinter printer
          The printer for which this document is being prepared.
protected  int startPage
          The page number at which the flow should start counting.
protected  List tableList
          A list of tables which this document is responsible for.
protected  List templatePages
          The set of page templates available to copy for document pages.
 
Constructor Summary
JCDocument(com.klg.jclass.page.JCPrinter printer)
          Creates a document tied to a given printer.
JCDocument(com.klg.jclass.page.JCPrinter printer, List templates)
          Creates a document tied to a given printer.
JCDocument(List templates)
          Creates a document with the specified templates.
JCDocument(String name)
          Creates a named document.
 
Method Summary
 void addFontPackage(String packagePath)
          Convenience method which adds a package of AFM or TTF fonts to the list of available fonts in the PageLayout FontLibrary.
 void addPage(com.klg.jclass.page.JCPage page)
          Adds a page to the document's page list and updates the page numbers being tracked by the flow.
 void addPage(com.klg.jclass.page.JCPage page, boolean updateFlowPageNumbers, boolean isFlowPage)
          Adds a page to the document's page list, optionally updating the page numbers being tracked by the flow.
 void addTable(com.klg.jclass.page.JCPageTable table)
          Adds a table to this document's list of owned tables.
 void checkOutputPage(com.klg.jclass.page.JCPage page)
          (internal use only) This class handles immediate-mode printing and page flushing for completed pages, if those options are selected.
 void dispose()
          Cleans up internal objects so JCDocument will not linger.
 com.klg.jclass.page.JCPage findFirstTemplate()
          Finds the page template that was marked for the first page of the document.
 com.klg.jclass.page.JCFlow getFlow()
          Gets the flow object which is printing to the document.
 int getFlushPolicy()
          Gets the document's current policy on flushing completed (printed) pages.
 String getName()
          Gets the name associated with the document.
 int getOutputPolicy()
          Gets the document's current policy on outputting completed (rendered) pages.
 int getPageCount()
          Gets the number of pages currently created within the document.
 List getPages()
          Gets the List of pages currently created within the document.
 com.klg.jclass.page.JCPrinter getPrinter()
          Gets the printer for which this document is being prepared.
 Graphics getPrinterGraphics()
          Gets the printer for which this document is being prepared.
 int getStartingPageNumber()
          Get the page number at which the flow will start counting.
 List getTables()
          Gets the list of this document's tables.
 List getTemplates()
          Gets the name-to-template mapping the document is using.
 void print()
          Prints the pages of the document to the current printer.
 void print(int first, int last)
          Prints a range of pages from the document to the current printer.
 void print(com.klg.jclass.page.JCPrinter printer)
          Prints the pages of the document.
 void print(com.klg.jclass.page.JCPrinter printer, int first, int last)
          Prints a range of pages from the document.
 void setFlow(com.klg.jclass.page.JCFlow flow)
          Sets the flow object which is printing to the document.
 void setFlushPolicy(int policy)
          Sets the document's behavior for flushing printed pages.
 void setOutputPolicy(int policy)
          Sets the document's behavior for outputting printed pages.
 void setPrinter(com.klg.jclass.page.JCPrinter printer)
          Sets the printer whose attributes will be used to format the document.
 void setStartingPageNumber(int startPage)
          Set the page number at which the flow should start counting.
 void setTemplates(List templates)
          Sets the list of templates.
 com.klg.jclass.page.JCPage stringToTemplate(String name)
          Returns the named template associated with this document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name
The name of the document.


printer

protected com.klg.jclass.page.JCPrinter printer
The printer for which this document is being prepared.


templatePages

protected List templatePages
The set of page templates available to copy for document pages.


pageList

protected List pageList
The list of printable pages created in the document.


pageCount

protected int pageCount
The number of printable pages created.


tableList

protected List tableList
A list of tables which this document is responsible for.


flow

protected com.klg.jclass.page.JCFlow flow
The flow which governs the addition of content to the document.


flushPolicy

protected int flushPolicy
Indicates whether pages are to be discarded once printed. Default is FLUSH_POLICY_ALWAYS_SAVE (saves all pages).


outputPolicy

protected int outputPolicy
Indicates whether pages are to be held for printing. Default is OUTPUT_POLICY_ON_REQUEST (holds all completed pages in memory until the document is printed).


startPage

protected int startPage
The page number at which the flow should start counting.


lastPage

protected int lastPage
For immediate-mode printing, track the last page we successfully printed.


FLUSH_POLICY_ALWAYS_SAVE

public static final int FLUSH_POLICY_ALWAYS_SAVE
Always saves (does not flush) all pages (default).

See Also:
Constant Field Values

FLUSH_POLICY_ON_OUTPUT

public static final int FLUSH_POLICY_ON_OUTPUT
Flushes pages as they are completed and printed.

See Also:
Constant Field Values

OUTPUT_POLICY_ON_REQUEST

public static final int OUTPUT_POLICY_ON_REQUEST
Holds all completed pages in memory until the document is printed (default).

See Also:
Constant Field Values

OUTPUT_POLICY_IMMEDIATE

public static final int OUTPUT_POLICY_IMMEDIATE
Outputs each page as it is completed (if all predecessors are complete).

See Also:
Constant Field Values

BLANK_8p5X11

public static final List BLANK_8p5X11
Blank (no headers or footers) 8.5 x 11 inch page.


BLANK_8p5X14

public static final List BLANK_8p5X14
Blank (no headers or footers) 8.5 x 14 inch page.


BLANK_11X17

public static final List BLANK_11X17
Blank (no headers or footers) 11 x 17 inch page.


BLANK_A3

public static final List BLANK_A3
Blank (no headers or footers) A3 page.


BLANK_A4

public static final List BLANK_A4
Blank (no headers or footers) A4 page.


BLANK_A5

public static final List BLANK_A5
Blank (no headers or footers) A5 page.


BLANK_11X8p5

public static final List BLANK_11X8p5
Blank (no headers or footers) 11 x 8.5 inch (landscape) page.

Constructor Detail

JCDocument

public JCDocument(String name)
Creates a named document.

Parameters:
name - the name to assign to the document

JCDocument

public JCDocument(com.klg.jclass.page.JCPrinter printer)
Creates a document tied to a given printer.

Parameters:
printer - the printer to use to format to the document

JCDocument

public JCDocument(com.klg.jclass.page.JCPrinter printer,
                  List templates)
Creates a document tied to a given printer.

Parameters:
printer - the printer to use to format to the document
templates - list of templates to use

JCDocument

public JCDocument(List templates)
Creates a document with the specified templates.

Parameters:
templates - a list of templates to be used in the document
Method Detail

getName

public String getName()
Gets the name associated with the document.

Returns:
the name of the document

getPrinter

public com.klg.jclass.page.JCPrinter getPrinter()
Gets the printer for which this document is being prepared.

Returns:
the printer object the document is using to generate the flow

setPrinter

public void setPrinter(com.klg.jclass.page.JCPrinter printer)
Sets the printer whose attributes will be used to format the document.

Parameters:
printer - a printer object to associate with this document

getPrinterGraphics

public Graphics getPrinterGraphics()
Gets the printer for which this document is being prepared.

Returns:
the printer object the document is using to generate the flow

getTemplates

public List getTemplates()
Gets the name-to-template mapping the document is using.

Returns:
a list of template pages

setTemplates

public void setTemplates(List templates)
Sets the list of templates.

Parameters:
templates - a list of templates

dispose

public void dispose()
Cleans up internal objects so JCDocument will not linger. Call before setting document instance to null.


findFirstTemplate

public com.klg.jclass.page.JCPage findFirstTemplate()
Finds the page template that was marked for the first page of the document.

Returns:
a template page to use for the document's first page

setStartingPageNumber

public void setStartingPageNumber(int startPage)
Set the page number at which the flow should start counting. This method must be called after the JCDocument is created but before the JCFlow is created from the document.

Parameters:
startPage - the page number of the first page in the flow

getStartingPageNumber

public int getStartingPageNumber()
Get the page number at which the flow will start counting.

Returns:
the page number of the first page in the flow

addPage

public void addPage(com.klg.jclass.page.JCPage page)
Adds a page to the document's page list and updates the page numbers being tracked by the flow.

Parameters:
page - a new page to append to the document

addPage

public void addPage(com.klg.jclass.page.JCPage page,
                    boolean updateFlowPageNumbers,
                    boolean isFlowPage)
Adds a page to the document's page list, optionally updating the page numbers being tracked by the flow.

Parameters:
page - a new page to append to the document
updateFlowPageNumbers - if true, the page numbers being tracked by the flow (for example, the current page number, the number of pages in a section, the number of pages in the document) will include the page being added with this method; if false, they will not
isFlowPage - true if page is part of current flow (added by methods in JCFlow); false if page is not part of flow (added by user call). This information is needed to determine whether to update page numbers when adding this page: now, because new page is the next in the flow, or after the next flow page has been created if this new page is a non-flow page.

addFontPackage

public void addFontPackage(String packagePath)
Convenience method which adds a package of AFM or TTF fonts to the list of available fonts in the PageLayout FontLibrary. All .afm, .ttf, and .ttc files found in the specified directory and all of its subdirectories will be added. The specified directory will be stored for use in reading font files when they become needed. If a font name map resource bundle property file of name "user" and corresponding to the default locale exists in the directory (or its subdirectories), it is also loaded and its contents added to FontLibrary's global font name map. (For example, for the North American/English locale, the directory is first searched for the file named "user_en_US.properties", then "user_en.properties" and finally "user.properties". Font name map files outline the names the user will refer to fonts by the and the names by which they're referred inside the corresponding .afm or .ttf file.) See the FontLibrary class for methods allowing the loading of specific font files and font name map resources bundles.

Parameters:
packagePath - a String representing the absolute location of the directory which contains both font files (.afm or .ttf) and an optional font name map resource bundle property file (for example, "user.properties")

getPageCount

public int getPageCount()
Gets the number of pages currently created within the document.

Returns:
the number of document pages created

getPages

public List getPages()
Gets the List of pages currently created within the document.

Returns:
the List of document pages

getFlow

public com.klg.jclass.page.JCFlow getFlow()
Gets the flow object which is printing to the document.

Returns:
the document's flow

setFlow

public void setFlow(com.klg.jclass.page.JCFlow flow)
Sets the flow object which is printing to the document. This method is for internal use only. End users associate a document with a flow when the flow is instantiated.

Parameters:
flow - a flow object which will render to the document

getFlushPolicy

public int getFlushPolicy()
Gets the document's current policy on flushing completed (printed) pages.

Returns:
the document's flush policy

setFlushPolicy

public void setFlushPolicy(int policy)
Sets the document's behavior for flushing printed pages.

Parameters:
policy - the policy to apply to completed (output) pages

getOutputPolicy

public int getOutputPolicy()
Gets the document's current policy on outputting completed (rendered) pages.

Returns:
the document's output policy

setOutputPolicy

public void setOutputPolicy(int policy)
Sets the document's behavior for outputting printed pages.

Parameters:
policy - the policy to apply to completed (rendered) pages

stringToTemplate

public com.klg.jclass.page.JCPage stringToTemplate(String name)
Returns the named template associated with this document.

Parameters:
name - the name of a page template
Returns:
the corresponding template page for this document

getTables

public List getTables()
Gets the list of this document's tables.

Returns:
the list of tables owned by this document

addTable

public void addTable(com.klg.jclass.page.JCPageTable table)
Adds a table to this document's list of owned tables.

Parameters:
table - the table to add to the list

print

public void print()
Prints the pages of the document to the current printer.


print

public void print(com.klg.jclass.page.JCPrinter printer)
Prints the pages of the document.

Parameters:
printer - the printer to output the document to

print

public void print(int first,
                  int last)
Prints a range of pages from the document to the current printer.

Parameters:
first - the start page of the range of pages to print
last - the end page of the range of pages to print

print

public void print(com.klg.jclass.page.JCPrinter printer,
                  int first,
                  int last)
Prints a range of pages from the document.

Parameters:
printer - the printer to output the document to
first - the start page of the range of pages to print
last - the end page of the range of pages to print

checkOutputPage

public void checkOutputPage(com.klg.jclass.page.JCPage page)
(internal use only) This class handles immediate-mode printing and page flushing for completed pages, if those options are selected.

Parameters:
page -

Copyright © 2004 Quest Software Inc..
All rights reserved.