/** * Returns the current value for the data source. * * @param runtime the expression runtime that is used to evaluate formulas and expressions when * computing the value of this filter. * @param element * @return the value. */ public Object getValue(final ExpressionRuntime runtime, final ReportElement element) { if (runtime == null) { return null; } final String resourceId; if (resourceIdentifier != null) { resourceId = resourceIdentifier; } else { resourceId = runtime .getConfiguration() .getConfigProperty(ResourceBundleFactory.DEFAULT_RESOURCE_BUNDLE_CONFIG_KEY); } if (resourceId == null) { return null; } try { final ResourceBundleFactory resourceBundleFactory = runtime.getResourceBundleFactory(); final ResourceBundle bundle = resourceBundleFactory.getResourceBundle(resourceId); // update the format string, if neccessary ... if (ObjectUtilities.equal(formatKey, appliedFormatKey) == false) { final String newFormatString = bundle.getString(formatKey); messageFormatSupport.setFormatString(newFormatString); appliedFormatKey = formatKey; } messageFormatSupport.setLocale(resourceBundleFactory.getLocale()); return messageFormatSupport.performFormat(runtime.getDataRow()); } catch (MissingResourceException mre) { if (logger.isDebugEnabled()) { logger.debug( "Failed to format the value for resource-id " + resourceId + ", was '" + mre.getMessage() + "'"); } return null; } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Failed to format the value for resource-id " + resourceId, e); } return null; } }
protected FormattedDataBuilder createTemplate(final Band band, final ExpressionRuntime runtime) throws ReportProcessingException, ContentProcessingException { FastExportTemplateProducer templateListener = createTemplateProducer(); final OutputProcessor op = new TemplatingOutputProcessor( runtime.getProcessingContext().getOutputProcessorMetaData(), templateListener); FastSheetLayoutProducer.performLayout(band, runtime, op); return templateListener.createDataBuilder(); }
public void initialize( final ReportDefinition report, final ExpressionRuntime runtime, final boolean pagination) { metaData = runtime.getProcessingContext().getOutputProcessorMetaData(); }