Package org.pentaho.reporting.engine.classic.core.states.crosstab

Examples of org.pentaho.reporting.engine.classic.core.states.crosstab.SortedMergeCrosstabSpecification


    final ProcessingContext prc = new DefaultProcessingContext();
    final GlobalMasterRow gmr = GlobalMasterRow.createReportRow
        (prc, new DefaultDataSchemaDefinition(), new ParameterDataRow(), null, false);
    final TableModel data = createTableModel();
    MasterDataRow wdata = gmr.deriveWithQueryData(new ReportDataRow(data));
    final CrosstabSpecification cs = new SortedMergeCrosstabSpecification
        (createDummyKey(), new String[]{"Product", "Time"});
    int advanceCount = 0;
    System.out.println(wdata.getReportDataRow().getCursor());
    cs.startRow();
    cs.add(wdata.getGlobalView());
    Object grpVal = wdata.getGlobalView().get("Region");
    while (wdata.isAdvanceable())
    {
      final MasterDataRow nextdata = wdata.advance();
      Object nextGrpVal = nextdata.getGlobalView().get("Region");
      if (ObjectUtilities.equal(grpVal, nextGrpVal) == false)
      {
        cs.endRow();
        cs.startRow();
      }

      cs.add(nextdata.getGlobalView());
      logger.debug("Prepare Advance Count: " + nextdata.getReportDataRow().getCursor());
      advanceCount += 1;
      wdata = nextdata;
      grpVal = nextGrpVal;
    }
    cs.endRow();
    if (advanceCount != (data.getRowCount() - 1))
    {
      throw new IllegalStateException("Expected 6 but got " + advanceCount);
    }
    return cs;
View Full Code Here


  }

  public static CrosstabSpecification fillSortedCrosstabSpec(final TableModel model) throws ReportProcessingException
  {
    final CrosstabSpecification spec =
        new SortedMergeCrosstabSpecification(new ReportStateKey(), new String[]{"Cols"}, new String[]{"Rows"});
    return fillCrosstabSpec(model, spec);
  }
View Full Code Here

    final ProcessingContext prc = new DefaultProcessingContext();
    final GlobalMasterRow gmr = GlobalMasterRow.createReportRow
        (prc, new DefaultDataSchemaDefinition(), new ParameterDataRow());
    gmr.requireStructuralProcessing();
    MasterDataRow masterDataRow = gmr.deriveWithQueryData(data);
    final CrosstabSpecification crosstabSpecification = new SortedMergeCrosstabSpecification
        (new ReportStateKey(), new String[]{"Product", "Time"}, new String[] {"Region"});

    int advanceCount = 0;
    logger.debug("Building Crosstab: Cursor: " + String.valueOf(masterDataRow.getReportDataRow().getCursor()));
    crosstabSpecification.startRow();
    crosstabSpecification.add(masterDataRow.getGlobalView());
    Object grpVal = masterDataRow.getGlobalView().get("Region");
    while (masterDataRow.isAdvanceable())
    {
      final MasterDataRow nextdata = masterDataRow.advance();
      final Object nextGrpVal = nextdata.getGlobalView().get("Region");
      if (ObjectUtilities.equal(grpVal, nextGrpVal) == false)
      {
        crosstabSpecification.endRow();
        crosstabSpecification.startRow();
      }

      crosstabSpecification.add(nextdata.getGlobalView());
      logger.debug("Prepare Advance Count: " + nextdata.getReportDataRow().getCursor());
      advanceCount += 1;
      masterDataRow = nextdata;
      grpVal = nextGrpVal;
    }
    crosstabSpecification.endRow();
    crosstabSpecification.endCrosstab();
    if (advanceCount != (data.getRowCount() - 1))
    {
      throw new IllegalStateException("Expected 6 but got " + advanceCount);
    }
    return crosstabSpecification;
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.states.crosstab.SortedMergeCrosstabSpecification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.