01: package de.laures.cewolf.taglib;
02:
03: import org.apache.commons.logging.Log;
04: import org.apache.commons.logging.LogFactory;
05: import org.jfree.chart.axis.Axis;
06: import org.jfree.chart.axis.CategoryAxis;
07: import org.jfree.chart.axis.DateAxis;
08: import org.jfree.chart.axis.NumberAxis;
09: import org.jfree.chart.axis.ValueAxis;
10:
11: /**
12: * @author guido
13: *
14: * To change this generated comment edit the template variable "typecomment":
15: * Window>Preferences>Java>Templates.
16: * To enable and disable the creation of type comments go to
17: * Window>Preferences>Java>Code Generation.
18: */
19: public class AxisFactory implements AxisConstants {
20:
21: protected Log log = LogFactory.getLog(AxisFactory.class.getName());
22:
23: private static final AxisFactory instance = new AxisFactory();
24:
25: protected AxisFactory() {
26: }
27:
28: public static final AxisFactory getInstance() {
29: return instance;
30: }
31:
32: public Axis createAxis(int orientation, int type, String label) {
33: switch (type) {
34: case AXIS_TYPE_DATE:
35: return new DateAxis(label);
36: case AXIS_TYPE_NUMBER:
37: return new NumberAxis(label);
38: case AXIS_TYPE_CATEGORY://added by lrh 2005-07-11
39: return new CategoryAxis(label);
40: default:
41: throw new RuntimeException(
42: "unsupported axis type constant " + type);
43: }
44: }
45:
46: }
|