01: package com.technoetic.xplanner.charts.timesheet;
02:
03: import org.jfree.data.DefaultPieDataset;
04: import com.technoetic.xplanner.domain.virtual.Timesheet;
05: import de.laures.cewolf.DatasetProduceException;
06: import de.laures.cewolf.DatasetProducer;
07:
08: import java.math.BigDecimal;
09: import java.util.Date;
10: import java.util.Enumeration;
11: import java.util.Hashtable;
12: import java.util.Map;
13:
14: public class PersonTimesheetIterationData implements DatasetProducer {
15: private DefaultPieDataset dataSet = new DefaultPieDataset();
16:
17: public void setTimesheet(Timesheet timesheet) {
18: Hashtable iterationData = timesheet.getIterationData();
19: for (Enumeration keys = iterationData.keys(); keys
20: .hasMoreElements();) {
21: String iteration = (String) keys.nextElement();
22: BigDecimal value = ((BigDecimal) iterationData
23: .get(iteration)).setScale(0,
24: BigDecimal.ROUND_HALF_EVEN);
25: dataSet.setValue(iteration + " (" + value + ")", value);
26: }
27: }
28:
29: public Object produceDataset(Map params)
30: throws DatasetProduceException {
31: return dataSet;
32: }
33:
34: public boolean hasExpired(Map params, Date since) {
35: return true;
36: }
37:
38: public String getProducerId() {
39: return this.getClass().getName();
40: }
41: }
|