protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { PdfOutputProcessor outputProcessor = new PdfOutputProcessor( report.getConfiguration(), fout, report.getResourceManager() ); return new PageableReportProcessor( report, outputProcessor ); } };
protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { StreamRTFOutputProcessor target = new StreamRTFOutputProcessor( report.getConfiguration(), fout, report.getResourceManager() ); return new StreamReportProcessor( report, target ); } };
protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { ReportStructureValidator validator = new ReportStructureValidator(); if ( validator.isValidForFastProcessing( report ) == false ) { final FlowExcelOutputProcessor target = new FlowExcelOutputProcessor( report.getConfiguration(), fout, report.getResourceManager() ); target.setUseXlsxFormat( false ); return new FlowReportProcessor( report, target ); } else { return new FastExcelExportProcessor( report, fout, false ); } } };
report = new MasterReport(); TableDataFactory dataFactory = new TableDataFactory( "default", transMetaTableModel ); report.setDataFactory( dataFactory ); ReportHeader reportHeader = new ReportHeader(); report.setReportHeader( reportHeader ); ReportFooter reportFooter = new ReportFooter(); report.setReportFooter( reportFooter ); RelationalGroup group = new RelationalGroup(); group.addField( "filename" ); GroupDataBody groupData = new GroupDataBody(); ItemBand itemBand = new ItemBand(); itemBand.setVisible( true ); itemBand.setLayout( BandStyleKeys.LAYOUT_AUTO ); groupData.setItemBand( itemBand ); group.setBody( groupData ); report.setRootGroup( group ); reportHeader.getStyle().setStyleProperty( TextStyleKeys.BOLD, true ); + Const.CR + " return new " + TransJobDrawable.class.getName() + "(dataRow, " + ( options.getOutputType() == OutputType.PDF ? "true" : "false" ) + ");" + Const.CR + "}"; BSHExpression bshExpression = new BSHExpression(); bshExpression.setExpression( bshCode ); bshExpression.setName( "getImage" ); report.addExpression( bshExpression );
ItemBand rowBand = new ItemBand(); rowBand.setLayout( BandStyleKeys.LAYOUT_ROW ); LabelElementFactory labelElementFactory = new LabelElementFactory(); labelElementFactory.setText( labelText ); labelElementFactory.setAbsolutePosition( new Point( 0, pagePosition ) ); labelElementFactory.setMinimumWidth( (float) labelWidth ); labelElementFactory.setMinimumHeight( fontHeight ); labelElementFactory.setUnderline( labelUnderline ); labelElementFactory.setBold( labelBold ); labelElementFactory.setItalic( labelItalic ); labelElementFactory.setDynamicHeight( true ); Element label = labelElementFactory.createElement(); rowBand.addElement( label ); TextFieldElementFactory textFactory = new TextFieldElementFactory(); textFactory.setFieldname( fieldName ); textFactory.setAbsolutePosition( new Point( labelWidth, pagePosition ) ); textFactory.setMinimumWidth( (float) textWidth ); textFactory.setMinimumHeight( fontHeight ); textFactory.setOverflowY( false ); textFactory.setDynamicHeight( true ); Element element = textFactory.createElement(); element.setDynamicContent( true ); rowBand.addElement( element ); details.addElement( rowBand );
protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { ReportStructureValidator validator = new ReportStructureValidator(); if ( validator.isValidForFastProcessing( report ) == false ) { final HtmlOutputProcessor outputProcessor = new StreamHtmlOutputProcessor( report.getConfiguration() ); final HtmlPrinter printer = new AllItemsHtmlPrinter( report.getResourceManager() ); printer.setContentWriter( targetRoot, new DefaultNameGenerator( targetRoot, filename, suffix ) ); printer.setDataWriter( null, null ); // $NON-NLS-1$ printer.setUrlRewriter( new FileSystemURLRewriter() ); outputProcessor.setPrinter( printer ); return new StreamReportProcessor( report, outputProcessor ); } else { FastHtmlContentItems printer = new FastHtmlContentItems(); printer.setContentWriter( targetRoot, new DefaultNameGenerator( targetRoot, filename, suffix ) ); printer.setDataWriter( null, null ); // $NON-NLS-1$ printer.setUrlRewriter( new FileSystemURLRewriter() ); return new FastHtmlExportProcessor( report, printer ); } } };
protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { final FlowHtmlOutputProcessor outputProcessor = new FlowHtmlOutputProcessor(); final HtmlPrinter printer = new AllItemsHtmlPrinter( report.getResourceManager() ); printer.setContentWriter( targetRoot, new DefaultNameGenerator( targetRoot, filename, suffix ) ); printer.setDataWriter( targetRoot, new DefaultNameGenerator( targetRoot, "content" ) ); printer.setUrlRewriter( new FileSystemURLRewriter() ); outputProcessor.setPrinter( printer ); return new FlowReportProcessor( report, outputProcessor ); } };
public static void performPentahoReportingBoot( LogChannelInterface log, Class<?> referenceClass ) { // Boot the Pentaho reporting engine! // if ( ClassicEngineBoot.getInstance().isBootDone() == false ) { ObjectUtilities.setClassLoader( referenceClass.getClassLoader() ); ObjectUtilities.setClassLoaderSource( ObjectUtilities.CLASS_CONTEXT ); LibLoaderBoot.getInstance().start(); LibFontBoot.getInstance().start(); ClassicEngineBoot.getInstance().start(); Exception exception = ClassicEngineBoot.getInstance().getBootFailureReason(); if ( exception != null ) { log.logError( "Error booting the Pentaho reporting engine", exception ); } } }
ReportParameterDefinition definition = report.getParameterDefinition(); RowMetaInterface r = new RowMeta(); for ( int i = 0; i < definition.getParameterCount(); i++ ) { ParameterDefinitionEntry entry = definition.getParameterDefinition( i ); ValueMetaInterface valueMeta = new ValueMetaString( entry.getName() ); valueMeta.setComments( getParameterDefinitionEntryTypeDescription( entry ) ); r.addValueMeta( valueMeta );
@Test public void testExportReportWithSupportedLocale() { when( masterReport.getConfiguration() ).thenReturn( mock( Configuration.class ) ); when( masterReport.getResourceManager() ).thenReturn( new ResourceManager() ); when( swingGuiContext.getLocale() ).thenReturn( Locale.US ); when( swingGuiContext.getStatusListener() ).thenReturn( mock( StatusListener.class ) ); Runnable exportTask = new ReportExportTask( masterReport, swingGuiContext, targetPath, createParentFolder ) { protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { PdfOutputProcessor outputProcessor = new PdfOutputProcessor( masterReport.getConfiguration(), fout, masterReport.getResourceManager() ); return new PageableReportProcessor( masterReport, outputProcessor ); } }; assertNotNull( exportTask ); exportTask.run(); assertThat( swingGuiContext.getStatusType(), not( StatusType.ERROR ) ); }
if ( ClassicEngineBoot.getInstance().isBootDone() == false ) { ClassicEngineBoot.getInstance().start();
ReportParameterValues values = report.getParameterValues(); ReportParameterDefinition definition = report.getParameterDefinition(); values.put( parameterName, value );
/** * When an object implementing interface <code>Runnable</code> is used to create a thread, starting the thread causes * the object's <code>run</code> method to be called in that separately executing thread. * <p/> * The general contract of the method <code>run</code> is that it may take any action whatsoever. * * @see Thread#run() */ public void run() { try { targetFile = KettleVFS.getFileObject( targetPath ); if ( targetFile.exists() ) { if ( !targetFile.delete() ) { throw new ReportProcessingException( messages.getErrorString( "ReportExportTask.ERROR_0001_TARGET_EXISTS" ) ); //$NON-NLS-1$ } } if ( createParentFolder ) { targetFile.getParent().createFolder(); } execute(); } catch ( Exception ex ) { statusListener.setStatus( StatusType.ERROR, messages.getString( "ReportExportTask.USER_EXPORT_FAILED" ), ex ); //$NON-NLS-1$ logger.error( "Failed" ); //$NON-NLS-1$ } }
public CrosstabRowGroup clone() { final CrosstabRowGroup element = (CrosstabRowGroup) super.clone(); element.summaryHeader = (CrosstabSummaryHeader) summaryHeader.clone(); element.titleHeader = (CrosstabTitleHeader) titleHeader.clone(); element.header = (CrosstabHeader) header.clone(); element.registerAsChild( element.titleHeader ); element.registerAsChild( element.header ); element.registerAsChild( element.summaryHeader ); return element; }
public CrosstabColumnGroup derive( final boolean preserveElementInstanceIds ) { final CrosstabColumnGroup element = (CrosstabColumnGroup) super.derive( preserveElementInstanceIds ); element.titleHeader = (CrosstabTitleHeader) titleHeader.derive( preserveElementInstanceIds ); element.header = (CrosstabHeader) header.derive( preserveElementInstanceIds ); element.summaryHeader = (CrosstabSummaryHeader) summaryHeader.derive( preserveElementInstanceIds ); element.registerAsChild( element.titleHeader ); element.registerAsChild( element.header ); element.registerAsChild( element.summaryHeader ); return element; }
@Override public void draw( Graphics2D graphics2D, Rectangle2D rectangle2D ) { try { ReportSubjectLocation location = (ReportSubjectLocation) dataRow.get( "location" ); if ( location.isTransformation() ) { TransformationInformation ti = TransformationInformation.getInstance(); ti.drawImage( graphics2D, rectangle2D, location, pixelateImages ); } else { JobInformation ji = JobInformation.getInstance(); ji.drawImage( graphics2D, rectangle2D, location, pixelateImages ); } } catch ( Exception e ) { throw new RuntimeException( "Unable to draw image onto report", e ); } }
protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { ReportStructureValidator validator = new ReportStructureValidator(); if ( validator.isValidForFastProcessing( report ) == false ) { final FlowExcelOutputProcessor target = new FlowExcelOutputProcessor( report.getConfiguration(), fout, report.getResourceManager() ); target.setUseXlsxFormat( true ); return new FlowReportProcessor( report, target ); } else { return new FastExcelExportProcessor( report, fout, true ); } } };
protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { PdfOutputProcessor outputProcessor = new PdfOutputProcessor( masterReport.getConfiguration(), fout, masterReport.getResourceManager() ); return new PageableReportProcessor( masterReport, outputProcessor ); } };
@Test public void testExportReportWithUnsupportedLocale() { when( masterReport.getConfiguration() ).thenReturn( mock( Configuration.class ) ); when( masterReport.getResourceManager() ).thenReturn( new ResourceManager() ); when( swingGuiContext.getLocale() ).thenReturn( Locale.UK ); when( swingGuiContext.getStatusListener() ).thenReturn( mock( StatusListener.class ) ); Runnable exportTask = new ReportExportTask( masterReport, swingGuiContext, targetPath, createParentFolder ) { protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { PdfOutputProcessor outputProcessor = new PdfOutputProcessor( masterReport.getConfiguration(), fout, masterReport.getResourceManager() ); return new PageableReportProcessor( masterReport, outputProcessor ); } }; assertNotNull( exportTask ); exportTask.run(); assertThat( swingGuiContext.getStatusType(), not( StatusType.ERROR ) ); } }
protected ReportProcessor createReportProcessor( OutputStream fout ) throws Exception { PdfOutputProcessor outputProcessor = new PdfOutputProcessor( masterReport.getConfiguration(), fout, masterReport.getResourceManager() ); return new PageableReportProcessor( masterReport, outputProcessor ); } };