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

The following examples show how to use org.pentaho.reporting.engine.classic.core.MasterReport#getGroupByName() . 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: TotalGroupSumIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testGroupSumTest() throws Exception {
  final URL url = getClass().getResource( "aggregate-function-test.xml" );
  assertNotNull( url );
  final ResourceManager resourceManager = new ResourceManager();
  resourceManager.registerDefaults();
  final Resource directly = resourceManager.createDirectly( url, MasterReport.class );
  final MasterReport report = (MasterReport) directly.getResource();
  report.setDataFactory( new TableDataFactory( "default", new AggregateTestDataTableModel() ) );

  report.addExpression( new TotalGroupCountVerifyFunction() );
  // make sure that there is no default group ...
  final RelationalGroup g = report.getGroupByName( "default" );
  if ( g != null ) {
    report.removeGroup( g );
  }

  final TotalGroupSumFunction f = new TotalGroupSumFunction();
  f.setName( "continent-total-gc" );
  f.setGroup( "Continent Group" );
  f.setField( "Population" );
  f.setDependencyLevel( 1 );
  report.addExpression( f );

  final TotalGroupSumFunction f2 = new TotalGroupSumFunction();
  f2.setName( "total-gc" );
  f2.setField( "Population" );
  f2.setDependencyLevel( 1 );
  report.addExpression( f2 );

  DebugReportRunner.execGraphics2D( report );

}
 
Example 2
Source File: TotalItemCountIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testGroupItemCount() throws Exception {
  final URL url = getClass().getResource( "aggregate-function-test.xml" );
  assertNotNull( url );
  final ResourceManager resourceManager = new ResourceManager();
  resourceManager.registerDefaults();
  final Resource directly = resourceManager.createDirectly( url, MasterReport.class );
  final MasterReport report = (MasterReport) directly.getResource();
  report.addExpression( new EventMonitorFunction() );
  report.setDataFactory( new TableDataFactory( "default", new AggregateTestDataTableModel() ) );

  report.addExpression( new TotalItemCountVerifyFunction() );
  final RelationalGroup g = report.getGroupByName( "default" );
  if ( g != null ) {
    report.removeGroup( g );
  }

  final TotalItemCountFunction f = new TotalItemCountFunction();
  f.setName( "continent-total-gc" );
  f.setGroup( "Continent Group" );
  f.setDependencyLevel( 1 );
  report.addExpression( f );

  final TotalItemCountFunction f2 = new TotalItemCountFunction();
  f2.setName( "total-gc" );
  f2.setDependencyLevel( 1 );
  report.addExpression( f2 );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 3
Source File: TotalGroupCountIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testGroupCount() throws Exception {
  final URL url = getClass().getResource( "aggregate-function-test.xml" );
  assertNotNull( url );
  final ResourceManager resourceManager = new ResourceManager();
  resourceManager.registerDefaults();
  final Resource directly = resourceManager.createDirectly( url, MasterReport.class );
  final MasterReport report = (MasterReport) directly.getResource();
  report.setDataFactory( new TableDataFactory( "default", new AggregateTestDataTableModel() ) );
  final RelationalGroup g = report.getGroupByName( "default" );
  if ( g != null ) {
    report.removeGroup( g );
  }
  report.addExpression( new TotalGroupCountVerifyFunction() );

  final TotalGroupCountFunction f = new TotalGroupCountFunction();
  f.setName( "continent-total-gc" );
  f.setGroup( "Continent Group" );
  f.setDependencyLevel( 1 );
  report.addExpression( f );

  final TotalGroupCountFunction f2 = new TotalGroupCountFunction();
  f2.setName( "total-gc" );
  f2.setDependencyLevel( 1 );
  report.addExpression( f2 );

  DebugReportRunner.execGraphics2D( report );

}
 
Example 4
Source File: TotalGroupCountIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testGroupCount2() throws Exception {
  final URL url = getClass().getResource( "aggregate-function-test.xml" );
  assertNotNull( url );
  final ResourceManager resourceManager = new ResourceManager();
  resourceManager.registerDefaults();
  final Resource directly = resourceManager.createDirectly( url, MasterReport.class );
  final MasterReport report = (MasterReport) directly.getResource();
  report.setDataFactory( new TableDataFactory( "default", new AggregateTestDataTableModel() ) );

  final RelationalGroup g = report.getGroupByName( "default" );
  if ( g != null ) {
    report.removeGroup( g );
  }
  report.addExpression( new TotalGroupCountVerifyFunction() );

  final TotalGroupCountFunction f = new TotalGroupCountFunction();
  f.setName( "continent-total-gc" );
  f.setGroup( "Continent Group" );
  f.setDependencyLevel( 1 );
  report.addExpression( f );

  final TotalGroupCountFunction f2 = new TotalGroupCountFunction();
  f2.setName( "total-gc" );
  f2.setDependencyLevel( 1 );
  report.addExpression( f2 );

  DebugReportRunner.execGraphics2D( report );
}
 
Example 5
Source File: TotalGroupCountIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testGroupCount3() throws Exception {
  final URL url = getClass().getResource( "aggregate-function-test.xml" );
  assertNotNull( url );
  final ResourceManager resourceManager = new ResourceManager();
  resourceManager.registerDefaults();
  final Resource directly = resourceManager.createDirectly( url, MasterReport.class );
  final MasterReport report = (MasterReport) directly.getResource();
  report.setDataFactory( new TableDataFactory( "default", new AggregateTestDataTableModel() ) );

  final RelationalGroup g = report.getGroupByName( "default" );
  if ( g != null ) {
    report.removeGroup( g );
  }
  report.addExpression( new TotalGroupCountVerifyFunction() );

  final TotalGroupCountFunction f = new TotalGroupCountFunction();
  f.setName( "continent-total-gc" );
  f.setGroup( "Continent Group" );
  f.setDependencyLevel( 1 );
  report.addExpression( f );

  final TotalGroupCountFunction f2 = new TotalGroupCountFunction();
  f2.setName( "total-gc" );
  f2.setDependencyLevel( 1 );
  report.addExpression( f2 );

  DebugReportRunner.execGraphics2D( report );
}