public void addReportFieldFormats(List<ReportFieldFormat> reportFieldFormats) { for (ReportFieldFormat reportFieldFormat : reportFieldFormats) { this.reportFieldFormats.put(reportFieldFormat.getName(), reportFieldFormat); } }
protected String getFormatString(String parameterName, String fullParameterName) { Map<String, ReportFieldFormat> formats = rootBand.getReportFieldFormats(); String formatString = null; if (formats != null) { if (formats.containsKey(fullParameterName)) { formatString = formats.get(fullParameterName).getFormat(); } else if (formats.containsKey(parameterName)) { formatString = formats.get(parameterName).getFormat(); } } return formatString; }
protected void writeValueFormats(Report report, Element root) { Element reportTemplatesElement = root.addElement("formats"); for (ReportFieldFormat reportFieldFormat : report.getReportFieldFormats()) { Element reportTemplateElement = reportTemplatesElement.addElement("format"); reportTemplateElement.addAttribute("name", reportFieldFormat.getName()); reportTemplateElement.addAttribute("format", reportFieldFormat.getFormat()); } }
protected void writeValueFormats(Report report, Element root) { Element reportTemplatesElement = root.addElement("formats"); for (ReportFieldFormat reportFieldFormat : report.getReportFieldFormats()) { Element reportTemplateElement = reportTemplatesElement.addElement("format"); reportTemplateElement.addAttribute("name", reportFieldFormat.getName()); reportTemplateElement.addAttribute("format", reportFieldFormat.getFormat()); } }
public void addReportFieldFormats(List<ReportFieldFormat> reportFieldFormats) { for (ReportFieldFormat reportFieldFormat : reportFieldFormats) { this.reportFieldFormats.put(reportFieldFormat.getName(), reportFieldFormat); } }
protected String getFormatString(String parameterName, String fullParameterName) { Map<String, ReportFieldFormat> formats = rootBand.getReportFieldFormats(); String formatString = null; if (formats != null) { if (formats.containsKey(fullParameterName)) { formatString = formats.get(fullParameterName).getFormat(); } else if (formats.containsKey(parameterName)) { formatString = formats.get(parameterName).getFormat(); } } return formatString; }
protected boolean tryToApplyInliners(String fullParameterName, Object paramValue, Text text) { Map<String, ReportFieldFormat> valueFormats = rootBand.getReportFieldFormats(); if (paramValue != null && valueFormats != null && valueFormats.containsKey(fullParameterName)) { String format = valueFormats.get(fullParameterName).getFormat(); for (ContentInliner contentInliner : DocxFormatter.this.contentInliners) { Matcher contentMatcher = contentInliner.getTagPattern().matcher(format); if (contentMatcher.find()) { contentInliner.inlineToDocx(wordprocessingMLPackage, text, paramValue, contentMatcher); return true; } } } return false; }
protected boolean tryToApplyInliners(String fullParameterName, Object paramValue, Text text) { Map<String, ReportFieldFormat> valueFormats = rootBand.getReportFieldFormats(); if (paramValue != null && valueFormats != null && valueFormats.containsKey(fullParameterName)) { String format = valueFormats.get(fullParameterName).getFormat(); for (ContentInliner contentInliner : DocxFormatter.this.contentInliners) { Matcher contentMatcher = contentInliner.getTagPattern().matcher(format); if (contentMatcher.find()) { contentInliner.inlineToDocx(wordprocessingMLPackage, text, paramValue, contentMatcher); return true; } } } return false; }
protected void insertValue(XText text, XTextRange textRange, BandData band, String parameterName) { checkThreadInterrupted(); String fullParameterName = band.getName() + "." + parameterName; Object paramValue = band.getParameterValue(parameterName); Map<String, ReportFieldFormat> formats = rootBand.getReportFieldFormats(); try { boolean handled = false; if (paramValue != null) { if ((formats != null) && (formats.containsKey(fullParameterName))) { String format = formats.get(fullParameterName).getFormat(); // Handle doctags for (ContentInliner contentInliner : contentInliners) { Matcher matcher = contentInliner.getTagPattern().matcher(format); if (matcher.find()) { contentInliner.inlineToDoc(officeComponent, textRange, text, paramValue, matcher); handled = true; } } } if (!handled) { String valueString = formatValue(paramValue, parameterName, fullParameterName); text.insertString(textRange, valueString, true); } } else { text.insertString(textRange, "", true); } } catch (Exception ex) { throw wrapWithReportingException(String.format("An error occurred while inserting parameter [%s] into text line [%s]", parameterName, text.getString()), ex); } }
protected void insertValue(XText text, XTextRange textRange, BandData band, String parameterName) { checkThreadInterrupted(); String fullParameterName = band.getName() + "." + parameterName; Object paramValue = band.getParameterValue(parameterName); Map<String, ReportFieldFormat> formats = rootBand.getReportFieldFormats(); try { boolean handled = false; if (paramValue != null) { if ((formats != null) && (formats.containsKey(fullParameterName))) { String format = formats.get(fullParameterName).getFormat(); // Handle doctags for (ContentInliner contentInliner : contentInliners) { Matcher matcher = contentInliner.getTagPattern().matcher(format); if (matcher.find()) { contentInliner.inlineToDoc(officeComponent, textRange, text, paramValue, matcher); handled = true; } } } if (!handled) { String valueString = formatValue(paramValue, parameterName, fullParameterName); text.insertString(textRange, valueString, true); } } else { text.insertString(textRange, "", true); } } catch (Exception ex) { throw wrapWithReportingException(String.format("An error occurred while inserting parameter [%s] into text line [%s]", parameterName, text.getString()), ex); } }