class BrowseJasperDataSource extends java.lang.Object implements JasperDataSource
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,java.lang.String> |
attributeMapping
Map of the names of jasper report fields representing cell attributes (like
"column33.fontName") to default values of these attributes for specific column.
|
private static java.util.Set<java.lang.String> |
availableJavaFontFamilies
Font families available for JVM.
|
private BrowseWidget |
browse
Browse which provides data for the report.
|
private int |
browseRowIndex
Index of the current browse row in
browseRows while iterating the data set. |
private BrowseRow[] |
browseRows
Browse rows which represent the report data.
|
private java.util.Map<java.lang.String,java.lang.Integer> |
fieldMapping
Map of the names of jasper report fields representing cell data (like "column33") to browse
column ordinals (0-based).
|
| Constructor and Description |
|---|
BrowseJasperDataSource(BrowseWidget browse)
Constructs a data source object for the given browse.
|
| Modifier and Type | Method and Description |
|---|---|
handle |
asProgressObject()
Get underlying 4GL browse object which provides data for the report.
|
private boolean |
buildFieldMapping(net.sf.jasperreports.engine.JasperReport report)
Build and store field mapping (Jasper report field names to 1-based browse column index) for
the given report.
|
(package private) static FontDetails |
getColumnFont(BrowseColumnWidget column,
boolean label)
Get effective column font.
|
private int |
getColumnOrdinal(java.lang.String fieldName)
Get 0-based ordinal of the browse column referenced by the given field.
|
(package private) static java.lang.String |
getElementColor(BrowseWidget browse,
EnhancedColor ehColumnColor,
int columnColor,
EnhancedColor ehBrowseColor,
int browseColor)
Get color of the browse element following general color application rules.
|
private static FontDetails |
getElementFont(FontDetails ehColumnFont,
int columnFont,
FontDetails ehBrowseFont,
int browseFont)
Get font of the browse element following general font application rules.
|
java.lang.Object |
getFieldValue(net.sf.jasperreports.engine.JRField field)
Gets the field value for the current position.
|
private static java.lang.String |
getJasperColor(ColorRgb color)
Get string representation of the color in Jasper report format.
|
net.sf.jasperreports.engine.JasperReport |
getReport(java.lang.String designTemplateFileName)
Get compiled Jasper report for the given report template design file.
|
private static ColorRgb |
getTableColor(BrowseWidget browse,
int colorIndex)
Get color at the specified index in the system color table.
|
(package private) static boolean |
isFontFamilyAvailable(FontDetails font)
Checks is the given font available for the JVM.
|
boolean |
next()
Tries to position the cursor on the next element in the data source.
|
private boolean |
putAttributeValue(java.lang.String fieldName)
Put the default column-specific value of the corresponding attribute into
attributeMapping map. |
void |
reportFinished(boolean error)
Executed after report was filled from the data source.
|
boolean |
reportStarted(net.sf.jasperreports.engine.JasperReport report)
Executed before report is filled from the data source.
|
private static ColorRgb |
resolveEnhancedColor(BrowseWidget browse,
EnhancedColor enhancedColor)
Return RGB color defined by the enhanced color.
|
private static final java.util.Set<java.lang.String> availableJavaFontFamilies
private final BrowseWidget browse
private java.util.Map<java.lang.String,java.lang.Integer> fieldMapping
private java.util.Map<java.lang.String,java.lang.String> attributeMapping
private BrowseRow[] browseRows
private int browseRowIndex
browseRows while iterating the data set.BrowseJasperDataSource(BrowseWidget browse)
browse - Underlying browse.public net.sf.jasperreports.engine.JasperReport getReport(java.lang.String designTemplateFileName)
getReport in interface JasperDataSourcedesignTemplateFileName - File name of the Jasper report design template file.public boolean reportStarted(net.sf.jasperreports.engine.JasperReport report)
reportStarted in interface JasperDataSourcereport - Jasper report to be filled.true on success, false if the data source cannot provide
data.public void reportFinished(boolean error)
reportFinished in interface JasperDataSourceerror - true if there were problems while getting data from the data source.
false on success,public handle asProgressObject()
asProgressObject in interface JasperDataSourcepublic boolean next()
throws net.sf.jasperreports.engine.JRException
next in interface net.sf.jasperreports.engine.JRDataSourcetrue if there is a next record, false otherwise.net.sf.jasperreports.engine.JRException - if any error occurs while trying to move to the next element.public java.lang.Object getFieldValue(net.sf.jasperreports.engine.JRField field)
throws net.sf.jasperreports.engine.JRException
getFieldValue in interface net.sf.jasperreports.engine.JRDataSourcefield - Field to get.net.sf.jasperreports.engine.JRException - if any error occurs while trying to get the field value.static boolean isFontFamilyAvailable(FontDetails font)
font - Font to check.true if the given font available for the JVM.static java.lang.String getElementColor(BrowseWidget browse, EnhancedColor ehColumnColor, int columnColor, EnhancedColor ehBrowseColor, int browseColor)
browse - Parent browse.ehColumnColor - Enhanced column-specific color.columnColor - Column-specific color.ehBrowseColor - Enhanced browse-specific color.browseColor - Browse-specific color.static FontDetails getColumnFont(BrowseColumnWidget column, boolean label)
column - Browse column.label - true for label font, false for cells font.private static java.lang.String getJasperColor(ColorRgb color)
color - Color.private static ColorRgb resolveEnhancedColor(BrowseWidget browse, EnhancedColor enhancedColor)
browse - Parent browse of the element which color is resolved.enhancedColor - Enhanced color. Can be null.private static ColorRgb getTableColor(BrowseWidget browse, int colorIndex)
browse - Parent browse of the element which color is resolved.colorIndex - Index of the color.private static FontDetails getElementFont(FontDetails ehColumnFont, int columnFont, FontDetails ehBrowseFont, int browseFont)
ehColumnFont - Enhanced column-specific font.columnFont - Column-specific font.ehBrowseFont - Enhanced browse-specific font.browseFont - Browse-specific font.private boolean buildFieldMapping(net.sf.jasperreports.engine.JasperReport report)
report - Jasper report for which we need to build a field mapping.true on success.private int getColumnOrdinal(java.lang.String fieldName)
fieldName - Name of the field.private boolean putAttributeValue(java.lang.String fieldName)
attributeMapping map.fieldName - Name of the report field representing the specific attribute of the specific column
(like "column33.fontName").true of success. false if the field name is invalid.