View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kns.web.ui;
17  
18  import org.kuali.rice.core.web.format.Formatter;
19  import org.kuali.rice.kns.lookup.HtmlData;
20  import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
21  import org.kuali.rice.kns.lookup.HtmlData.MultipleAnchorHtmlData;
22  
23  import java.util.ArrayList;
24  import java.util.Comparator;
25  import java.util.List;
26  
27  /**
28   * Represents a Column in a result table
29   * 
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  @Deprecated
33  public class Column implements java.io.Serializable, PropertyRenderingConfigElement {
34      private static final long serialVersionUID = -5916942413570667803L;
35      private String columnTitle;
36      private String sortable = "true";
37      private String propertyName;
38      private String propertyValue;
39      private Object unformattedPropertyValue;
40      private String propertyURL;
41      private HtmlData columnAnchor;
42      private Formatter formatter;
43      private Comparator comparator;
44      private boolean escapeXMLValue=true;
45      
46      private String alternateDisplayPropertyName;
47      private String additionalDisplayPropertyName;
48      
49      private boolean total;
50      
51      /**
52       * A comparator used to compare the propertyValue values
53       */
54      private Comparator valueComparator;
55      
56      /**
57       * Represents the maximum column length.  If propertyValue's length exceeds this value, then 
58       * it will be truncated to this length when displayed
59       */
60      private int maxLength;
61      
62      public Column() {
63      }
64      
65      public Column(String columnTitle, String propertyName) {
66          this.columnTitle = columnTitle;
67          this.propertyName = propertyName;
68      }
69      
70      public Column(String columnTitle, String sortable, String propertyName) {
71          this.columnTitle = columnTitle;
72          this.sortable = sortable;
73          this.propertyName = propertyName;
74      }
75  
76      public Column(String columnTitle, String sortable, String propertyName, Comparator comparator) {
77          this(columnTitle, sortable, propertyName);
78          this.comparator = comparator;
79      }
80  
81      public Column(String columnTitle, String propertyName, Formatter formatter) {
82          this.columnTitle = columnTitle;
83          this.propertyName = propertyName;
84          this.formatter = formatter;
85      }
86  
87      /**
88       * @return Returns the comparator.
89       */
90      public Comparator getComparator() {
91          return comparator;
92      }
93  
94  
95      /**
96       * @param comparator The comparator to set.
97       */
98      public void setComparator(Comparator comparator) {
99          this.comparator = comparator;
100     }
101 
102 
103     /**
104      * @return Returns the columnTitle.
105      */
106     public String getColumnTitle() {
107         return columnTitle;
108     }
109 
110 
111     /**
112      * @param columnTitle The columnTitle to set.
113      */
114     public void setColumnTitle(String columnTitle) {
115         this.columnTitle = columnTitle;
116     }
117 
118 
119     /**
120      * @return Returns the propertyName.
121      */
122     public String getPropertyName() {
123         return propertyName;
124     }
125 
126 
127     /**
128      * @param propertyName The propertyName to set.
129      */
130     public void setPropertyName(String propertyName) {
131         this.propertyName = propertyName;
132     }
133 
134 
135     /**
136      * @return Returns the sortable.
137      */
138     public String getSortable() {
139         return sortable;
140     }
141 
142 
143     /**
144      * @param sortable The sortable to set.
145      */
146     public void setSortable(String sortable) {
147         this.sortable = sortable;
148     }
149 
150 
151     /**
152      * @return Returns the propertyURL.
153      */
154     public String getPropertyURL() {
155         return propertyURL;
156     }
157 
158 
159     /**
160      * @param propertyURL The propertyURL to set.
161      */
162     public void setPropertyURL(String propertyURL) {
163         this.propertyURL = propertyURL;
164     }
165 
166 	/**
167 	 * @return the columnAnchor
168 	 */
169 	public HtmlData getColumnAnchor() {
170 		return this.columnAnchor;
171 	}
172 
173 	public boolean isMultipleAnchors(){
174 		return this.columnAnchor instanceof MultipleAnchorHtmlData;
175 	}
176 
177 	public List<AnchorHtmlData> getColumnAnchors(){
178 		if(isMultipleAnchors())
179 			return ((MultipleAnchorHtmlData)this.columnAnchor).getAnchorHtmlData();
180 		List<AnchorHtmlData> htmlData = new ArrayList<AnchorHtmlData>();
181 		htmlData.add((AnchorHtmlData)columnAnchor);
182 		return htmlData;
183 	}
184 
185 	public int getNumberOfColumnAnchors(){
186 		return getColumnAnchors().size();
187 	}
188 
189 	/**
190 	 * @param columnAnchor the columnAnchor to set
191 	 */
192 	public void setColumnAnchor(HtmlData columnAnchor) {
193 		this.columnAnchor = columnAnchor;
194 		if(columnAnchor!=null) 
195 			setPropertyURL(((AnchorHtmlData)columnAnchor).getHref());
196 	}
197 
198 	/**
199      * @return Returns the propertyValue.
200      */
201     public String getPropertyValue() {
202         return propertyValue;
203     }
204 
205 
206     /**
207      * @param propertyValue The propertyValue to set.
208      */
209     public void setPropertyValue(String propertyValue) {
210         this.propertyValue = propertyValue;
211     }
212     
213     /**
214      * @return Returns the formatter.
215      */
216     public Formatter getFormatter() {
217         return formatter;
218     }
219 
220 
221     /**
222      * @param formatter The formatter to set.
223      */
224     public void setFormatter(Formatter formatter) {
225         this.formatter = formatter;
226     }
227 
228     public Comparator getValueComparator() {
229         return valueComparator;
230     }
231 
232     public void setValueComparator(Comparator valueComparator) {
233         this.valueComparator = valueComparator;
234     }
235 
236     /**
237      * Returns the maximum column length.  If propertyValue's length exceeds this value, then 
238      * it will be truncated to this length when displayed
239      * @return
240      */
241     public int getMaxLength() {
242         return maxLength;
243     }
244 
245     /**
246      * Sets the maximum column length.  If propertyValue's length exceeds this value, then 
247      * it will be truncated to this length when displayed
248      * @param maxColumnLength
249      */
250     public void setMaxLength(int maxColumnLength) {
251         this.maxLength = maxColumnLength;
252     }
253 
254 	/**
255 	 * @return the escapeXMLValue
256 	 */
257 	public boolean isEscapeXMLValue() {
258 		return this.escapeXMLValue;
259 	}
260 
261 	/**
262 	 * @param escapeXMLValue the escapeXMLValue to set
263 	 */
264 	public void setEscapeXMLValue(boolean escapeXMLValue) {
265 		this.escapeXMLValue = escapeXMLValue;
266 	}
267 
268 	public String getAlternateDisplayPropertyName() {
269 		return this.alternateDisplayPropertyName;
270 	}
271 
272 	public void setAlternateDisplayPropertyName(String alternateDisplayPropertyName) {
273 		this.alternateDisplayPropertyName = alternateDisplayPropertyName;
274 	}
275 
276 	public String getAdditionalDisplayPropertyName() {
277 		return this.additionalDisplayPropertyName;
278 	}
279 
280 	public void setAdditionalDisplayPropertyName(String additionalDisplayPropertyName) {
281 		this.additionalDisplayPropertyName = additionalDisplayPropertyName;
282 	}
283 
284 	public boolean isTotal() {
285 		return this.total;
286 	}
287 
288 	public void setTotal(boolean total) {
289 		this.total = total;
290 	}
291 
292 	public Object getUnformattedPropertyValue() {
293 		return this.unformattedPropertyValue;
294 	}
295 
296 	public void setUnformattedPropertyValue(Object unformattedPropertyValue) {
297 		this.unformattedPropertyValue = unformattedPropertyValue;
298 	}
299 	
300 }