* @param chart Chart that needs a variable to be generated
* @return the generated variables
*/
protected List registerChartVariable(DJChart chart) {
//FIXME aca hay que iterar por cada columna. Cambiar DJChart para que tome muchas
JRDesignGroup group = getJRGroupFromDJGroup(chart.getColumnsGroup());
List vars = new ArrayList();
int serieNum = 0;
for (Iterator iterator = chart.getColumns().iterator(); iterator.hasNext();) {
AbstractColumn col = (AbstractColumn) iterator.next();
Class clazz = null;
try { clazz = Class.forName(col.getValueClassNameForExpression());
} catch (ClassNotFoundException e) {
throw new DJException("Exeption creating chart variable: " + e.getMessage(),e);
}
JRDesignExpression expression = new JRDesignExpression();
//FIXME Only PropertyColumn allowed?
expression.setText("$F{" + ((PropertyColumn) col).getColumnProperty().getProperty() + "}");
expression.setValueClass(clazz);
JRDesignVariable var = new JRDesignVariable();
var.setValueClass(clazz);
var.setExpression(expression);
var.setCalculation(chart.getOperation());
var.setResetGroup(group);
var.setResetType(JRBaseVariable.RESET_TYPE_GROUP);
//use the index as part of the name just because I may want 2
//different types of chart from the very same column (with the same operation also) making the variables name to be duplicated
int chartIndex = getReport().getCharts().indexOf(chart);
var.setName("CHART_[" + chartIndex +"_s" +serieNum + "+]_" + group.getName() + "_" + col.getTitle() + "_" + chart.getOperation());
try {
getDesign().addVariable(var);
vars.add(var);
} catch (JRException e) {