Package net.sf.jasperreports.engine

Examples of net.sf.jasperreports.engine.JRSubreportReturnValue


      JRSubreportReturnValue[] returnValues = subreport.getReturnValues();
      if (returnValues != null && returnValues.length > 0)
      {
        for (int i = 0; i < returnValues.length; i++)
        {
          JRSubreportReturnValue returnValue = returnValues[i];

          if (returnValue.getSubreportVariable() == null || returnValue.getSubreportVariable().trim().length() == 0)
          {
            addBrokenRule("Subreport return value variable name missing.", returnValue);
          }

          if (returnValue.getToVariable() == null || returnValue.getToVariable().trim().length() == 0)
          {
            addBrokenRule("Subreport return value to variable name missing.", returnValue);
          }

          if (!jasperDesign.getVariablesMap().containsKey(returnValue.getToVariable()))
          {
            addBrokenRule("Subreport return value to variable not found.", returnValue);
          }
        }
      }
View Full Code Here


    switch (calculation)
    {
      case AVERAGE:
      case VARIANCE:
      {
        JRSubreportReturnValue countVal = createHelperReturnValue(parentReturnValue, "_COUNT", CalculationEnum.COUNT);
        addReturnValue(countVal, returnValueList, factory);

        JRSubreportReturnValue sumVal = createHelperReturnValue(parentReturnValue, "_SUM", CalculationEnum.SUM);
        addReturnValue(sumVal, returnValueList, factory);

        filler.addVariableCalculationReq(returnValue.getToVariable(), calculation);

        break;
      }
      case STANDARD_DEVIATION:
      {
        JRSubreportReturnValue varianceVal = createHelperReturnValue(parentReturnValue, "_VARIANCE", CalculationEnum.VARIANCE);
        addReturnValue(varianceVal, returnValueList, factory);
       
        filler.addVariableCalculationReq(returnValue.getToVariable(), calculation);
        break;
      }
      case DISTINCT_COUNT:
      {
        JRSubreportReturnValue countVal = createDistinctCountHelperReturnValue(parentReturnValue);
        addReturnValue(countVal, returnValueList, factory);
       
        filler.addVariableCalculationReq(returnValue.getToVariable(), calculation);
        break;
      }
View Full Code Here

    boolean used = false;
    if (returnValues != null)
    {
      for (int j = 0; j < returnValues.length; j++)
      {
        JRSubreportReturnValue returnValue = returnValues[j];
        if (returnValue.getToVariable().equals(variableName))
        {
          used = true;
          break;
        }
      }
View Full Code Here

  {
    if (returnValues != null && returnValues.length > 0)
    {
      for (int i = 0; i < returnValues.length; i++)
      {
        JRSubreportReturnValue returnValue = returnValues[i];
        String subreportVariableName = returnValue.getSubreportVariable();
        JRVariable subrepVariable = subreportFiller.getVariable(subreportVariableName);
        if (subrepVariable == null)
        {
          throw new JRException("Subreport variable " + subreportVariableName + " not found.");
        }
       
        JRVariable variable = filler.getVariable(returnValue.getToVariable());
        if (
          returnValue.getCalculationValue() == CalculationEnum.COUNT
          || returnValue.getCalculationValue() == CalculationEnum.DISTINCT_COUNT
          )
        {
          if (!Number.class.isAssignableFrom(variable.getValueClass()))
          {
            throw new JRException("Variable " + returnValue.getToVariable() +
                " must have a numeric type.");
          }
        }
        else if (!variable.getValueClass().isAssignableFrom(subrepVariable.getValueClass()) &&
            !(Number.class.isAssignableFrom(variable.getValueClass()) && Number.class.isAssignableFrom(subrepVariable.getValueClass())))
        {
          throw new JRException("Variable " + returnValue.getToVariable() +
              " is not assignable from subreport variable " +
              subreportVariableName);
        }
      }
    }
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.JRSubreportReturnValue

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.