|
ReportMill 11 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.reportmill.base.RMObject
com.reportmill.shape.RMShape
com.reportmill.shape.RMDocument
public class RMDocument
The RMDocument class represents a ReportMill document and is also an RMShape subclass, so it can be a real part of the document/shape hierarchy. RMDocuments are also what ReportMill refers to as templates, and is commonly used like this:
RMDocument template = new RMDocument(aSource); // Load from path String, File, byte array, etc. RMDocument report = template.generateReport(aDataset); // Any Java dataset: EJBs, custom classes, collctns, etc. report.writePDF("MyReport.pdf");
On rare occasions, you may also want to create a document dynamically. Here's an example:
RMDocument doc = new RMDocument(612, 792); // Standard US Letter size (8.5" x 11"), in points RMTable table = new RMTable(); // Create new table ... doc.getPage(0).addChild(table); // ... and add to first page table.setBounds(36, 36, 540, 680); // Position and size table table.getRow("Objects Details").getColumn(0).setText("Title: @getTitle@"); // Configure first text
Nested Class Summary | |
---|---|
static interface |
RMDocument.DocListener
An interface to define objects that want to get document notifications. |
static interface |
RMDocument.Source
A simple interface for a viewer source. |
Field Summary | |
---|---|
static java.util.Locale |
_locale
|
static byte |
PAGE_LAYOUT_CONTINUOUS
|
static byte |
PAGE_LAYOUT_CONTINUOUS_DOUBLE
|
static byte |
PAGE_LAYOUT_DOUBLE
|
static byte |
PAGE_LAYOUT_FACING
|
static byte |
PAGE_LAYOUT_QUADRUPLE
|
static byte |
PAGE_LAYOUT_SINGLE
|
static java.lang.String[] |
SUPPORTED_UNITS
|
static byte |
UNIT_CM
|
static byte |
UNIT_INCHES
|
static byte |
UNIT_MM
|
static byte |
UNIT_PICA
|
static byte |
UNIT_POINTS
|
Fields inherited from class com.reportmill.shape.RMShape |
---|
WRAP_TYPE_BOTH, WRAP_TYPE_NONE |
Constructor Summary | |
---|---|
RMDocument()
Creates a plain empty document. |
|
RMDocument(float aWidth,
float aHeight)
Creates a document with the given width and height (in printer points). |
|
RMDocument(java.lang.Object aSource)
Creates a new document from the given source. |
Method Summary | |
---|---|
boolean |
acceptsChildren()
Editor method indicates that document accepts children (should probably be false). |
void |
addBinder(com.reportmill.binder.RMBinder aBinder)
Adds a binder to the panel. |
void |
addPage(RMPage aPage)
Adds a given page to this document. |
void |
addPage(RMPage aPage,
int anIndex)
Adds a given page to this document at the given index. |
void |
addPages(RMDocument aDoc)
Add the pages in the given document to this document (at end) and clears the pages list in the given document. |
void |
boundsChanged(RMShape aShape)
Notifies this shape that a given shape's bounds have changed (presumably a descendant). |
boolean |
childrenSuperSelectImmediately()
Editor method indicates that pages super select immediately. |
RMDocument |
clone()
Copies basic document attributes (shallow copy only - no children or pages). |
RMDocument |
cloneDeep()
Copies the complete document, including document pages and all their children. |
com.reportmill.shape.RMShapeLayout |
createLayout()
Overrides shape version to provide null layout by default. |
boolean |
equals(java.lang.Object anObj)
Standard equals implementation. |
java.lang.Object |
fromXMLShape(com.reportmill.archiver.RXArchiver anArchiver,
com.reportmill.archiver.RXElement anElement,
java.lang.Object anOwner)
XML unarchival. |
void |
fromXMLShapeChildren(com.reportmill.archiver.RXArchiver anArchiver,
com.reportmill.archiver.RXElement anElement,
java.lang.Object anOwner)
XML unarchival for shape children. |
RMDocument |
generateReport()
Returns a generated report from this template evaluated against the given object. |
RMDocument |
generateReport(java.lang.Object objects)
Returns a generated report from this template evaluated against the given object. |
RMDocument |
generateReport(java.lang.Object objects,
boolean paginate)
Returns a generated report from this template evaluated against the given object with an option to paginate. |
RMDocument |
generateReport(java.lang.Object objects,
java.lang.Object userInfo)
Returns a generated report from this template evaluated against the given object and userInfo. |
RMDocument |
generateReport(java.lang.Object objects,
java.lang.Object userInfo,
boolean paginate)
Returns generated report from this template evaluated against given object/userInfo (with option to paginate). |
com.reportmill.graphics.RMAnimator |
getAnimator(int anIndex)
Returns the animator for a specific page. |
com.reportmill.graphics.RMAnimator |
getAnimatorLast()
Returns the animator for the last page. |
com.reportmill.binder.RMBinder |
getBinder(int anIndex)
Returns the specific binder at the given index. |
com.reportmill.binder.RMBinder |
getBinder(java.lang.String aName)
Returns the named binder for this panel. |
int |
getBinderCount()
Returns the number of binders for this panel. |
java.util.List<com.reportmill.binder.RMBinder> |
getBinders()
Returns the binders list. |
byte[] |
getBytes()
Returns the document as an XML byte array. |
byte[] |
getBytesCSV()
Returns the document as a byte array of a CSV file. |
byte[] |
getBytesDelimitedAscii(java.lang.String fieldDelimiter,
java.lang.String recordDelimiter,
boolean quoteFields)
Returns the document as a byte array of a delimited ASCII file (using given field, record separator strings). |
byte[] |
getBytesExcel()
Returns the document as byte array of an Excel file. |
byte[] |
getBytesFlash()
Returns the document as a byte array of a Flash file. |
byte[] |
getBytesHTML()
Returns the document as a byte array of an HTML file. |
byte[] |
getBytesJPEG()
Returns the document as byte array of a JPEG file. |
byte[] |
getBytesPDF()
Returns the document as a byte array of a PDF file. |
byte[] |
getBytesPNG()
Returns the document as byte array of PNG file. |
byte[] |
getBytesRTF()
Returns the document as byte array of an Excel file. |
boolean |
getCompress()
Returns whether the document should compress images in generated file formats like PDF. |
RMEntity |
getDatasetEntity()
Returns the entity this shape should show in keys browser. |
RMDataSource |
getDataSource()
Returns the RMDataSource associated with this document. |
RMSchema |
getDataSourceSchema()
Returns the schema for the RMDataSource associated with this document (convenience). |
static RMDocument |
getDoc(java.lang.Object aSource)
Creates a new document from aSource using RMArchiver. |
RMDocument.DocListener |
getDocListener()
Returns the first doc listener from listeners list. |
RMDocument |
getDocument()
Returns the document itself (over-ridden from RMShape). |
java.lang.String |
getFilename()
Returns the filename associated with this document, if available. |
float |
getGridSpacing()
Returns the grid spacing for the document's grid. |
boolean |
getLoops()
Returns whether the last animator loops. |
java.util.Map |
getMapHTML(java.lang.String anImageRoot)
Returns the document as a Map of an HTML file and image resources. |
float |
getMarginBottom()
Returns the margin rects bottom value. |
float |
getMarginLeft()
Returns the margin rects left value. |
RMRect |
getMarginRect()
Returns the margin rect for this document. |
float |
getMarginRight()
Returns the margin rects right value. |
float |
getMarginTop()
Returns the margin rects top value. |
float |
getMaxTime()
Returns the total time needed to animate this document (total of all page animators). |
java.lang.String |
getNullString()
Returns the string used to replace any occurrances of null values in a generated report. |
RMPage |
getPage(int index)
Returns the page at the given index. |
int |
getPageCount()
Returns the number of pages in this document. |
RMPage |
getPageLast()
Returns the last page (convenience). |
byte |
getPageLayout()
Returns the page layout for the document. |
java.util.List<RMPage> |
getPages()
Returns the list of pages associated with this document. |
RMSize |
getPageSize()
Returns the size of a document page. |
java.lang.Boolean |
getPaginate()
Returns whether the document should paginate generated reports by default. |
float |
getPointsFromUnits(float aValue)
Converts given value from document units to printer points (1/72 of an inch). |
java.lang.String |
getPublishUrl()
Returns the URL this document should be uploaded to. |
com.reportmill.base.ReportMill |
getReportMill()
Returns the reportmill associated with the document. |
RMPage |
getSelectedPage()
Returns the currently selected page of this document. |
int |
getSelectedPageIndex()
Returns the current page index of this document. |
boolean |
getShowGrid()
Returns whether the document should show an alignment grid. |
boolean |
getShowMargin()
Returns whether the document should show a margin rect. |
boolean |
getSnapGrid()
Returns whether the document should snap to an alignment grid. |
boolean |
getSnapMargin()
Returns whether the document should snap to a margin rect. |
java.lang.String |
getStringCSV()
Returns the document as a string of a CSV file. |
java.lang.String |
getStringDelimitedText(java.lang.String fieldDelimiter,
java.lang.String recordDelimiter,
boolean quoteFields)
Returns the document as a string of a delimited text file. |
com.reportmill.base.RMUndoer |
getUndoer()
Returns the RMUndoer for this document. |
int |
getUnit()
Returns the units used to express sizes in the current document (POINTS, INCHES, CENTIMETERS). |
float |
getUnitsFromPoints(float aValue)
Converts given value to document units from printer points (1/72 of an inch). |
float |
getUnitsMultiplier()
Returns the multiplier used to convert printer points to document units. |
java.lang.String |
getUnitString()
Returns the units used to express sizes in the current document as one of the strings: point, inch or cm. |
float |
getVersion()
Returns the version this document was loaded as. |
com.reportmill.archiver.RXElement |
getWindowXML()
Returns the xml element for the document window. |
boolean |
isEditing()
Returns whether the document is visible in an editor. |
boolean |
isShowing()
Returns whether the document is visible in a viewer or editor. |
void |
paintShape(com.reportmill.shape.RMShapePainter aPainter,
java.awt.Graphics2D aGraphics)
Overrides paint shape, because document should never really paint itself. |
byte[] |
pdfBytes()
Obsolete method for old pdfBytes() method. |
void |
rebuild()
Rebuilds the document according to the selected page and page layout. |
com.reportmill.binder.RMBinder |
removeBinder(int anIndex)
Removes a binder at the given index from the panel. |
int |
removeBinder(com.reportmill.binder.RMBinder aBinder)
Removes a binder from the panel. |
RMPage |
removePage(int anIndex)
Removes the page at the given index from this document. |
void |
repaint()
Make sure document registers for repaint too. |
void |
repaint(RMShape aShape)
This is a notification call for impending visual shape attribute changes. |
void |
resolvePageReferences()
Performs page substitutions on any text fields that were identified as containing @Page@ keys. |
void |
setCompress(boolean aValue)
Sets whether the document should compress images in generated file formats like PDF. |
void |
setDataSource(RMDataSource aDataSource)
Sets the RMDataSource associated with this document. |
void |
setFilename(java.lang.String aPath)
Sets the filename associated with this document. |
void |
setGridSpacing(float aValue)
Sets the grid spacing for the document's grid. |
void |
setMarginRect(RMRect aRect)
Sets the margin rect for this document. |
void |
setMargins(float left,
float right,
float top,
float bottom)
Sets the margin rect for this document. |
void |
setNullString(java.lang.String aValue)
Sets the string used to replace any occurrances of null values in a generated report. |
void |
setPageLayout(byte aValue)
Sets the page layout for the document. |
void |
setPageSize(float aWidth,
float aHeight)
Sets the size of the document (and all of its pages). |
void |
setPaginate(java.lang.Boolean aValue)
Sets whether the document should paginate generated reports by default. |
void |
setPublishUrl(java.lang.String aValue)
Sets the URL this document should be uploaded to. |
void |
setReportMill(com.reportmill.base.ReportMill aReportMill)
Creates an RPG clone of document. |
void |
setSelectedPage(RMPage aPage)
Selects the given page. |
void |
setSelectedPageIndex(int anIndex)
Selects the currently selected page by index. |
void |
setShowGrid(boolean aValue)
Sets whether the document should show an alignment grid. |
void |
setShowMargin(boolean aValue)
Sets whether the document should show a margin rect. |
void |
setSnapGrid(boolean aValue)
Sets whether the document should snap to an alignment grid. |
void |
setSnapMargin(boolean aValue)
Sets whether the document should snap to a margin rect. |
void |
setUndoer(com.reportmill.base.RMUndoer anUndoer)
Sets the RMUndoer for this document. |
void |
setUnit(byte aValue)
Sets the units used to express sizes in the current document (POINTS, INCHES, CENTIMETERS). |
void |
setUnitString(java.lang.String aValue)
Sets the units used to express sizes in the current document with one of the strings: point, inch or cm. |
void |
setWindowXML(com.reportmill.archiver.RXElement anElement)
Sets the xml element for the document window. |
boolean |
superSelectable()
Editor method indicates that document is super selectable. |
com.reportmill.archiver.RXElement |
toXML()
Returns RXElement for document. |
com.reportmill.archiver.RXElement |
toXMLShape(com.reportmill.archiver.RXArchiver anArchiver,
java.lang.Object anOwner)
XML archival. |
void |
toXMLShapeChildren(com.reportmill.archiver.RXArchiver anArchiver,
com.reportmill.archiver.RXElement anElement,
java.lang.Object anOwner)
XML archival of children. |
void |
write(java.io.File aFile)
Writes the document to the given File object |
void |
write(java.lang.String aPath)
Writes the document out to the given path String (it extracts type from path extension). |
java.util.Map |
writeHTML(java.lang.String aPath)
Writes the document to the given path String as HTML. |
java.util.Map |
writeHTML(java.lang.String aPath,
java.lang.String anImageRoot)
Writes the document to the given path String as HTML (referenced images are written at the given relative path). |
void |
writePDF(java.lang.String aPath)
Writes the document to the given path String as PDF. |
Methods inherited from class com.reportmill.base.RMObject |
---|
addListener, addPropertyChangeListener, firePropertyChange, getListener, getListenerCount, getListeners, isFirePropertyChangeEnabled, isUndoing, removeListener, removePropertyChangeListener, setFirePropertyChangeEnabled, setUndoing |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final byte PAGE_LAYOUT_SINGLE
public static final byte PAGE_LAYOUT_DOUBLE
public static final byte PAGE_LAYOUT_QUADRUPLE
public static final byte PAGE_LAYOUT_FACING
public static final byte PAGE_LAYOUT_CONTINUOUS
public static final byte PAGE_LAYOUT_CONTINUOUS_DOUBLE
public static final byte UNIT_INCHES
public static final byte UNIT_POINTS
public static final byte UNIT_CM
public static final byte UNIT_MM
public static final byte UNIT_PICA
public static final java.lang.String[] SUPPORTED_UNITS
public static java.util.Locale _locale
Constructor Detail |
---|
public RMDocument()
public RMDocument(float aWidth, float aHeight)
public RMDocument(java.lang.Object aSource)
Method Detail |
---|
public static RMDocument getDoc(java.lang.Object aSource)
public java.lang.String getFilename()
public void setFilename(java.lang.String aPath)
public float getVersion()
public int getPageCount()
public RMPage getPage(int index)
public RMPage getPageLast()
public java.util.List<RMPage> getPages()
public void addPage(RMPage aPage)
public void addPage(RMPage aPage, int anIndex)
public RMPage removePage(int anIndex)
public void addPages(RMDocument aDoc)
public RMPage getSelectedPage()
public void setSelectedPage(RMPage aPage)
public int getSelectedPageIndex()
public void setSelectedPageIndex(int anIndex)
public byte getPageLayout()
public void setPageLayout(byte aValue)
public int getUnit()
public void setUnit(byte aValue)
public java.lang.String getUnitString()
public void setUnitString(java.lang.String aValue)
public float getPointsFromUnits(float aValue)
public float getUnitsFromPoints(float aValue)
public float getUnitsMultiplier()
public boolean getShowGrid()
public void setShowGrid(boolean aValue)
public boolean getSnapGrid()
public void setSnapGrid(boolean aValue)
public float getGridSpacing()
public void setGridSpacing(float aValue)
public boolean getShowMargin()
public void setShowMargin(boolean aValue)
public boolean getSnapMargin()
public void setSnapMargin(boolean aValue)
public RMRect getMarginRect()
public void setMarginRect(RMRect aRect)
public void setMargins(float left, float right, float top, float bottom)
public float getMarginLeft()
public float getMarginRight()
public float getMarginTop()
public float getMarginBottom()
public RMSize getPageSize()
public void setPageSize(float aWidth, float aHeight)
public RMDataSource getDataSource()
public void setDataSource(RMDataSource aDataSource)
public RMSchema getDataSourceSchema()
public RMEntity getDatasetEntity()
getDatasetEntity
in class RMShape
public int getBinderCount()
public com.reportmill.binder.RMBinder getBinder(int anIndex)
public java.util.List<com.reportmill.binder.RMBinder> getBinders()
public com.reportmill.binder.RMBinder getBinder(java.lang.String aName)
getBinder
in class RMShape
public void addBinder(com.reportmill.binder.RMBinder aBinder)
public com.reportmill.binder.RMBinder removeBinder(int anIndex)
public int removeBinder(com.reportmill.binder.RMBinder aBinder)
public java.lang.String getPublishUrl()
public void setPublishUrl(java.lang.String aValue)
public java.lang.String getNullString()
public void setNullString(java.lang.String aValue)
public java.lang.Boolean getPaginate()
public void setPaginate(java.lang.Boolean aValue)
public boolean getCompress()
public void setCompress(boolean aValue)
public com.reportmill.archiver.RXElement getWindowXML()
public void setWindowXML(com.reportmill.archiver.RXElement anElement)
public RMDocument generateReport()
public RMDocument generateReport(java.lang.Object objects)
public RMDocument generateReport(java.lang.Object objects, java.lang.Object userInfo)
public RMDocument generateReport(java.lang.Object objects, boolean paginate)
public RMDocument generateReport(java.lang.Object objects, java.lang.Object userInfo, boolean paginate)
public byte[] getBytes()
public byte[] getBytesPDF()
public byte[] getBytesHTML()
public byte[] getBytesFlash()
public byte[] getBytesCSV()
public byte[] getBytesDelimitedAscii(java.lang.String fieldDelimiter, java.lang.String recordDelimiter, boolean quoteFields)
public byte[] getBytesExcel()
public byte[] getBytesRTF()
public byte[] getBytesJPEG()
public byte[] getBytesPNG()
public java.util.Map getMapHTML(java.lang.String anImageRoot)
public java.lang.String getStringCSV()
public java.lang.String getStringDelimitedText(java.lang.String fieldDelimiter, java.lang.String recordDelimiter, boolean quoteFields)
public void write(java.lang.String aPath)
public void write(java.io.File aFile)
public void writePDF(java.lang.String aPath)
public java.util.Map writeHTML(java.lang.String aPath)
public java.util.Map writeHTML(java.lang.String aPath, java.lang.String anImageRoot)
public void rebuild()
public float getMaxTime()
public RMDocument getDocument()
getDocument
in class RMShape
public com.reportmill.graphics.RMAnimator getAnimator(int anIndex)
public com.reportmill.graphics.RMAnimator getAnimatorLast()
public boolean getLoops()
public com.reportmill.base.RMUndoer getUndoer()
getUndoer
in class RMShape
public void setUndoer(com.reportmill.base.RMUndoer anUndoer)
public RMDocument.DocListener getDocListener()
public boolean isShowing()
isShowing
in class RMShape
public boolean isEditing()
isEditing
in class RMShape
public void repaint()
repaint
in class RMShape
public void repaint(RMShape aShape)
repaint
in class RMShape
public void paintShape(com.reportmill.shape.RMShapePainter aPainter, java.awt.Graphics2D aGraphics)
paintShape
in class RMShape
public void boundsChanged(RMShape aShape)
boundsChanged
in class RMShape
public com.reportmill.base.ReportMill getReportMill()
getReportMill
in class RMShape
public void setReportMill(com.reportmill.base.ReportMill aReportMill)
setReportMill
in class RMShape
public void resolvePageReferences()
public com.reportmill.shape.RMShapeLayout createLayout()
createLayout
in class RMShape
public boolean equals(java.lang.Object anObj)
equals
in class RMShape
public RMDocument clone()
clone
in class RMShape
public RMDocument cloneDeep()
cloneDeep
in class RMShape
public com.reportmill.archiver.RXElement toXML()
public com.reportmill.archiver.RXElement toXMLShape(com.reportmill.archiver.RXArchiver anArchiver, java.lang.Object anOwner)
toXMLShape
in class RMShape
public void toXMLShapeChildren(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement, java.lang.Object anOwner)
toXMLShapeChildren
in class RMShape
public java.lang.Object fromXMLShape(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement, java.lang.Object anOwner)
fromXMLShape
in class RMShape
public void fromXMLShapeChildren(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement, java.lang.Object anOwner)
fromXMLShapeChildren
in class RMShape
public boolean superSelectable()
superSelectable
in class RMShape
public boolean childrenSuperSelectImmediately()
childrenSuperSelectImmediately
in class RMShape
public boolean acceptsChildren()
acceptsChildren
in class RMShape
public byte[] pdfBytes()
|
ReportMill 11 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |