KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > laures > cewolf > taglib > AxisFactory


1 package de.laures.cewolf.taglib;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.jfree.chart.axis.Axis;
6 import org.jfree.chart.axis.CategoryAxis;
7 import org.jfree.chart.axis.DateAxis;
8 import org.jfree.chart.axis.NumberAxis;
9 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 JavaDoc 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 JavaDoc("unsupported axis type constant " + type);
42         }
43     }
44
45 }
46
Popular Tags