Skip to content

Commit

Permalink
pass chartImagePath to lower levels
Browse files Browse the repository at this point in the history
  • Loading branch information
dpmihai committed Feb 29, 2016
1 parent 0b98a08 commit d96d7cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/ro/nextreports/engine/exporter/ExporterBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class ExporterBean {
private String language;
// should we put raw data inside table (and use renderer to show formatted data) or we should put formatted data
private boolean reportTableExporterRawData;
private String imageChartPath;

public ExporterBean(Connection con, int queryTimeout, QueryResult result,
OutputStream out, ReportLayout reportLayout, ParametersBean pBean,
Expand Down Expand Up @@ -162,6 +163,14 @@ public boolean isReportTableExporterRawData() {

public void setReportTableExporterRawData(boolean reportTableExporterRawData) {
this.reportTableExporterRawData = reportTableExporterRawData;
}

public String getImageChartPath() {
return imageChartPath;
}

public void setImageChartPath(String imageChartPath) {
this.imageChartPath = imageChartPath;
}

@Override
Expand Down
11 changes: 8 additions & 3 deletions src/ro/nextreports/engine/exporter/ResultExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1856,8 +1856,12 @@ private void generateChartImage(ChartBandElement bandElement) {
}
}

runner.setParameterValues(bean.getParametersBean().getParamValues());
runner.setImagePath(imageChartPath);
runner.setParameterValues(bean.getParametersBean().getParamValues());
String localPath = imageChartPath;
if (localPath == null) {
localPath = bean.getImageChartPath();
}
runner.setImagePath(localPath);
I18nLanguage lang = I18nUtil.getLanguageByName(bean.getReportLayout(), bean.getLanguage());
if (lang != null) {
runner.setLanguage(lang.getName());
Expand All @@ -1870,7 +1874,7 @@ private void generateChartImage(ChartBandElement bandElement) {
runner.run();
image = runner.getChartImageName();
bandElement.setImage(image);
} catch (Exception e) {
} catch (Exception e) {
// if there is an exception we must reset image name (not generated) on band element
// otherwise the last one generated will be used, which is false!
bandElement.setImage("not_generated");
Expand Down Expand Up @@ -2050,6 +2054,7 @@ protected ExporterBean getSubreportExporterBean(Report subreport, boolean rowCou
boolean isProcedure = QueryUtil.isProcedureCall(sql);
ExporterBean eb = new ExporterBean(bean.getConnection(), bean.getQueryTimeout(), queryResult, bean.getOut(),
subreport.getLayout(), bean.getParametersBean(), subreport.getBaseName(), false, isProcedure);
eb.setImageChartPath(imageChartPath);
eb.setSubreport(true);
return eb;
} finally {
Expand Down

0 comments on commit d96d7cd

Please sign in to comment.