|
||||||||||
| PREV CLASS Documentation homepage. NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.util.print.IlvPrintableDocument
public class IlvPrintableDocument
An IlvPrintableDocument defines a set of pages to be printed.
An IlvPrintableDocument maintains a set of pages,
defined by IlvPage objects.
To print multiple pages, create an
IlvPrintableDocument object and then add
IlvPage objects to it. To print or preview the content
of a IlvPrintableDocument you must use
an IlvPrintingController, which is designed for this purpose.
| Field Summary | |
|---|---|
static int |
ORDERED_BY_COLUMNS
A page order that indicates that pages are organized by columns. |
static int |
ORDERED_BY_ROWS
A page order that indicates that pages are organized by rows. |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Fields inherited from interface java.awt.print.Pageable |
|---|
UNKNOWN_NUMBER_OF_PAGES |
| Constructor Summary | |
|---|---|
IlvPrintableDocument(String name)
Creates an empty IlvPrintableDocument object. |
|
IlvPrintableDocument(String name,
PageFormat pageFormat)
Creates an empty IlvPrintableDocument to which to add
IlvPage objects. |
|
| Method Summary | |
|---|---|
void |
addPage(IlvPage page)
Adds a page to the document. |
void |
addPropertyChangeListener(PropertyChangeListener propertyChangeListener)
Adds a listener to listen to the modification of all properties. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener propertyChangeListener)
Adds a listener to listen to the modification of the specified property. |
protected IlvPage[] |
createPages()
Creates the pages of this document. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Fires a PropertyChangeEvent event for the specified property. |
String |
getAuthor()
Returns the name of the author of the document. |
int |
getColumnCount()
Returns the number of pages in a column in this document. |
Date |
getDate()
Returns the printing date. |
IlvFlow |
getFlow()
Returns the flow of text contained in this document. |
IlvFooter |
getFooter()
Returns the footer that is printed on each page. |
IlvHeader |
getHeader()
Returns the header that is printed on each page. |
IlvUnit.Rectangle |
getImageableBounds()
Returns the size of the page. |
String |
getName()
Returns the name of the document. |
int |
getNumberOfPages()
Returns the number of pages in the document. |
IlvPage |
getPage(int index)
Gets the page at the specified index. |
PageFormat |
getPageFormat()
Returns the default page format for all contained pages. |
PageFormat |
getPageFormat(int pageIndex)
Returns the page format for the indexed page. |
int |
getPageIndex(IlvPage page)
Gets the index of the specified page. |
int |
getPageOrder()
Returns the order of pages. |
Printable |
getPrintable(int pageIndex)
Returns the Printable object for the indexed page. |
IlvPage |
getTemplatePage()
Returns the template page of the document. |
void |
invalidateFlowLayout()
This method invalidates the layout of the IlvFlow attached to this document if there is
one. |
protected void |
invalidatePages()
Marks the pages status as invalid. |
boolean |
isFlowLayoutValid()
Indicates if the layout of the text flow is completed or not. |
protected void |
prepareDocument()
This method is called before printing the document, before showing the Print Preview dialog box or opening the Page Setup dialog box. |
int |
print(Graphics graphics,
PageFormat format,
int pageIndex)
This method is called to print the document. |
void |
removeAll()
Removes all pages. |
void |
removePage(IlvPage page)
Removes a page from the document. |
void |
removePropertyChangeListener(PropertyChangeListener propertyChangeListener)
Removes a listener so that it no longer listens to the modification of the properties. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener propertyChangeListener)
Removes a listener so that it no longer listens to the modification of the specified property. |
void |
setAuthor(String name)
Changes the name of the author of the document. |
void |
setColumnCount(int nbColumns)
Indicates the number of pages in each column of this document. |
void |
setDate(Date date)
Sets the printing date. |
void |
setFooter(IlvFooter footer)
Changes the footer to be printed on each page. |
void |
setHeader(IlvHeader header)
Changes the header to be printed on each page. |
void |
setName(String name)
Changes the name of the document. |
void |
setPageFormat(PageFormat pageFormat)
Specifies the default page format for all contained pages. |
void |
setPageOrder(int order)
Changes the order of pages. |
void |
setPages(IlvPage[] pages)
Changes all the pages of the document. |
void |
setTemplatePage(IlvPage template)
Specifies the template page for the document. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ORDERED_BY_COLUMNS
setPageOrder(int),
ORDERED_BY_ROWS,
Constant Field Valuespublic static final int ORDERED_BY_ROWS
setPageOrder(int),
ORDERED_BY_COLUMNS,
Constant Field Values| Constructor Detail |
|---|
public IlvPrintableDocument(String name,
PageFormat pageFormat)
IlvPrintableDocument to which to add
IlvPage objects.
name - The name of the document.pageFormat - The default page format for all pages.public IlvPrintableDocument(String name)
IlvPrintableDocument object. The default
page format is a letter-sized page with one-inch margins.
name - The name of the document.| Method Detail |
|---|
public String getName()
null
if no name was set.
setName(java.lang.String)public void setName(String name)
PropertyChangeEvent for the 'name' property.
getName()public Date getDate()
setDate(java.util.Date)public void setDate(Date date)
getDate()public String getAuthor()
null
if no author was set.
setAuthor(java.lang.String)public void setAuthor(String name)
PropertyChangeEvent for the 'author' property.
getAuthor()public PageFormat getPageFormat()
setPageFormat(java.awt.print.PageFormat)public PageFormat getPageFormat(int pageIndex)
Pageable interface.
getPageFormat in interface PageablepageIndex - The index of the page.
public void setPageFormat(PageFormat pageFormat)
PropertyChangeEvent for the 'pageFormat' property.
pageFormat - The default page format for all contained pages.getPageFormat()public IlvUnit.Rectangle getImageableBounds()
public IlvFlow getFlow()
IlvFlow) is created if the document
does not already have a flow.
isFlowLayoutValid(),
invalidateFlowLayout()public boolean isFlowLayoutValid()
true if the document
does not have a flow of text.
IlvFlow,
getFlow(),
invalidateFlowLayout()public void invalidateFlowLayout()
IlvFlow attached to this document if there is
one.
getFlow(),
isFlowLayoutValid()protected IlvPage[] createPages()
null.
protected void invalidatePages()
createPages()public void addPage(IlvPage page)
PropertyChangeEvent for the 'pageCount' property.
page - The page to be added.public void setPages(IlvPage[] pages)
PropertyChangeEvent for the 'pageCount' property.
pages - The new pages.public void removePage(IlvPage page)
PropertyChangeEvent for the 'pageCount' property.
page - The page to be removed.public void removeAll()
PropertyChangeEvent for the 'pageCount' property.
public IlvPage getPage(int index)
index - The index of the page.public int getPageIndex(IlvPage page)
page - The page.public int getNumberOfPages()
getNumberOfPages in interface Pageablepublic Printable getPrintable(int pageIndex)
Printable object for the indexed page.
This is a method of the Pageable interface.
getPrintable in interface PageablepageIndex - The index of the page.
Printable object for the indexed page.public int getColumnCount()
setColumnCount(int),
setPageOrder(int)public void setColumnCount(int nbColumns)
getColumnCount(),
setPageOrder(int)public int getPageOrder()
ORDERED_BY_COLUMNS or ORDERED_BY_ROWS.
This parameter is only useful when the pages are
representing a document split in rows and columns.
setPageOrder(int)public void setPageOrder(int order)
ORDERED_BY_COLUMNS or ORDERED_BY_ROWS.
This parameter is only useful when the pages are
representing a document split in rows and columns.
Note that calling this method does not change the order of the page, but
only indicates in which order the pages have been added. It is the
responsibility of the programmer to add the pages in the correct order.
The method fires a PropertyChangeEvent for the 'pageOrder' property.
getPageOrder()public IlvPage getTemplatePage()
setTemplatePage(ilog.views.util.print.IlvPage)public void setTemplatePage(IlvPage template)
PropertyChangeEvent for the 'templatePage' property.
template - The template page.getTemplatePage()public IlvFooter getFooter()
setFooter(ilog.views.util.print.IlvFooter),
getHeader()public void setFooter(IlvFooter footer)
PropertyChangeEvent for the 'footer' property.
getFooter(),
setHeader(ilog.views.util.print.IlvHeader)public IlvHeader getHeader()
setHeader(ilog.views.util.print.IlvHeader),
getFooter()public void setHeader(IlvHeader header)
PropertyChangeEvent for the 'header' property.
getHeader(),
setFooter(ilog.views.util.print.IlvFooter)protected void prepareDocument()
public int print(Graphics graphics,
PageFormat format,
int pageIndex)
throws PrinterException
java.awt.print.Printable.print method.
print in interface Printablegraphics - The output device to which the document should be printed.format - The page format used to print the indexed page.pageIndex - The index of the page being printed.
PrinterException
protected void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
PropertyChangeEvent event for the specified property.
propertyName - The name of the property.oldValue - The old value of the property.newValue - The new value of the property.
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener propertyChangeListener)
propertyName - The name of the property.propertyChangeListener - The listener.public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener)
propertyChangeListener - The listener.
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener propertyChangeListener)
propertyName - The name of the property.propertyChangeListener - The listener.public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener)
propertyChangeListener - The listener.
|
||||||||||
| PREV CLASS Documentation homepage. NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||