/*
* Copyright Massimiliano Dessì (desmax74@yahoo.it)
*
* Licensed for non-commercial use,
* under Apache License Version 2.0
* (http://www.apache.org/licenses/LICENSE-2.0),
*
* for commercial use, under
* GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*/
package org.magicbox.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javolution.util.FastMap;
import org.jfree.data.general.Dataset;
import org.magicbox.chart.XYChart;
import org.magicbox.chart.view.PngView;
import org.magicbox.dto.SpedizioneCriteria;
import org.magicbox.util.Constant;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
//TODO da rifare
public class GraphController extends AbstractController {
protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServletResponse res) throws Exception {
Dataset storico = (Dataset) req.getAttribute(Constant.SPEDIZIONE);
XYChart chart = new XYChart(new SpedizioneCriteria());
Map<Object, Object> model = new FastMap<Object, Object>();
model.put(Constant.GRAFICO, chart.getGraph());
return new ModelAndView(new PngView(), model);
// return null;
}
}