public class RMDocument extends RMParentShape
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
Modifier and Type | Class and Description |
---|---|
static class |
RMDocument.PageLayout |
static class |
RMDocument.Unit |
RMTypes.Align, RMTypes.AlignX, RMTypes.AlignY
Modifier and Type | Field and Description |
---|---|
static java.util.Locale |
_locale |
Constructor and Description |
---|
RMDocument()
Creates a plain empty document.
|
RMDocument(double aWidth,
double 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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsChildren()
Editor method indicates that document accepts children (should probably be false).
|
void |
addChild(RMShape aChild,
int anIndex)
Override to make sure document has size.
|
RMPage |
addPage()
Adds a new page to this document.
|
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.
|
boolean |
childrenSuperSelectImmediately()
Editor method indicates that pages super select immediately.
|
RMDocument |
clone()
Copies basic document attributes (shallow copy only - no children or pages).
|
RMPage |
createPage()
Creates a new page.
|
RMDocument |
generateReport()
Returns a generated report from this template evaluated against the given object.
|
RMDocument |
generateReport(java.lang.Object theObjects)
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 theObjects,
java.lang.Object theUserInfo,
boolean aPaginateFlag)
Returns generated report from this template evaluated against given object/userInfo (with option to paginate).
|
RMAnimator |
getAnimator(int anIndex)
Returns the animator for a specific page.
|
RMAnimator |
getAnimatorLast()
Returns the animator for the last page.
|
java.lang.String |
getAutosizingDefault()
Returns the autosizing default.
|
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[] |
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.
|
Entity |
getDatasetEntity()
Returns the entity this shape should show in keys browser.
|
RMDataSource |
getDataSource()
Returns the RMDataSource associated with this document.
|
Schema |
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 |
getDocument()
Returns the document itself (over-ridden from RMShape).
|
java.lang.String |
getFilename()
Returns the filename associated with this document, if available.
|
RMFont |
getFont()
Returns the document's default font.
|
double |
getGridSpacing()
Returns the grid spacing for the document's grid.
|
boolean |
getLoops()
Returns whether the last animator loops.
|
double |
getMarginBottom()
Returns the margin rects bottom value.
|
double |
getMarginLeft()
Returns the margin rects left value.
|
RMRect |
getMarginRect()
Returns the margin rect for this document.
|
RMRect |
getMarginRectDefault()
Returns the default margin rect.
|
double |
getMarginRight()
Returns the margin rects right value.
|
double |
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 anIndex)
Returns the page at the given index.
|
int |
getPageCount()
Returns the number of pages in this document.
|
RMPage |
getPageLast()
Returns the last page (convenience).
|
RMDocument.PageLayout |
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.
|
RMSize |
getPageSizeDefault()
Returns the default page size.
|
double |
getPointsFromUnits(double 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.
|
int |
getSelectedIndex()
Returns the current page index of this document.
|
RMPage |
getSelectedPage()
Returns the currently selected page 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.
|
RMDocument |
getSubreport(java.lang.String aName)
Returns a subreport document for given name (override to improve).
|
RMDocument.Unit |
getUnit()
Returns the units used to express sizes in the current document (POINTS, INCHES, CENTIMETERS).
|
double |
getUnitsFromPoints(double 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.
|
float |
getVersion()
Returns the version this document was loaded as.
|
boolean |
isPaginate()
Returns whether the document should paginate generated reports by default.
|
void |
paintShape(RMShapePainter aPntr)
Overrides paint shape, because document should never really paint itself.
|
byte[] |
pdfBytes()
Obsolete method for old pdfBytes() method.
|
RMPage |
removePage(int anIndex)
Removes a page from this document.
|
int |
removePage(RMPage aPage)
Removes the given page.
|
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 |
setFont(RMFont aFont)
Sets the document default font.
|
void |
setGridSpacing(double aValue)
Sets the grid spacing for the document's grid.
|
void |
setMarginRect(RMRect aRect)
Sets the margin rect for this document.
|
void |
setMargins(double left,
double right,
double top,
double 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(RMDocument.PageLayout aValue)
Sets the page layout for the document.
|
void |
setPageLayout(java.lang.String aValue)
Set page layout from string.
|
void |
setPageSize(double aWidth,
double aHeight)
Sets the size of the document (and all of its pages).
|
void |
setPaginate(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 |
setSelectedIndex(int anIndex)
Selects the currently selected page by index.
|
void |
setSelectedPage(RMPage aPage)
Selects the given page.
|
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 |
setUnit(RMDocument.Unit aValue)
Sets the units used to express sizes in the current document (POINTS, INCHES, CENTIMETERS).
|
void |
setUnit(java.lang.String aString)
Sets the units used to express sizes in the current document with one of the strings: point, inch or cm.
|
boolean |
superSelectable()
Editor method indicates that document is super selectable.
|
XMLElement |
toXML()
Returns RXElement for document.
|
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).
|
void |
writePDF(java.lang.String aPath)
Writes the document to the given path String as PDF.
|
addChild, addChild, addChild, bringShapesToFront, cloneDeep, divideShapeFromTop, fromXML, getBoundsOfChildren, getChild, getChildArray, getChildContaining, getChildCount, getChildLast, getChildren, getChildrenIntersecting, getChildrenWithClass, getChildrenWithClass, getChildWithClass, getChildWithName, getLayout, getNeedsLayout, getSourceURL, indexOfChild, isSourceURLSet, layout, relayout, removeChild, removeChild, removeChildren, rpgAll, sendShapesToBack, setHeight, setLayout, setNeedsLayout, setSourceURL, setWidth, toXML
acceptsMouse, addBinding, addBinding, addDeepChangeListener, addMouseListener, animUpdate, bounds, contains, convertedPointFromShape, convertedPointToShape, convertedRectFromShape, convertedRectToShape, convertFromShape, convertPathFromShape, convertPathToShape, convertPointFromShape, convertPointToShape, convertRectFromShape, convertRectToShape, convertToShape, convertVectorFromShape, convertVectorToShape, copyShape, deepChange, divideShapeFromEdge, get, get, getAlignment, getAlignmentX, getAlignmentY, getAncestor, getAncestorCount, getAncestorInCommon, getAnimator, getAnimator, getAutosizing, getBestHeight, getBestHeight, getBestWidth, getBestWidth, getBinding, getBinding, getBindingCount, getBounds, getBoundsInside, getBoundsMarked, getBoundsMarkedDeep, getChildAnimator, getChildAnimator, getClipShape, getColor, getDatasetKey, getEffect, getEventAdapter, getFill, getFormat, getFrame, getFrameHeight, getFrameMaxX, getFrameMaxY, getFrameWidth, getFrameX, getFrameXY, getFrameY, getHeight, getHover, getLayoutInfo, getMaskPath, getMaxX, getMaxY, getMinHeight, getMinHeight, getMinWidth, getMinWidth, getName, getOpacity, getOpacityDeep, getOutline, getPageBreak, getPageBreakMax, getPageBreakPage, getPageBreakPageMax, getPageShape, getParent, getParent, getPath, getPathInBounds, getPrefHeight, getPrefHeight, getPrefWidth, getPrefWidth, getPropertyNameMapped, getPropertyNames, getRoll, getRootShape, getScaleX, getScaleY, getShapesToAncestor, getShapesToDescendant, getShapesToShape, getSize, getSkewX, getSkewY, getStroke, getStrokeColor, getStrokeOnTop, getStrokeWidth, getTextColor, getTimeline, getTimeline, getTransform, getTransformFromShape, getTransformInverse, getTransformToShape, getUndoer, getURL, getWidth, getX, getXY, getXYP, getY, height, indexOf, intersects, isAncestor, isAnimProperty, isDescendant, isEditing, isEnabled, isFontSet, isHittable, isLocked, isMinHeightSet, isMinWidthSet, isPrefHeightSet, isPrefWidthSet, isRoot, isRSS, isUnderlined, isViewing, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, offsetXY, page, pageMax, paint, paintShapeAll, paintShapeChildren, paintShapeOver, propertyChange, put, removeBinding, removeBinding, removeDeepChangeListener, removeFromParent, removeMouseListener, repaint, rpgBindings, setAlignment, setAlignmentX, setAlignmentY, setAutosizing, setBestHeight, setBestSize, setBounds, setBounds, setColor, setEffect, setEnabled, setFill, setFormat, setFrame, setFrame, setFrameSize, setFrameX, setFrameXY, setFrameXY, setFrameY, setHover, setLayoutInfo, setLocked, setMinHeight, setMinSize, setMinWidth, setName, setOpacity, setOutline, setParent, setPrefHeight, setPrefWidth, setRoll, setScaleX, setScaleXY, setScaleY, setSize, setSize, setSkewX, setSkewXY, setSkewY, setStroke, setStrokeColor, setStrokeWidth, setTextColor, setTime, setUnderlined, setURL, setVisible, setX, setXY, setXY, setXYP, setY, toString, undoerDisable, undoerEnable, undoerSetUndoTitle, width, x, y
public RMDocument()
public RMDocument(double aWidth, double aHeight)
public RMDocument(java.lang.Object aSource)
public static RMDocument getDoc(java.lang.Object aSource)
public java.lang.String getFilename()
public RMFont getFont()
public void setFont(RMFont aFont)
public float getVersion()
public int getPageCount()
public RMPage getPage(int anIndex)
public RMPage getPageLast()
public java.util.List<RMPage> getPages()
public RMPage addPage()
public void addPage(RMPage aPage)
public void addPage(RMPage aPage, int anIndex)
public RMPage removePage(int anIndex)
public int removePage(RMPage aPage)
public RMPage createPage()
public void addChild(RMShape aChild, int anIndex)
addChild
in class RMParentShape
public void addPages(RMDocument aDoc)
public int getSelectedIndex()
public void setSelectedIndex(int anIndex)
public RMPage getSelectedPage()
public void setSelectedPage(RMPage aPage)
public RMDocument.PageLayout getPageLayout()
public void setPageLayout(RMDocument.PageLayout aValue)
public void setPageLayout(java.lang.String aValue)
public RMDocument.Unit getUnit()
public void setUnit(RMDocument.Unit aValue)
public void setUnit(java.lang.String aString)
public double getPointsFromUnits(double aValue)
public double getUnitsFromPoints(double aValue)
public float getUnitsMultiplier()
public boolean getShowGrid()
public void setShowGrid(boolean aValue)
public boolean getSnapGrid()
public void setSnapGrid(boolean aValue)
public double getGridSpacing()
public void setGridSpacing(double 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 RMRect getMarginRectDefault()
public void setMargins(double left, double right, double top, double bottom)
public double getMarginLeft()
public double getMarginRight()
public double getMarginTop()
public double getMarginBottom()
public RMSize getPageSize()
public void setPageSize(double aWidth, double aHeight)
public RMSize getPageSizeDefault()
public java.lang.String getAutosizingDefault()
getAutosizingDefault
in class RMShape
public RMDataSource getDataSource()
public void setDataSource(RMDataSource aDataSource)
public Schema getDataSourceSchema()
public Entity getDatasetEntity()
getDatasetEntity
in class RMShape
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 boolean isPaginate()
public void setPaginate(boolean aValue)
public boolean getCompress()
public void setCompress(boolean aValue)
public byte[] getBytes()
public byte[] getBytesPDF()
public byte[] getBytesHTML()
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.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 float getMaxTime()
public RMDocument getDocument()
getDocument
in class RMShape
public RMAnimator getAnimator(int anIndex)
public RMAnimator getAnimatorLast()
public boolean getLoops()
public RMDocument getSubreport(java.lang.String aName)
public void paintShape(RMShapePainter aPntr)
paintShape
in class RMShape
public RMDocument generateReport()
public RMDocument generateReport(java.lang.Object theObjects)
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 theObjects, java.lang.Object theUserInfo, boolean aPaginateFlag)
public void resolvePageReferences()
public XMLElement toXML()
public RMDocument clone()
clone
in class RMParentShape
public boolean superSelectable()
superSelectable
in class RMShape
public boolean childrenSuperSelectImmediately()
childrenSuperSelectImmediately
in class RMShape
public boolean acceptsChildren()
acceptsChildren
in class RMShape
public byte[] pdfBytes()