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.entities.columns;
31  
32  import ar.com.fdvs.dj.domain.DJBaseElement;
33  import ar.com.fdvs.dj.domain.DJCalculation;
34  import ar.com.fdvs.dj.domain.DJHyperLink;
35  import ar.com.fdvs.dj.domain.Style;
36  import ar.com.fdvs.dj.domain.entities.DJColSpan;
37  import ar.com.fdvs.dj.domain.entities.Entity;
38  
39  import java.text.Format;
40  import java.util.ArrayList;
41  import java.util.List;
42  
43  /**
44   * Abstract Class used as base for the different Column types.
45   */
46  public abstract class AbstractColumn extends DJBaseElement {
47  
48  	private static final long serialVersionUID = Entity.SERIAL_VERSION_UID;
49  
50      /**
51       * Internal column name.
52       * used to generate expression names related to this column (variables, custom expression, etc)
53       * Its name is given in the ColumnRegistrationManager
54       */
55  	private String name;
56  
57      /**
58       * For internal use only. will be initialized with the report name and subclasses can benefit
59       * from it to create expression which needs the report prefix
60       */
61      private String reportName;
62  
63  	private String title;
64  	private Integer posX = new Integer(0);
65  	private Integer posY = new Integer(0);
66  	private Integer width = new Integer(100);
67  	private Boolean fixedWidth = Boolean.FALSE;
68  	private Style style = new Style();
69  	private Style headerStyle = null;
70  	private String pattern;
71  	private Boolean printRepeatedValues = Boolean.TRUE;
72  	private Boolean blankWhenNull = Boolean.TRUE;
73  	private String truncateSuffix = null;
74  	private Format textFormatter;
75  
76      /**
77       * Markup to use in the column data (html, styled, etc)
78       */
79      private String markup;
80  
81      /**
82       * Markup to use in the column header (html, styled, etc)
83       */
84      private String headerMarkup;
85  
86      private DJHyperLink link;
87  	
88  	private List conditionalStyles = new ArrayList();
89  
90      private DJColSpan colSpan;
91  
92  	public List getConditionalStyles() {
93  		return conditionalStyles;
94  	}
95  
96  	public void setConditionalStyles(List conditionalStyles) {
97  		this.conditionalStyles = conditionalStyles;
98  	}
99  
100 	public String getTitle() {
101 		return title;
102 	}
103 
104 	public void setTitle(String label) {
105 		this.title = label;
106 	}
107 
108 	public Integer getPosX() {
109 		return posX;
110 	}
111 
112 	public void setPosX(Integer posX) {
113 		this.posX = posX;
114 	}
115 
116 	public Integer getPosY() {
117 		return posY;
118 	}
119 
120 	public void setPosY(Integer posY) {
121 		this.posY = posY;
122 	}
123 
124 	public Style getHeaderStyle() {
125 		return headerStyle;
126 	}
127 
128 	public void setHeaderStyle(Style headerStyle) {
129 		this.headerStyle = headerStyle;
130 	}
131 
132 	public Style getStyle() {
133 		return style;
134 	}
135 
136 	public void setStyle(Style style) {
137 		this.style = style;
138 	}
139 
140 	public Integer getWidth() {
141 		return width;
142 	}
143 
144 	public void setWidth(Integer width) {
145 		this.width = width;
146 	}
147 
148 	public String getPattern() {
149 		return pattern;
150 	}
151 
152 	public void setPattern(String pattern) {
153 		this.pattern = pattern;
154 	}
155 
156 	public Boolean getPrintRepeatedValues() {
157 		return printRepeatedValues;
158 	}
159 
160 	public void setPrintRepeatedValues(Boolean printRepeatedValues) {
161 		this.printRepeatedValues = printRepeatedValues;
162 	}
163 
164 	public abstract String getTextForExpression();
165 
166 	public abstract String getValueClassNameForExpression();
167 
168 	/**
169 	 * 
170 	 * @param type "FOOTER" or "HEADER"
171 	 * @param columnToGroupByProperty
172 	 * @return The name of group of variables
173 	 */
174 	public abstract String getGroupVariableName(String type, String columnToGroupByProperty);
175 
176 	public abstract String getVariableClassName(DJCalculation op);
177 
178 	public abstract String getInitialExpression(DJCalculation op);
179 
180 	public String getName() {
181 		return name;
182 	}
183 
184 	public void setName(String name) {
185 		this.name = name;
186 	}
187 
188 	public Boolean getBlankWhenNull() {
189 		return blankWhenNull;
190 	}
191 
192 	public void setBlankWhenNull(Boolean blankWhenNull) {
193 		this.blankWhenNull = blankWhenNull;
194 	}
195 
196 	public Boolean getFixedWidth() {
197 		return fixedWidth;
198 	}
199 
200 	public void setFixedWidth(Boolean fixedWidth) {
201 		this.fixedWidth = fixedWidth;
202 	}
203 
204 	public String getTruncateSuffix() {
205 		return truncateSuffix;
206 	}
207 
208 	public void setTruncateSuffix(String truncateSuffix) {
209 		this.truncateSuffix = truncateSuffix;
210 	}
211 
212 	public Format getTextFormatter() {
213 		return textFormatter;
214 	}
215 
216 	public void setTextFormatter(Format textFormatter) {
217 		this.textFormatter = textFormatter;
218 	}
219 
220 	public DJHyperLink getLink() {
221 		return link;
222 	}
223 
224 	public void setLink(DJHyperLink link) {
225 		this.link = link;
226 	}
227 
228     public DJColSpan getColSpan() {
229         return colSpan;
230     }
231 
232     public void setColSpan(DJColSpan colSpan) {
233         this.colSpan = colSpan;
234     }
235 
236     public boolean hasParentCol() {
237         return colSpan != null;
238     }
239 
240     public String getReportName() {
241         return reportName;
242     }
243 
244     public void setReportName(String reportName) {
245         this.reportName = reportName;
246     }
247 
248     public String getMarkup() {
249         return markup;
250     }
251 
252     public void setMarkup(String markup) {
253         this.markup = markup;
254     }
255 
256     public String getHeaderMarkup() {
257         return headerMarkup;
258     }
259 
260     public void setHeaderMarkup(String headerMarkup) {
261         this.headerMarkup = headerMarkup;
262     }
263 }