/*
* Takes all the report's charts and inserts them in their corresponding bands
*/
protected void layoutCharts() {
//Pre-sort charts by group column
MultiMap mmap = new MultiHashMap();
for (Iterator iter = getReport().getCharts().iterator(); iter.hasNext();) {
DJChart djChart = (DJChart) iter.next();
mmap.put(djChart.getColumnsGroup(), djChart);
}
for (Iterator iterator = mmap.keySet().iterator(); iterator.hasNext();) {
Object key = iterator.next();
Collection charts = (Collection) mmap.get(key);
ArrayList l = new ArrayList(charts);
//Reverse iteration of the charts to meet insertion order
for (int i = l.size(); i > 0; i--) {
DJChart djChart = (DJChart) l.get(i-1);
JRDesignChart chart = createChart(djChart);
//Charts has their own band, so they are added in the band at Y=0
JRDesignBand band = createGroupForChartAndGetBand(djChart);
band.addElement(chart);
}
}
//Pre-sort charts by group column
mmap = new MultiHashMap();
for (Iterator iter = getReport().getNewCharts().iterator(); iter.hasNext();) {
ar.com.fdvs.dj.domain.chart.DJChart djChart = (ar.com.fdvs.dj.domain.chart.DJChart) iter.next();
mmap.put(djChart.getDataset().getColumnsGroup(), djChart);
}
for (Iterator iterator = mmap.keySet().iterator(); iterator.hasNext();) {
Object key = iterator.next();
Collection charts = (Collection) mmap.get(key);
ArrayList l = new ArrayList(charts);
//Reverse iteration of the charts to meet insertion order
for (int i = l.size(); i > 0; i--) {
ar.com.fdvs.dj.domain.chart.DJChart djChart = (ar.com.fdvs.dj.domain.chart.DJChart) l.get(i-1);
String name = "chart_" + (i-1);