View Javadoc

1   /*
2    * DynamicJasper: A library for creating reports dynamically by specifying
3    * columns, groups, styles, etc. at runtime. It also saves a lot of development
4    * time in many cases! (http://sourceforge.net/projects/dynamicjasper)
5    *
6    * Copyright (C) 2008  FDV Solutions (http://www.fdvsolutions.com)
7    *
8    * This library is free software; you can redistribute it and/or
9    * modify it under the terms of the GNU Lesser General Public
10   *
11   * License as published by the Free Software Foundation; either
12   *
13   * version 2.1 of the License, or (at your option) any later version.
14   *
15   * This library is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   *
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19   *
20   * Lesser General Public License for more details.
21   *
22   * You should have received a copy of the GNU Lesser General Public
23   * License along with this library; if not, write to the Free Software
24   *
25   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
26   *
27   *
28   */
29  
30  package ar.com.fdvs.dj.domain;
31  
32  import java.util.ArrayList;
33  import java.util.List;
34  
35  import net.sf.jasperreports.engine.design.JRDesignChart;
36  import net.sf.jasperreports.engine.design.JRDesignVariable;
37  import ar.com.fdvs.dj.domain.entities.DJGroup;
38  import ar.com.fdvs.dj.domain.entities.Entity;
39  import ar.com.fdvs.dj.domain.entities.columns.AbstractColumn;
40  import net.sf.jasperreports.engine.type.CalculationEnum;
41  
42  /**
43   * Charts to be displayed by dynamicjasper
44   * @author msimone
45   * @deprecated
46   */
47  public class DJChart extends DJBaseElement{
48  
49  	private static final long serialVersionUID = Entity.SERIAL_VERSION_UID;
50  	
51  	//The possible chart types
52  	public static final byte PIE_CHART = JRDesignChart.CHART_TYPE_PIE;
53  	public static final byte BAR_CHART = JRDesignChart.CHART_TYPE_BAR;
54  //	public static final byte LINE_CHART = JRDesignChart.CHART_TYPE_LINE; //not yet... to much to think left
55  
56  	//The possible calculation types
57  	public static final byte CALCULATION_COUNT = CalculationEnum.COUNT.getValue();
58  	public static final byte CALCULATION_SUM = CalculationEnum.SUM.getValue();
59  
60  	//How to build the chart?
61  	private byte type;
62  	private DJGroup columnsGroup;
63  //	private AbstractColumn column;
64  	
65  	/**
66  	 * List<AbstractColumn>
67  	 */
68  	private List columns = new ArrayList();
69  	
70  
71  	private byte operation;
72  
73  	//How to show the chart?
74  	private DJChartOptions chartOptions;
75  
76  	public DJChart(){}
77  
78  	public DJChart(byte type, DJGroup columnsGroup, AbstractColumn column, byte operation, DJChartOptions chartOptions){
79  		this.type = type;
80  		this.columnsGroup = columnsGroup;
81  		
82  		if (column != null)
83  			this.columns.add(column);
84  		
85  		this.operation = operation;
86  		this.chartOptions = chartOptions;
87  	}
88  	
89  	public DJChart(byte type, DJGroup columnsGroup, List columns, byte operation, DJChartOptions chartOptions){
90  		this.type = type;
91  		this.columnsGroup = columnsGroup;
92  		
93  		if (columns != null)
94  			this.columns.addAll(columns);
95  		
96  		this.operation = operation;
97  		this.chartOptions = chartOptions;
98  	}
99  
100 //	public AbstractColumn getColumn() {
101 //		return column;
102 //	}
103 //
104 //	public void setColumn(AbstractColumn column) {
105 //		this.column = column;
106 //	}
107 
108 	public byte getOperation() {
109 		return operation;
110 	}
111 
112 	public void setOperation(byte operation) {
113 		this.operation = operation;
114 	}
115 
116 	public byte getType() {
117 		return type;
118 	}
119 
120 	public void setType(byte type) {
121 		this.type = type;
122 	}
123 
124 	public DJGroup getColumnsGroup() {
125 		return columnsGroup;
126 	}
127 
128 	public void setColumnsGroup(DJGroup columnsGroup) {
129 		this.columnsGroup = columnsGroup;
130 	}
131 
132 	public DJChartOptions getOptions() {
133 		return chartOptions;
134 	}
135 
136 	public void setOptions(DJChartOptions options) {
137 		this.chartOptions = options;
138 	}
139 	
140 	public List getColumns() {
141 		return columns;
142 	}
143 
144 	public void setColumns(List columns) {
145 		this.columns = columns;
146 	}
147 	
148 }