public MasterReport derive( final boolean preserveElementInstanceIds ) { final MasterReport report = (MasterReport) super.derive( preserveElementInstanceIds ); report.reportConfiguration = (HierarchicalConfiguration) reportConfiguration.clone(); report.reportEnvironment = (ReportEnvironment) reportEnvironment.clone(); if ( report.reportEnvironment instanceof DefaultReportEnvironment ) { // this is a ugly hack. Needs to be addressed in Sugar final DefaultReportEnvironment dre = (DefaultReportEnvironment) report.reportEnvironment; dre.update( report.reportConfiguration ); } report.parameterDefinition = (ReportParameterDefinition) parameterDefinition.clone(); report.parameterValues = (ReportParameterValues) parameterValues.clone(); report.dataFactory = dataFactory.derive(); // Add a listener that will handle keeping the ResourceManager in sync with changes to the Document Bundle report.addReportModelListener( new DocumentBundleChangeHandler() ); report.addReportModelListener( new ResourceBundleChangeHandler() ); return report; }
/** * Clones the report. * * @return the clone. */ public MasterReport clone() { final MasterReport report = (MasterReport) super.clone(); report.reportConfiguration = (HierarchicalConfiguration) reportConfiguration.clone(); report.reportEnvironment = (ReportEnvironment) reportEnvironment.clone(); if ( report.reportEnvironment instanceof DefaultReportEnvironment ) { // this is a ugly hack. Needs to be addressed in Sugar final DefaultReportEnvironment dre = (DefaultReportEnvironment) report.reportEnvironment; dre.update( report.reportConfiguration ); } report.parameterDefinition = (ReportParameterDefinition) parameterDefinition.clone(); report.parameterValues = (ReportParameterValues) parameterValues.clone(); report.dataFactory = dataFactory.derive(); // Add a listener that will handle keeping the ResourceManager in sync with changes to the Document Bundle report.addReportModelListener( new DocumentBundleChangeHandler() ); report.addReportModelListener( new ResourceBundleChangeHandler() ); return report; }
addReportModelListener( new DocumentBundleChangeHandler() );
/** * The default constructor. Creates an empty but fully initialized report. */ public MasterReport() { setElementType( new MasterReportType() ); setResourceBundleFactory( new LibLoaderResourceBundleFactory() ); this.reportConfiguration = new HierarchicalConfiguration( ClassicEngineBoot.getInstance().getGlobalConfig() ); this.parameterValues = new ReportParameterValues(); setPageDefinition( null ); final TableDataFactory dataFactory = new TableDataFactory(); dataFactory.addTable( "default", new DefaultTableModel() ); this.dataFactory = dataFactory; setQuery( "default" ); // Add a listener that will handle keeping the ResourceManager in sync with changes to the Document Bundle addReportModelListener( new DocumentBundleChangeHandler() ); this.reportEnvironment = new DefaultReportEnvironment( getConfiguration() ); this.parameterDefinition = new DefaultParameterDefinition(); final MemoryDocumentBundle documentBundle = new MemoryDocumentBundle(); documentBundle.getWriteableDocumentMetaData().setBundleType( ClassicEngineBoot.BUNDLE_TYPE ); documentBundle.getWriteableDocumentMetaData().setBundleAttribute( ODFMetaAttributeNames.Meta.NAMESPACE, ODFMetaAttributeNames.Meta.CREATION_DATE, new Date() ); setBundle( documentBundle ); setContentBase( documentBundle.getBundleMainKey() ); addReportModelListener( new ResourceBundleChangeHandler() ); updateResourceBundleFactoryInternal(); }