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 PersonTimesheetProjectData implements DatasetProducer {
15: private DefaultPieDataset dataSet = new DefaultPieDataset();
16:
17: public void setTimesheet(Timesheet timesheet) {
18: Hashtable projectData = timesheet.getProjectData();
19: for (Enumeration keys = projectData.keys(); keys
20: .hasMoreElements();) {
21: String project = (String) keys.nextElement();
22: BigDecimal value = ((BigDecimal) projectData.get(project))
23: .setScale(0, BigDecimal.ROUND_HALF_EVEN);
24: dataSet.setValue(project + " (" + value + ")", value);
25: }
26: }
27:
28: public Object produceDataset(Map params)
29: throws DatasetProduceException {
30: return dataSet;
31: }
32:
33: public boolean hasExpired(Map params, Date since) {
34: return true;
35: }
36:
37: public String getProducerId() {
38: return this.getClass().getName();
39: }
40: }
|