final ResourceManager mgr = new ResourceManager();
final Resource resource = mgr.createDirectly(in, MasterReport.class);
final MasterReport report = (MasterReport) resource.getResource();
report.getReportConfiguration().setConfigProperty
("org.pentaho.reporting.engine.classic.core.AllowOwnPeerForComponentDrawable", "true");
final PaintComponentTableModel tableModel = new PaintComponentTableModel();
tableModel.addComponent(frame);
report.setDataFactory(new TableDataFactory("default", tableModel));
// Important: The dialog must be modal, so that we know, when the report
// processing is finished.
final PreviewDialog previewDialog = new PreviewDialog(report, this, true);