Java Code Examples for org.pentaho.reporting.engine.classic.core.MasterReport#setRootGroup()

The following examples show how to use org.pentaho.reporting.engine.classic.core.MasterReport#setRootGroup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Prd4069IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
private MasterReport createTestReport() {
  final PerformanceTestSequence sequence = new PerformanceTestSequence();
  sequence.setParameter( "seed", 999L );
  sequence.setParameter( "limit", 20000 );

  final SequenceDataFactory sdf = new SequenceDataFactory();
  sdf.addSequence( "query", sequence );

  // use HTML export for test
  final MasterReport report = new MasterReport();
  report.setPageDefinition( new SimplePageDefinition( new PageSize( 800, 300 ) ) );
  report.setDataFactory( sdf );
  report.setQuery( "query" );

  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );
  final RelationalReportBuilder builder = new RelationalReportBuilder( dataSchemaModel );
  builder.addDetails( "text", null, null );

  report.setRootGroup( builder.create() );
  return report;
}
 
Example 2
Source File: CrosstabDataIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testDiagonalReportProcessing() throws Exception {
  final TypedTableModel model = new TypedTableModel( new String[] { "Rows", "Cols", "Data" } );
  model.addRow( "R0", "C0", 1 );
  model.addRow( "R1", "C1", 2 );
  model.addRow( "R2", "C2", 3 );
  model.addRow( "R3", "C3", 4 );

  final MasterReport report = new MasterReport();
  report.setQuery( "default" );
  report.setDataFactory( new TableDataFactory( "default", model ) );
  report.setRootGroup( createCrosstab() );
  report.addExpression( new ValidateExpression( false ) );

  DebugReportRunner.showDialog( report );
  DebugReportRunner.layoutPage( report, 0 );
}
 
Example 3
Source File: CrosstabDataIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testDiagonalReverseReportProcessing() throws Exception {
  final TypedTableModel model = new TypedTableModel( new String[] { "Rows", "Cols", "Data" } );
  model.addRow( "R0", "C3", 4 );
  model.addRow( "R1", "C2", 3 );
  model.addRow( "R2", "C1", 2 );
  model.addRow( "R3", "C0", 1 );

  final MasterReport report = new MasterReport();
  report.setQuery( "default" );
  report.setDataFactory( new TableDataFactory( "default", model ) );
  report.setRootGroup( createCrosstab() );
  report.addExpression( new ValidateExpression( true ) );

  DebugReportRunner.showDialog( report );
  DebugReportRunner.layoutPage( report, 0 );
}
 
Example 4
Source File: CrosstabMultiFactDataIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testDiagonalReportProcessing() throws ReportProcessingException {
  final TypedTableModel model = createTestData();

  final MasterReport report = new MasterReport();
  report.setQuery( "default" );
  report.setDataFactory( new TableDataFactory( "default", model ) );
  report.setRootGroup( createCrosstab() );
  report.addExpression( new ValidateExpression() );

  // DebugReportRunner.execGraphics2D(report);

  PrintReportProcessor rp = new PrintReportProcessor( report );
  final int nop = rp.getNumberOfPages();
  for ( int page = 0; page < nop; page += 1 ) {
    final PhysicalPageDrawable pageDrawable = (PhysicalPageDrawable) rp.getPageDrawable( page );
    LogicalPageBox logicalPageBox = pageDrawable.getPageDrawable().getLogicalPageBox();
    // ModelPrinter.print(logicalPageBox);
  }
}
 
Example 5
Source File: TotalPageFunctionsIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
private MasterReport createRelationalReport( final TableModel tableModel, final Class aggFun ) {
  final MasterReport report = new MasterReport();
  report.setPageDefinition( new SimplePageDefinition( new PageSize( 800, 300 ) ) );
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );

  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );
  final RelationalReportBuilder builder = new RelationalReportBuilder( dataSchemaModel );
  builder.addGroup( ROW_DIMENSION_A );
  builder.addGroup( ROW_DIMENSION_B );
  builder.addDetails( VALUE, aggFun, VALUE_BACKGROUND );
  builder.addDetails( "row-a-sum", null, ROWA_BACKGROUND );
  builder.addDetails( "#row-a-sum", null, ROWA_VALIDATE_BACKGROUND );
  builder.addDetails( "row-b-sum", null, ROWB_BACKGROUND );
  builder.addDetails( "#row-b-sum", null, ROWB_VALIDATE_BACKGROUND );
  builder.addDetails( "no-group", null, ROWC_BACKGROUND );
  builder.addDetails( "#no-group", null, ROWC_VALIDATE_BACKGROUND );

  report.setRootGroup( builder.create() );

  return report;
}
 
