Package org.pentaho.reporting.engine.classic.core.layout

Examples of org.pentaho.reporting.engine.classic.core.layout.Renderer


    clearPendingPageStart(event);
  }

  public boolean createRollbackInformation()
  {
    final Renderer commitableRenderer = getRenderer();
    commitableRenderer.createRollbackInformation();
    return true;
  }
View Full Code Here


  {
    final PreparedCrosstabLayout preparedCrosstabLayout = outputFunction.getCurrentCrosstabLayout();

    final int columnSlotNumber = event.getState().getCurrentDataItem() - beginOfGroup;

    final Renderer renderer = outputFunction.getRenderer();
    final LayoutBuilder builder = renderer.createBufferedLayoutBuilder();
    final int gidx = event.getState().getCurrentGroupIndex();
    final CrosstabColumnGroup g = (CrosstabColumnGroup) event.getReport().getGroup(gidx);

    final RenderBox titleBox = preparedCrosstabLayout.getColumnHeaderTitleBox();
    final RenderBox titleColumnSlot = CrosstabLayoutUtil.getSlot(titleBox, columnSlotNumber);
View Full Code Here

  public void itemsAdvanced(final DefaultOutputFunction outputFunction,
                            final ReportEvent event) throws ReportProcessingException
  {
    final PreparedCrosstabLayout preparedCrosstabLayout = outputFunction.getCurrentCrosstabLayout();

    final Renderer renderer = outputFunction.getRenderer();
    final LayoutBuilder builder = renderer.createBufferedLayoutBuilder();
    final ItemBand g = event.getReport().getItemBand();
    final int columnSlotNumber = event.getState().getCurrentDataItem() - beginOfGroup;

    final RenderBox dataBox = preparedCrosstabLayout.getCellDataBox();
    final RenderBox dataSlot = CrosstabLayoutUtil.getSlot(dataBox, columnSlotNumber);
View Full Code Here

          state = state.commit();
          continue;
        }

        final DefaultOutputFunction lm = (DefaultOutputFunction) outputFunction;
        final Renderer renderer = lm.getRenderer();
        pagebreakHandler.setReportState(state);

        boolean assertExpectPagebreak = false;
        if (isInRollBackMode)
        {
          if (nextStateKey.equals(rollbackPageState))
          {
            // reached the border case. We have to insert a manual pagebreak here or at least
            // we have to force the renderer to end the page right now.
//            Log.debug ("HERE: Found real pagebreak position. This might be the last state we process.");
            assertExpectPagebreak = true;
            renderer.addPagebreak(state.getProcessKey());
          }
        }

        final Renderer.LayoutResult pagebreakEncountered = renderer.validatePages();
        if (assertExpectPagebreak == true && pagebreakEncountered != Renderer.LayoutResult.LAYOUT_PAGEBREAK)
        {
          if (SHOW_ROLLBACKS)
          {
            AbstractReportProcessor.logger.debug("Paginate: Missed the pagebreak. This smells fishy!");
          }
        }

        if (pagebreakEncountered == Renderer.LayoutResult.LAYOUT_UNVALIDATABLE)
        {
          if (pagebreaksSupported && state.isArtifcialState() == false)
          {
            if (isInRollBackMode == false)
            {
              if (pageEventCount >= AbstractReportProcessor.COMMIT_RATE)
              {
                if (AbstractReportProcessor.SHOW_ROLLBACKS)
                {
                  logger.debug("Paginate: Try to apply new fallback state after commit count reached: " + state.getProcessKey());
                }
                fallBackState = realFallbackState;
                pageEventCount = 0;
              }
              else
              {
                pageEventCount += 1;
              }
            }
          }
        }

        if (pagebreakEncountered == Renderer.LayoutResult.LAYOUT_PAGEBREAK)
        {
          final ReportStateKey lastVisibleStateKey = renderer.getLastStateKey();
          if (pagebreaksSupported &&
              isInRollBackMode == false &&
              renderer.isOpen() &&
              lastVisibleStateKey != null)
          {
            if (lastVisibleStateKey.equals(nextStateKey) == false)
            {
//              Log.debug ("HERE: Encountered bad break, need to roll-back");

              // Roll back to the last known to be good position and process the states up to, but not
              // including the current state. This way, we can fire the page-events *before* this band
              // gets printed.
              rollbackPageState = lastVisibleStateKey;

              final ReportStateKey restoreStateProcessKey = restoreState.getProcessKey();
              if (AbstractReportProcessor.SHOW_ROLLBACKS)
              {
                AbstractReportProcessor.logger.debug(
                    "Print: Encountered bad break, need to roll-back: " + rollbackPageState);
                AbstractReportProcessor.logger.debug(
                    "Print:                                         : " + state.getProcessKey());
                AbstractReportProcessor.logger.debug(
                    "Print:                                         : " + restoreStateProcessKey);
              }

              if (lastVisibleStateKey.getSequenceCounter() < restoreStateProcessKey.getSequenceCounter())
              {
                if (AbstractReportProcessor.SHOW_ROLLBACKS)
                {
                  AbstractReportProcessor.logger.debug(
                      "Print: Fall back to start of page              : " + restoreStateProcessKey);
                }
                state = globalState.deriveForPagebreak();
              }
              else
              {
                if (AbstractReportProcessor.SHOW_ROLLBACKS)
                {
                  AbstractReportProcessor.logger.debug(
                      "Print: Fall back to save-state                 : " + restoreStateProcessKey);
                }
                state = restoreState.deriveForPagebreak();
              }

              final DefaultOutputFunction rollbackOutputFunction = (DefaultOutputFunction) state.getLayoutProcess().getOutputFunction();
              final Renderer rollbackRenderer = rollbackOutputFunction.getRenderer();
              rollbackRenderer.rollback();

              validate(state);

              isInRollBackMode = true;
              continue;
            }
            else
            {
              // The current state printed content partially on the now finished page and there is more
              // content on the currently open page. This is a in-between pagebreak, we invoke a pagebreak
              // after this state has been processed.
              if (AbstractReportProcessor.SHOW_ROLLBACKS)
              {
                AbstractReportProcessor.logger.debug("Print: Encountered on-going break " + lastVisibleStateKey);
              }
            }
          }
          else
          {
            if (AbstractReportProcessor.SHOW_ROLLBACKS)
            {
              AbstractReportProcessor.logger.debug(
                  "Print: Encountered a good break or a roll-back break: " + isInRollBackMode);
              AbstractReportProcessor.logger.debug(
                  "Print:                                              : " + state.getProcessKey());
            }
          }
          if (pagebreaksSupported == false)
          {
            // The commit causes all closed-nodes to become finishable. This allows the process-page
            // and the incremental-update methods to remove the nodes. For non-streaming targets (where
            // pagebreaks are possible) the commit state is managed manually
            renderer.applyAutoCommit();
          }

          if (renderer.processPage(pagebreakHandler, state.getProcessKey(), performOutput) == false)
          {
            throw new IllegalStateException("This must not be.");
          }

          if (isPagebreaksSupported() && renderer.isPendingPageHack() &&
              renderer.isCurrentPageEmpty() == false && renderer.isPageStartPending() == false)
          {
            if (AbstractReportProcessor.SHOW_ROLLBACKS)
            {
              logger.debug("Print: Delaying next event to allow pending pages to be processed: " + state.getProcessKey());
            }
            state = PendingPagesHandler.create(state);
          }
          else if (isPagebreaksSupported())
          {
            if (AbstractReportProcessor.SHOW_ROLLBACKS)
            {
              logger.debug("Print: Adding RestartOnNewPageHandler to open Page in time: " + state.getProcessKey());
            }
            state = RestartOnNewPageHandler.create(state.commit());
          }
          else
          {
            state = state.commit();
          }

          if (renderer.isOpen())
          {
            // No need to create a copy here. It is part of the contract that the resulting page state must be
            // cloned before it can be used again. The only place where it is used is this method, so we can
            // be pretty sure that this contract is valid.
            return new PageState(state, outputProcessor.getPageCursor());
          }
        }
        else
        {
          if (pagebreaksSupported == false)
          {
            // The commit causes all closed-nodes to become finishable. This allows the process-page
            // and the incremental-update methods to remove the nodes. For non-streaming targets (where
            // pagebreaks are possible) the commit state is managed manually
            renderer.applyAutoCommit();
          }

          if (pageEventCount == 0 && isInRollBackMode == false &&
              pagebreakEncountered == Renderer.LayoutResult.LAYOUT_NO_PAGEBREAK)
          {
            renderer.processIncrementalUpdate(performOutput);
          }
          state = state.commit();

          // Expected a pagebreak now, but did not encounter one.
//          if (nextStateKey.equals(rollbackPageState))
//          {
//            // reached the border case. We have to insert a manual pagebreak here or at least
//            // we have to force the renderer to end the page right now.
//            Log.debug ("HERE: Ups, Found real pagebreak position. but where is my break?");
//            //renderer.addPagebreak(state.getProcessKey());
//          }
          if (pagebreaksSupported && fallBackState != restoreState)
          {
            final DefaultOutputFunction commitableOutputFunction =
                (DefaultOutputFunction) state.getLayoutProcess().getOutputFunction();
            final Renderer commitableRenderer = commitableOutputFunction.getRenderer();
            commitableRenderer.applyRollbackInformation();
          }
        }
      }

      // We should never reach this point, if this function has been called by the PageStateList.
