Package net.sf.jasperreports.crosstabs

Examples of net.sf.jasperreports.crosstabs.JRCrosstabBucket


    return new BucketingService(this, rowBuckets, colBuckets, measureList, dataset.isDataPreSorted(), retrieveTotal);
  }

  private BucketDefinition createServiceBucket(JRCrosstabGroup group, byte evaluation) throws JRException
  {
    JRCrosstabBucket bucket = group.getBucket();

    Comparator comparator = null;
    JRExpression comparatorExpression = bucket.getComparatorExpression();
    if (comparatorExpression != null)
    {
      comparator = (Comparator) evaluateExpression(comparatorExpression, evaluation);
    }

    return new BucketDefinition(bucket.getExpression().getValueClass(),
        bucket.getOrderByExpression(), comparator, bucket.getOrderValue(),
        group.getTotalPositionValue());
  }
View Full Code Here


    if (rowGroups != null)
    {
      for (int i = 0; i < rowGroups.length; i++)
      {
        JRCrosstabRowGroup rowGroup = rowGroups[i];
        JRCrosstabBucket bucket = rowGroup.getBucket();
        datasetCollector.addExpression(bucket.getExpression());
        //order by expression is in the crosstab context
        crosstabCollector.addExpression(bucket.getOrderByExpression());
        addExpression(bucket.getComparatorExpression());
        crosstabCollector.collect(rowGroup.getHeader());
        crosstabCollector.collect(rowGroup.getTotalHeader());
      }
    }

    JRCrosstabColumnGroup[] colGroups = crosstab.getColumnGroups();
    if (colGroups != null)
    {
      for (int i = 0; i < colGroups.length; i++)
      {
        JRCrosstabColumnGroup columnGroup = colGroups[i];
        JRCrosstabBucket bucket = columnGroup.getBucket();
        datasetCollector.addExpression(bucket.getExpression());
        //order by expression is in the crosstab context
        crosstabCollector.addExpression(bucket.getOrderByExpression());
        addExpression(bucket.getComparatorExpression());
        crosstabCollector.collect(columnGroup.getHeader());
        crosstabCollector.collect(columnGroup.getTotalHeader());
      }
    }
View Full Code Here

  protected void setGroupVariablesClass(List groups)
  {
    for (Iterator it = groups.iterator(); it.hasNext();)
    {
      JRDesignCrosstabGroup group = (JRDesignCrosstabGroup) it.next();
      JRCrosstabBucket bucket = group.getBucket();
      if (bucket != null)
      {
        JRExpression expression = bucket.getExpression();
        if (expression != null)
        {
          group.designVariable.setValueClassName(expression.getValueClassName());
        }
      }
View Full Code Here

  }


  private void verifyCrosstabBucket(JRCrosstabGroup group)
  {
    JRCrosstabBucket bucket = group.getBucket();

    JRExpression expression = bucket.getExpression();
    Class expressionClass = null;
    if (expression == null)
    {
      addBrokenRule("Crosstab bucket expression missing for group " + group.getName() + ".", bucket);
    }
    else
    {
      try
      {
        expressionClass = expression.getValueClass();
        if (expressionClass == null)
        {
          addBrokenRule("Crosstab bucket expression class missing for group " + group.getName() + ".", expression);
        }
      }
      catch (JRRuntimeException e)
      {
        addBrokenRule(e, expression);
      }
    }
   
    JRExpression orderByExpression = bucket.getOrderByExpression();
    Class orderByClass = null;
    if (orderByExpression != null)
    {
      try
      {
        orderByClass = orderByExpression.getValueClass();
        if (orderByClass == null)
        {
          addBrokenRule("Crosstab bucket order by class missing for group "
              + group.getName() + ".", orderByExpression);
        }
      }
      catch (JRRuntimeException e)
      {
        addBrokenRule(e, orderByExpression);
      }
    }

    try
    {
      Class valueClass = expression == null ? null : expression.getValueClass();
      if (valueClass == null)
      {
        addBrokenRule("Crosstab bucket value class missing for group " + group.getName() + ".", bucket);
      }
      else if (expressionClass != null && !valueClass.isAssignableFrom(expressionClass))
      {
        addBrokenRule("The class of the expression is not compatible with the class of the crosstab bucket for group " + group.getName() + ".", expression);
      }
     
      JRExpression comparatorExpression = bucket.getComparatorExpression();
      if (comparatorExpression == null)
      {
        if (orderByExpression == null)
        {
          // no order by expression, bucket values are used for sorting
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.crosstabs.JRCrosstabBucket

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.