public void summaryRowSelection(final ReportEvent event) {
   if (FunctionUtilities.isDefinedGroup(getCrosstabFilterGroup(), event)) {
     final int groupIndex = event.getState().getCurrentGroupIndex();
     this.lastGroupSequenceNumber =
         (int) event.getState().getCrosstabColumnSequenceCounter(groupIndex);
   }
 }
  public void summaryRowSelection(final ReportEvent event) {
    if (FunctionUtilities.isDefinedGroup(getCrosstabFilterGroup(), event)) {
      final String targetName = getName().substring(1);
      final Object expressionValue = getDataRow().get(targetName);
      final Object tableModelValue = getDataRow().get("validate-" + targetName);

      currentDataItem = event.getState().getCurrentDataItem();
      long sequenceCounter = event.getState().getCrosstabColumnSequenceCounter(3);

      if (!equalNumeric(expressionValue, tableModelValue)) {
        logger.debug(
            String.format(
                "!*%12s %3d:%d# %s - %s",
                targetName, currentDataItem, sequenceCounter, expressionValue, tableModelValue));
        if (failHard) {
          Assert.assertEquals(tableModelValue, expressionValue);
        }
      } else {
        logger.debug(
            String.format(
                " *%12s %3d:%d# %s - %s",
                targetName, currentDataItem, sequenceCounter, expressionValue, tableModelValue));
      }
    }
  }
  public void summaryRowSelection(final ReportEvent event) {
    if (rowbandingOnGroup == false) {
      return;
    }

    if (StringUtils.isEmpty(group)) {
      final Group group = event.getReport().getGroup(event.getState().getCurrentGroupIndex());
      if (group instanceof CrosstabRowGroup) {
        final GroupBody body = group.getBody();
        if (body instanceof CrosstabColumnGroupBody) {
          if (Boolean.TRUE.equals(
              group.getAttribute(
                  AttributeNames.Crosstab.NAMESPACE, AttributeNames.Crosstab.PRINT_SUMMARY))) {
            triggerVisibleStateCrosstab(event);
          }
        }
      }
    } else {
      if (FunctionUtilities.isDefinedGroup(group, event)) {
        final Group group = event.getReport().getGroup(event.getState().getCurrentGroupIndex());
        if (Boolean.TRUE.equals(
            group.getAttribute(
                AttributeNames.Crosstab.NAMESPACE, AttributeNames.Crosstab.PRINT_SUMMARY))) {
          triggerVisibleStateCrosstab(event);
        }
      }
    }
  }
  /**
   * Create a image according to the current state, simple and silly ...
   *
   * @param event the report event.
   */
  public void pageStarted(final ReportEvent event) {
    final BufferedImage image = new BufferedImage(150, 50, BufferedImage.TYPE_INT_ARGB);
    final Graphics2D g2 = image.createGraphics();
    final JButton bt = new JButton("A Button");
    bt.setSize(90, 20);
    final JRadioButton radio = new JRadioButton("A radio button");
    radio.setSize(100, 20);

    g2.setColor(Color.darkGray);
    bt.paint(g2);
    g2.setColor(Color.blue);
    g2.setTransform(AffineTransform.getTranslateInstance(20, 20));
    radio.paint(g2);
    g2.setTransform(AffineTransform.getTranslateInstance(0, 0));
    g2.setPaint(Color.green);
    g2.setFont(new Font("Serif", Font.PLAIN, 10));
    g2.drawString(
        "You are viewing a graphics of JFreeReport on index " + event.getState().getCurrentRow(),
        10,
        10);
    g2.dispose();
    try {
      functionValue = new DefaultImageReference(image);
    } catch (IOException e) {
      functionValue = null;
    }
  }
  public void itemsAdvanced(final ReportEvent event) {
    final String targetName = getName().substring(1);
    final Object expressionValue = getDataRow().get(targetName);
    final Object tableModelValue = getDataRow().get("validate-" + targetName);

    currentDataItem = event.getState().getCurrentDataItem();
    long sequenceCounter = event.getState().getCrosstabColumnSequenceCounter(3);

    if (!equalNumeric(expressionValue, tableModelValue)) {
      logger.debug(
          String.format(
              "! %12s %3d:%d# %s - %s",
              targetName, currentDataItem, sequenceCounter, expressionValue, tableModelValue));
      if (failHard) {
        Assert.assertEquals(tableModelValue, expressionValue);
      }
    } else {
      logger.debug(
          String.format(
              "  %12s %3d:%d# %s - %s",
              targetName, currentDataItem, sequenceCounter, expressionValue, tableModelValue));
    }
  }
  public void groupStarted(final ReportEvent event) {
    if (rowbandingOnGroup == false) {
      return;
    }

    if (StringUtils.isEmpty(group)) {
      final Group group = event.getReport().getGroup(event.getState().getCurrentGroupIndex());
      if (group instanceof CrosstabRowGroup) {
        final GroupBody body = group.getBody();
        if (body instanceof CrosstabColumnGroupBody) {
          triggerVisibleStateCrosstab(event);
        }
      }
    } else {
      if (FunctionUtilities.isDefinedGroup(group, event)) {
        triggerVisibleStateCrosstab(event);
      }
    }
  }