Example 6
Source File: EditCrosstabActionTest.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testSelectionOnCrosstabGroup() {
  WorkspaceSettings.getInstance().setExperimentalFeaturesVisible( true );

  final MasterReport report = new MasterReport();
  report.setRootGroup( new CrosstabGroup() );

  final TestReportDesignerContext rdc = new TestReportDesignerContext();
  rdc.addMasterReport( report );
  rdc.setActiveDocument( rdc.getDocumentContext( 0 ) );
  final ReportDocumentContext activeContext = rdc.getActiveContext();
  Assert.assertNotNull( activeContext );
  Assert.assertEquals( activeContext.getReportDefinition(), report );

  EditCrosstabAction action = new EditCrosstabAction();
  action.setReportDesignerContext( rdc );
  Assert.assertFalse( action.isEnabled() );

  rdc.getActiveContext().getSelectionModel().add( report.getRootGroup() );
  Assert.assertTrue( action.isEnabled() );
}
 
Example 7
Source File: TotalItemCountFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MasterReport createReport( final TableModel tableModel ) {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );
  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );

  final CrosstabBuilder builder = new CrosstabBuilder( dataSchemaModel );
  builder.addRowDimension( "Row-Dimension-A" );
  builder.addRowDimension( ROW_DIMENSION_B );
  builder.addColumnDimension( COLUMN_DIMENSION_A );
  builder.addColumnDimension( COLUMN_DIMENSION_B );
  builder.addDetails( VALUE, null );
  report.setRootGroup( builder.create() );
  return report;
}
 
Example 8
Source File: RowBandingFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MasterReport createReport( final TableModel tableModel ) {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );
  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );

  final CrosstabBuilder builder = new CrosstabBuilder( dataSchemaModel );
  builder.addRowDimension( "Row-Dimension-A" );
  builder.addRowDimension( ROW_DIMENSION_B );
  builder.addColumnDimension( COLUMN_DIMENSION_A );
  builder.addColumnDimension( COLUMN_DIMENSION_B );
  builder.addDetails( VALUE, null );
  report.setRootGroup( builder.create() );
  return report;
}
 
Example 9
Source File: TotalItemMinFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MasterReport createReport( final TableModel tableModel ) {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );
  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );

  final CrosstabBuilder builder = new CrosstabBuilder( dataSchemaModel );
  builder.addRowDimension( "Row-Dimension-A" );
  builder.addRowDimension( ROW_DIMENSION_B );
  builder.addColumnDimension( COLUMN_DIMENSION_A );
  builder.addColumnDimension( COLUMN_DIMENSION_B );
  builder.addDetails( VALUE, null );
  report.setRootGroup( builder.create() );
  return report;
}
 
Example 10
Source File: ItemAverageFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MasterReport createReport( final TableModel tableModel ) {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );
  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );

  final CrosstabBuilder builder = new CrosstabBuilder( dataSchemaModel );
  builder.addRowDimension( "Row-Dimension-A" );
  builder.addRowDimension( ROW_DIMENSION_B );
  builder.addColumnDimension( COLUMN_DIMENSION_A );
  builder.addColumnDimension( COLUMN_DIMENSION_B );
  builder.addDetails( VALUE, null );
  report.setRootGroup( builder.create() );
  return report;
}
 
Example 11
Source File: ItemCountFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MasterReport createReport( final TableModel tableModel ) {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );
  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );

  final CrosstabBuilder builder = new CrosstabBuilder( dataSchemaModel );
  builder.addRowDimension( "Row-Dimension-A" );
  builder.addRowDimension( ROW_DIMENSION_B );
  builder.addColumnDimension( COLUMN_DIMENSION_A );
  builder.addColumnDimension( COLUMN_DIMENSION_B );
  builder.addDetails( VALUE, null );
  report.setRootGroup( builder.create() );
  return report;
}
 
Example 12
Source File: ItemMaxFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MasterReport createReport( final TableModel tableModel ) {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );
  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );

  final CrosstabBuilder builder = new CrosstabBuilder( dataSchemaModel );
  builder.addRowDimension( "Row-Dimension-A" );
  builder.addRowDimension( ROW_DIMENSION_B );
  builder.addColumnDimension( COLUMN_DIMENSION_A );
  builder.addColumnDimension( COLUMN_DIMENSION_B );
  builder.addDetails( VALUE, null );
  report.setRootGroup( builder.create() );
  return report;
}
 
Example 13
Source File: ItemSumFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MasterReport createReport( final TableModel tableModel ) {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );
  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );

  final CrosstabBuilder builder = new CrosstabBuilder( dataSchemaModel );
  builder.addRowDimension( "Row-Dimension-A" );
  builder.addRowDimension( ROW_DIMENSION_B );
  builder.addColumnDimension( COLUMN_DIMENSION_A );
  builder.addColumnDimension( COLUMN_DIMENSION_B );
  builder.addDetails( VALUE, null );
  report.setRootGroup( builder.create() );
  return report;
}
 
