public Object createObject(Attributes atts)
{
JRXmlLoader xmlLoader = (JRXmlLoader) digester.peek(digester.getCount() - 1);
JasperDesign design = (JasperDesign) digester.peek(digester.getCount() - 2);
JRDesignSubreportReturnValue returnValue = new JRDesignSubreportReturnValue();
String variableName = atts.getValue(JRXmlConstants.ATTRIBUTE_toVariable);
JRVariable variable = (JRVariable) design.getVariablesMap().get(variableName);
if (variable == null)
{
xmlLoader.addError(new JRValidationException("Unknown variable " + variableName, returnValue));
}
returnValue.setSubreportVariable(atts.getValue(JRXmlConstants.ATTRIBUTE_subreportVariable));
returnValue.setToVariable(variableName);
CalculationEnum calculation = CalculationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_calculation));
if (calculation != null)
{
returnValue.setCalculation(calculation);
}
String incrementerFactoryClass = atts.getValue(JRXmlConstants.ATTRIBUTE_incrementerFactoryClass);
if (incrementerFactoryClass != null)
{
returnValue.setIncrementerFactoryClassName(incrementerFactoryClass);
}
return returnValue;
}