java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AxisFactory.java
author František Kučera <franta-hg@frantovo.cz>
Sat Feb 28 21:31:02 2009 +0100 (2009-02-28)
changeset 1 639991d0808a
permissions -rw-r--r--
Rozbalená knihovna verze 1.0
franta-hg@1
     1
package de.laures.cewolf.taglib;
franta-hg@1
     2
franta-hg@1
     3
import org.apache.commons.logging.Log;
franta-hg@1
     4
import org.apache.commons.logging.LogFactory;
franta-hg@1
     5
import org.jfree.chart.axis.Axis;
franta-hg@1
     6
import org.jfree.chart.axis.CategoryAxis;
franta-hg@1
     7
import org.jfree.chart.axis.DateAxis;
franta-hg@1
     8
import org.jfree.chart.axis.NumberAxis;
franta-hg@1
     9
import org.jfree.chart.axis.ValueAxis;
franta-hg@1
    10
franta-hg@1
    11
/**
franta-hg@1
    12
 * @author guido
franta-hg@1
    13
 *
franta-hg@1
    14
 * To change this generated comment edit the template variable "typecomment":
franta-hg@1
    15
 * Window>Preferences>Java>Templates.
franta-hg@1
    16
 * To enable and disable the creation of type comments go to
franta-hg@1
    17
 * Window>Preferences>Java>Code Generation.
franta-hg@1
    18
 */
franta-hg@1
    19
public class AxisFactory implements AxisConstants {
franta-hg@1
    20
franta-hg@1
    21
    protected Log log = LogFactory.getLog(AxisFactory.class.getName());
franta-hg@1
    22
    
franta-hg@1
    23
    private static final AxisFactory instance = new AxisFactory();
franta-hg@1
    24
    
franta-hg@1
    25
    protected AxisFactory(){
franta-hg@1
    26
    }
franta-hg@1
    27
    
franta-hg@1
    28
    public static final AxisFactory getInstance(){
franta-hg@1
    29
    	return instance;
franta-hg@1
    30
    }
franta-hg@1
    31
    
franta-hg@1
    32
	public Axis createAxis(int orientation, int type, String label) {
franta-hg@1
    33
		switch (type) {
franta-hg@1
    34
			case AXIS_TYPE_DATE :
franta-hg@1
    35
				return new DateAxis(label);
franta-hg@1
    36
			case AXIS_TYPE_NUMBER :
franta-hg@1
    37
				return new NumberAxis(label);
franta-hg@1
    38
			case AXIS_TYPE_CATEGORY://added by lrh 2005-07-11
franta-hg@1
    39
	            return new CategoryAxis(label);
franta-hg@1
    40
			default:
franta-hg@1
    41
				throw new RuntimeException("unsupported axis type constant " + type);
franta-hg@1
    42
		}
franta-hg@1
    43
	}
franta-hg@1
    44
franta-hg@1
    45
}