Package com.inet.report
Class RDC
java.lang.Object
com.inet.report.RDC
- All Implemented Interfaces:
Serializable
This is the main class of the Runtime Designer Component of i-net Clear Reports. Use this
class to create a new, empty
RDC submits you to create a new report at runtime, to format a report at runtime, bind fields at runtime, set the datasource at runtime, ... .
Further on you can use RDC with an existing report file. Therefore create a new Engine in combination with the method setReportFile in Engine.
In both cases (
You can save your newly created or your changes on existing report design as XML file and load them.
You can find a lot of samples in directory rdc of the sample directory.
Engine
(report).RDC submits you to create a new report at runtime, to format a report at runtime, bind fields at runtime, set the datasource at runtime, ... .
Further on you can use RDC with an existing report file. Therefore create a new Engine in combination with the method setReportFile in Engine.
In both cases (
createEmptyEngine
and new Engine( Engine.NO_EXPORT )
followed by setReportFile()
) you can get and set the
areas, fields and datasources with the resulting Engine
.You can save your newly created or your changes on existing report design as XML file and load them.
You can find a lot of samples in directory rdc of the sample directory.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
FOR INTERNAL USE ONLYstatic class
FOR INTERNAL USE ONLYstatic interface
FOR INTERNAL USE ONLYstatic interface
FOR INTERNAL USE ONLY -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
ABGR Color constant for 'aqua color'.static final int
ABGR Color constant for 'black color'.static final int
ABGR Color constant for 'blue color'.static final int
ABGR Color constant for 'brown color'.static final int
ABGR Color constant for 'fuchsia color'.static final int
ABGR Color constant for 'gray color'.static final int
ABGR Color constant for 'green color'.static final int
ABGR Color constant for 'lime color'.static final int
ABGR Color constant for 'maroon color'.static final int
ABGR Color constant for 'navy color'.static final int
ABGR Color constant for 'no color'.static final int
ABGR Color constant for 'olive color'.static final int
ABGR Color constant for 'pink color'.static final int
ABGR Color constant for 'purple color'.static final int
ABGR Color constant for 'red color'.static final int
ABGR Color constant for 'silver color'.static final int
ABGR Color constant for 'teal color'.static final int
ABGR Color constant for 'white color'.static final int
ABGR Color constant for 'yellow color'. -
Method Summary
Modifier and TypeMethodDescriptionstatic Engine
createEmptyEngine
(String export_fmt) Creates a new empty exportEngine
with a report and initialises new Areas (RH, PH, D, PF, RF) and new Sections (RH, PH, D, PF, RF) and set the export format.static Engine
createMailingLabel
(Engine eng, int labelWidth, int labelHeight, int labelHorizontalDistance, int labelVerticalDistance, boolean acrossThenDown, List<Field> fields) After creating a new Engine and setting a database connection you can use this method to create a report for mailing labels, where you have to specify the height and width for one label and the distance between labels (horizontal and vertical).static String
FOR INTERNAL USE ONLY Obfuscate this string so it is not immediately readable.static CertificateInfoFactory
Returns the certificate factory that is used to sign PDF documents created with i-net Clear Reports.static final Font
FOR INTERNAL USE ONLYstatic Engine
loadEngine
(File file) Reads the specified report template into a newly createdEngine
and returns this engine.
Thefile
parameter specifies the file or directory pathname from that the report template will be loaded.
If an error occurs while loading the report template, you can then use the methodEngine.getLoadExceptions()
to get all errors.
The format of the specified report template must be the i-net Clear Reports report file format.static Engine
loadEngine
(File file, String export_fmt) Reads the specified report template into a newly createdEngine
with the given export format and returns this engine.
Thefile
parameter specifies the file or directory pathname from that the report template will be loaded.
If an error occurs while loading the report template, you can then use the methodEngine.getLoadExceptions()
to get all errors.
The format of the specified report template must be the i-net Clear Reports report file format.static Engine
loadEngine
(URL reportURL, InputStream in, String exportFormat, Properties props) Reads an engine from the input stream into a newly created Engine with the given export format.static Engine
loadEngine
(Properties properties) FOR INTERNAL USE ONLYstatic void
saveEngine
(File file, Engine engine) Saves anEngine
as report template into a file.static void
saveEngine
(OutputStream out, Engine engine) Saves anEngine
as report template into an output stream.static void
saveEngineToDir
(File dir, Engine engine) Saves anEngine
as report template into a directory.static void
Sets the certificate factory that is used to sign PDF documents created with i-net Clear Reports.static void
setEngineParams
(Engine engine, Properties props, PropertiesChecker checker, Object req) FOR INTERNAL USE ONLYstatic int
Returns the ABGR value representing the color (i.e. 0x000000FF for red).
In general the alpha component is null, so the color space is a standard BGR color space.static Color
toJavaColor
(int abgr) Converts the ABGR color value (i.e. 0x000000FF for red) into a Java Color object.
-
Field Details
-
COLOR_AQUA
public static final int COLOR_AQUAABGR Color constant for 'aqua color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_BLACK
public static final int COLOR_BLACKABGR Color constant for 'black color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_BLUE
public static final int COLOR_BLUEABGR Color constant for 'blue color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_FUCHSIA
public static final int COLOR_FUCHSIAABGR Color constant for 'fuchsia color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_GRAY
public static final int COLOR_GRAYABGR Color constant for 'gray color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_GREEN
public static final int COLOR_GREENABGR Color constant for 'green color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_LIME
public static final int COLOR_LIMEABGR Color constant for 'lime color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_MAROON
public static final int COLOR_MAROONABGR Color constant for 'maroon color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_NAVY
public static final int COLOR_NAVYABGR Color constant for 'navy color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_NO_COLOR
public static final int COLOR_NO_COLORABGR Color constant for 'no color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_OLIVE
public static final int COLOR_OLIVEABGR Color constant for 'olive color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_PURPLE
public static final int COLOR_PURPLEABGR Color constant for 'purple color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_RED
public static final int COLOR_REDABGR Color constant for 'red color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_SILVER
public static final int COLOR_SILVERABGR Color constant for 'silver color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_TEAL
public static final int COLOR_TEALABGR Color constant for 'teal color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_WHITE
public static final int COLOR_WHITEABGR Color constant for 'white color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_YELLOW
public static final int COLOR_YELLOWABGR Color constant for 'yellow color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_PINK
public static final int COLOR_PINKABGR Color constant for 'pink color'. For use with set*Color Methods in RDC.- See Also:
-
COLOR_BROWN
public static final int COLOR_BROWNABGR Color constant for 'brown color'. For use with set*Color Methods in RDC.- See Also:
-
-
Method Details
-
createMailingLabel
public static Engine createMailingLabel(Engine eng, int labelWidth, int labelHeight, int labelHorizontalDistance, int labelVerticalDistance, boolean acrossThenDown, List<Field> fields) throws ReportException After creating a new Engine and setting a database connection you can use this method to create a report for mailing labels, where you have to specify the height and width for one label and the distance between labels (horizontal and vertical). The page will be filled with labels as much as it is possible until (across and down). The printing direction has two states: across than down, a row will be filled first and down than across, a column will be filled first.- Parameters:
eng
- TheEngine
that should be filled with mailing labelslabelWidth
- - the width of one single labellabelHeight
- - the height of one single labellabelHorizontalDistance
- - the horizontal distance between two labelslabelVerticalDistance
- - the vertical distance between two labelsacrossThenDown
- -true
if labels should be printed across page first, else if labels should printed down page first set tofalse
fields
- - a list containing references to all fields that should be used in each label. The height of each field in label depends on labelheight and count of fields in label.- Returns:
- A report for mailing labels
- Throws:
ReportException
- If an error occurs while trying to create areas and fields on the passed engine- Since:
- 6.0
-
getFont
FOR INTERNAL USE ONLY- Parameters:
name
- The name of the font.style
- The style for the font.size
- The size of the font.
-
createEmptyEngine
Creates a new empty exportEngine
with a report and initialises new Areas (RH, PH, D, PF, RF) and new Sections (RH, PH, D, PF, RF) and set the export format.- Parameters:
export_fmt
- The export format. The following values are valid:
pdf - PDF file
ps - PS file
ps2 - PS file (level 2)
ps3 - PS file (level 3)
rtf - RTF file
xls - XLS file
xml - XML file
csv - CSV file
htmBaseFileName - HTML file(s) (e.g. htmMyReport); The base file name is the file name of the first html page (e.g. MyReport.htm) and the base name of all other html files (e.g. MyReport1.htm, MyReport2.htm, ...). Each report page will be saved in a separate HTML file.- Returns:
- Standard, empty report engine with areas and sections initialized, and with the export format already set to the passed parameter.
- Since:
- 6.0
- See Also:
-
setEngineParams
public static void setEngineParams(Engine engine, Properties props, PropertiesChecker checker, Object req) throws ReportException FOR INTERNAL USE ONLY- Throws:
ReportException
-
saveEngine
Saves anEngine
as report template into a file. It must have been loaded from an xml or rpt file previously or initialized usingRDC
orEngine.setReportFile(String)
. Thefile
parameter specifies the file in that the report template will be stored.
You need to call this method before the call ofEngine.execute()
.
Security note: The password is not saved by default. You should setDatabaseTables.setSavePassword(boolean)
.- Parameters:
file
- The file to save the report to. If it is a directory then it will be saved as directory.engine
- TheEngine
which should be saved as a report template file.- Throws:
ReportException
- If there are problems while saving the engine, for example, if the engine has already been executed.- Since:
- 6.0
-
saveEngineToDir
Saves anEngine
as report template into a directory. It must have been loaded from an xml or rpt file previously or initialized usingRDC
orEngine.setReportFile(String)
. Thedir
parameter specifies the directory the report template will be stored. Ifdir
does not exists, it will be created.
You need to call this method before the call ofEngine.execute()
.
Security note: The password is not saved by default. You should setDatabaseTables.setSavePassword(boolean)
.- Parameters:
dir
- The direcotry file to save the report to.engine
- TheEngine
which should be saved as a report template file.- Throws:
ReportException
- If there are problems while saving the engine, for example, if the engine has already been executed.- Since:
- 9.1
-
saveEngine
Saves anEngine
as report template into an output stream. Theout
parameter specifies the stream the report template should be stored into.
You must call this method before the call ofEngine.execute()
.
Security note: The password is not saved by default. You should setDatabaseTables.setSavePassword(boolean)
.- Parameters:
out
- The output stream to save the report template.engine
- TheEngine
which should be saved as a report template.- Throws:
ReportException
- If there are problems while saving the engine, for example, if the engine has already been executed.IOException
- if there are problems writing to the stream- Since:
- 8.2
-
loadEngine
Reads the specified report template into a newly createdEngine
and returns this engine.
Thefile
parameter specifies the file or directory pathname from that the report template will be loaded.
If an error occurs while loading the report template, you can then use the methodEngine.getLoadExceptions()
to get all errors.
The format of the specified report template must be the i-net Clear Reports report file format. If your file is saved in binary format or if you do not know the file type of the report template (whether it is a binary format such as Crystal Reports or an i-net Clear Reports format), then useEngine.setReportFile(String)
instead. This method will detect the file format automatically.- Parameters:
file
- The report template file or directory pathname that should be loaded into a new engine.- Returns:
- The newly created
Engine
, initialized with the report template fromfile
. - Throws:
ReportException
- If the provided report template is a binary report template (e.g. from Crystal Reports) or another error occurred during loading the report.- Since:
- 6.0
- See Also:
-
loadEngine
public static Engine loadEngine(URL reportURL, InputStream in, String exportFormat, Properties props) throws ReportException, IOException Reads an engine from the input stream into a newly created Engine with the given export format.- Parameters:
reportURL
- URL to set as the engine's URL. SeeEngine.setReportFile(URL)
. May be null, in which case "file://" is set as the report's URL.in
- Reader to read data fromexportFormat
- The output format as string, must be one of the Engine "EXPORT" constants, e.g. Engine#NO_EXPORT for Java viewerprops
- Properties such as export_fmt or prompts- Returns:
- The newly created Engine with the export format as given in exportFormat.
- Throws:
ReportException
- if there are issues with the engineIOException
- if there are issues reading the InputStreamIllegalArgumentException
- if the stream is null- Since:
- 8.2
- See Also:
-
loadEngine
Reads the specified report template into a newly createdEngine
with the given export format and returns this engine.
Thefile
parameter specifies the file or directory pathname from that the report template will be loaded.
If an error occurs while loading the report template, you can then use the methodEngine.getLoadExceptions()
to get all errors.
The format of the specified report template must be the i-net Clear Reports report file format. If your file is saved in binary format or if you do not know the file type of the report template (whether it is a binary format such as Crystal Reports or an i-net Clear Reports format), then useEngine.setReportFile(String)
instead. This method will detect the file format automatically.- Parameters:
file
- The report template file or directory pathname that should be loaded into a new engine.export_fmt
- The output format given as String. Use this for export only.- Returns:
- The newly created
Engine
, initialized with the report template fromfile
. - Throws:
ReportException
- If the provided report template is a Crystal Reports report or another error occurred during loading the report.- Since:
- 6.0
- See Also:
-
Engine.NO_EXPORT
Engine.EXPORT_PDF
Engine.EXPORT_PS
Engine.EXPORT_PS2
Engine.EXPORT_PS3
Engine.EXPORT_RTF
Engine.EXPORT_XLS
Engine.EXPORT_XML
Engine.EXPORT_TXT
Engine.EXPORT_HTML
Engine.EXPORT_CSV
Engine.EXPORT_DATA
Engine.EXPORT_JSON
Engine.EXPORT_SVG
Engine.setReportFile(String)
saveEngine(File, Engine)
-
loadEngine
FOR INTERNAL USE ONLY- Throws:
ReportException
-
encrypt
FOR INTERNAL USE ONLY Obfuscate this string so it is not immediately readable. The obfuscated String may vary between two calls to this method.- Parameters:
value
- String to encrypt- Returns:
- Encrypted string
-
toJavaColor
Converts the ABGR color value (i.e. 0x000000FF for red) into a Java Color object. You can use the ABGR value or one of the color constants in this class RDC.
In general the alpha component is null, so the color space is a standard BGR color space. Only for NO_COLOR the alpha component is 255.
More information about the usage of colors in RDC can be found in the RDC documentation.- Parameters:
abgr
- the ABGR components of the color- Returns:
- Color object
- Since:
- 6.0
- See Also:
-
toCcColor
Returns the ABGR value representing the color (i.e. 0x000000FF for red).
In general the alpha component is null, so the color space is a standard BGR color space. Only for NO_COLOR the alpha component is 255.
More information about the usage of colors in RDC can be found in the RDC documentation.- Parameters:
color
- Color object- Returns:
- ABGR value representing the color
- Since:
- 6.0
- See Also:
-
setCertificateInfoFactory
Sets the certificate factory that is used to sign PDF documents created with i-net Clear Reports.- Parameters:
factory
- instance of certificate factory that will be used to get certificate info.- Since:
- 9.1
-
getCertificateFactory
Returns the certificate factory that is used to sign PDF documents created with i-net Clear Reports.- Returns:
- the certificate factory or null if no factory has been set.
- Since:
- 9.1
-