View Full Code Here

      throws ReportProcessingException
  {
    final PreparedCrosstabLayout preparedCrosstabLayout = outputFunction.getCurrentCrosstabLayout();
    if (preparedCrosstabLayout.isFinishPending())
    {
      final Renderer renderer = outputFunction.getRenderer();
      outputFunction.updateFooterArea(event);

      if (preparedCrosstabLayout.getRowCount() == 0)
      {
        renderer.startSection(Renderer.TYPE_NORMALFLOW);
        renderer.add(preparedCrosstabLayout.getPrintableHeaderBox());
        renderer.endSection();
        outputFunction.addSubReportMarkers(preparedCrosstabLayout.getHeaderSubReportMarker());
      }

      renderer.startSection(Renderer.TYPE_NORMALFLOW);
      renderer.add(preparedCrosstabLayout.getPrintableDataBox());
      renderer.endSection();
      outputFunction.addSubReportMarkers(preparedCrosstabLayout.getDataSubReportMarker());

      preparedCrosstabLayout.setFinishPending(false);
      preparedCrosstabLayout.setRowCount(preparedCrosstabLayout.getRowCount() + 1);
    }
View Full Code Here

{
  public void groupStarted(final DefaultOutputFunction outputFunction,
                           final ReportEvent event) throws ReportProcessingException
  {
    outputFunction.updateFooterArea(event);
    final Renderer renderer = outputFunction.getRenderer();
    final int gidx = event.getState().getCurrentGroupIndex();
    final Group g = event.getReport().getGroup(gidx);
    final Band b = g.getHeader();
    renderer.startGroup(g);
    renderer.startSection(Renderer.TYPE_NORMALFLOW);
    outputFunction.print(outputFunction.getRuntime(), b);
    outputFunction.addSubReportMarkers(renderer.endSection());
    renderer.startGroupBody(g.getBody());
  }
View Full Code Here

  public void itemsStarted(final DefaultOutputFunction outputFunction,
                           final ReportEvent event) throws ReportProcessingException
  {
    // activating this state after the page has ended is invalid.
    final int numberOfRows = event.getState().getNumberOfRows();
    final Renderer renderer = outputFunction.getRenderer();
    outputFunction.updateFooterArea(event);

    renderer.startSection(Renderer.TYPE_NORMALFLOW);
    outputFunction.print(outputFunction.getRuntime(), event.getReport().getDetailsHeader());
    outputFunction.addSubReportMarkers(renderer.endSection());

    if (numberOfRows == 0)
    {
      // ups, we have no data. Lets signal that ...
      renderer.startSection(Renderer.TYPE_NORMALFLOW);
      outputFunction.print(outputFunction.getRuntime(), event.getReport().getNoDataBand());
      outputFunction.addSubReportMarkers(renderer.endSection());
      // there will be no item-band printed.
    }
   
  }
View Full Code Here

  }

  public void itemsAdvanced(final DefaultOutputFunction outputFunction,
                            final ReportEvent event) throws ReportProcessingException
  {
    final Renderer renderer = outputFunction.getRenderer();
    outputFunction.updateFooterArea(event);

    renderer.startSection(Renderer.TYPE_NORMALFLOW);
    outputFunction.print(outputFunction.getRuntime(), event.getReport().getItemBand());
    outputFunction.addSubReportMarkers(renderer.endSection());
  }
View Full Code Here

  }

  public void itemsFinished(final DefaultOutputFunction outputFunction,
                            final ReportEvent event) throws ReportProcessingException
  {
    final Renderer renderer = outputFunction.getRenderer();
    outputFunction.updateFooterArea(event);

    renderer.startSection(Renderer.TYPE_NORMALFLOW);
    outputFunction.print(outputFunction.getRuntime(), event.getReport().getDetailsFooter());
    outputFunction.addSubReportMarkers(renderer.endSection());
  }
View Full Code Here

  }

  public void groupFinished(final DefaultOutputFunction outputFunction,
                            final ReportEvent event) throws ReportProcessingException
  {
    final Renderer renderer = outputFunction.getRenderer();
    outputFunction.updateFooterArea(event);

    final int gidx = event.getState().getCurrentGroupIndex();
    final Group g = event.getReport().getGroup(gidx);
    final Band b = g.getFooter();

    renderer.endGroupBody();
    renderer.startSection(Renderer.TYPE_NORMALFLOW);
    outputFunction.print(outputFunction.getRuntime(), b);
    outputFunction.addSubReportMarkers(renderer.endSection());
    renderer.endGroup();
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.layout.Renderer

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.