Example 14
Source File: ItemMinFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MasterReport createReport( final TableModel tableModel ) {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );
  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );

  final CrosstabBuilder builder = new CrosstabBuilder( dataSchemaModel );
  builder.addRowDimension( "Row-Dimension-A" );
  builder.addRowDimension( ROW_DIMENSION_B );
  builder.addColumnDimension( COLUMN_DIMENSION_A );
  builder.addColumnDimension( COLUMN_DIMENSION_B );
  builder.addDetails( VALUE, null );
  report.setRootGroup( builder.create() );
  return report;
}
 
Example 15
Source File: TotalGroupSumFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MasterReport createReport( final TableModel tableModel ) {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );
  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );

  final CrosstabBuilder builder = new CrosstabBuilder( dataSchemaModel );
  builder.addRowDimension( "Row-Dimension-A" );
  builder.addRowDimension( ROW_DIMENSION_B );
  builder.addColumnDimension( COLUMN_DIMENSION_A );
  builder.addColumnDimension( COLUMN_DIMENSION_B );
  builder.addDetails( VALUE, null );
  report.setRootGroup( builder.create() );
  return report;
}
 
Example 16
Source File: TotalItemMaxFunctionIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private MasterReport createReport( final TableModel tableModel ) {
  final MasterReport report = new MasterReport();
  report.setDataFactory( new TableDataFactory( "query", tableModel ) );
  report.setQuery( "query" );
  final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel( report );

  final CrosstabBuilder builder = new CrosstabBuilder( dataSchemaModel );
  builder.addRowDimension( "Row-Dimension-A" );
  builder.addRowDimension( ROW_DIMENSION_B );
  builder.addColumnDimension( COLUMN_DIMENSION_A );
  builder.addColumnDimension( COLUMN_DIMENSION_B );
  builder.addDetails( VALUE, null );
  report.setRootGroup( builder.create() );
  return report;
}
 
Example 17
Source File: EditCrosstabActionTest.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testCreateUndoActionOnMasterReport() {
  WorkspaceSettings.getInstance().setExperimentalFeaturesVisible( true );

  final MasterReport report = new MasterReport();
  CrosstabGroup rootGroup = new CrosstabGroup();
  report.setRootGroup( rootGroup );

  final TestReportDesignerContext rdc = new TestReportDesignerContext();
  rdc.addMasterReport( report );
  rdc.setActiveDocument( rdc.getDocumentContext( 0 ) );
  final ReportDocumentContext activeContext = rdc.getActiveContext();
  Assert.assertNotNull( activeContext );
  Assert.assertEquals( activeContext.getReportDefinition(), report );

  activeContext.getSelectionModel().add( rootGroup );

  CrosstabGroup crosstabGroup = new CrosstabGroup();

  EditCrosstabAction action = new NonEditingCrosstabAction( crosstabGroup );
  action.setReportDesignerContext( rdc );
  action.actionPerformed( new ActionEvent( this, ActionEvent.ACTION_PERFORMED, "Edit" ) );
  Assert.assertFalse( rdc.getActiveContext().getUndo().isRedoPossible() );
  Assert.assertTrue( rdc.getActiveContext().getUndo().isUndoPossible() );
  Assert.assertEquals( crosstabGroup.getObjectID(), report.getRootGroup().getObjectID() );

  rdc.getActiveContext().getUndo().undo( rdc.getActiveContext() );
  Assert.assertEquals( rootGroup.getObjectID(), report.getRootGroup().getObjectID() );

  rdc.getActiveContext().getUndo().redo( rdc.getActiveContext() );
  Assert.assertEquals( crosstabGroup.getObjectID(), report.getRootGroup().getObjectID() );
}
 
Example 18
Source File: CrosstabIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testEmptyCrosstab() throws Exception {
  final MasterReport report = new MasterReport();
  report.setRootGroup( new CrosstabGroup() );
  report.setQuery( "default" );
  report.setDataFactory( new TableDataFactory( "default", new DefaultTableModel( 1, 1 ) ) );
  DebugReportRunner.executeAll( report );
}
 
Example 19
Source File: CrosstabDataIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testInvalidReportProcessing() throws Exception {
  final TypedTableModel model = new TypedTableModel();
  model.addRow();
  model.addRow();
  model.addRow();

  final MasterReport report = new MasterReport();
  report.setQuery( "default" );
  report.setDataFactory( new TableDataFactory( "default", model ) );
  report.setRootGroup( createCrosstab() );
  report.addExpression( new ValidateExpression( false ) );

  DebugReportRunner.layoutPage( report, 0 );
}
 
Example 20
Source File: RelationalReportBuilder.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public MasterReport createReport() {
  final MasterReport report = new MasterReport();
  report.setRootGroup( create() );
  return report;
}