001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.core.web.ui;
017:
018: import java.util.Comparator;
019:
020: import org.kuali.core.web.format.Formatter;
021:
022: /**
023: * This class represents a column in a result table.
024: *
025: *
026: */
027:
028: public class Column implements java.io.Serializable {
029: private static final long serialVersionUID = -5916942413570667803L;
030: private String columnTitle;
031: private String sortable = "true";
032: private String propertyName;
033: private String propertyValue;
034: private String propertyURL;
035: private Formatter formatter;
036: private Comparator comparator;
037:
038: /**
039: * A comparator used to compare the propertyValue values
040: */
041: private Comparator valueComparator;
042:
043: /**
044: * Represents the maximum column length. If propertyValue's length exceeds this value, then
045: * it will be truncated to this length when displayed
046: */
047: private int maxLength;
048:
049: public Column() {
050: }
051:
052: public Column(String columnTitle, String sortable,
053: String propertyName) {
054: this .columnTitle = columnTitle;
055: this .sortable = sortable;
056: this .propertyName = propertyName;
057: }
058:
059: public Column(String columnTitle, String sortable,
060: String propertyName, Comparator comparator) {
061: this (columnTitle, sortable, propertyName);
062: this .comparator = comparator;
063: }
064:
065: public Column(String columnTitle, String propertyName,
066: Formatter formatter) {
067: this .columnTitle = columnTitle;
068: this .propertyName = propertyName;
069: this .formatter = formatter;
070: }
071:
072: /**
073: * @return Returns the comparator.
074: */
075: public Comparator getComparator() {
076: return comparator;
077: }
078:
079: /**
080: * @param comparator The comparator to set.
081: */
082: public void setComparator(Comparator comparator) {
083: this .comparator = comparator;
084: }
085:
086: /**
087: * @return Returns the columnTitle.
088: */
089: public String getColumnTitle() {
090: return columnTitle;
091: }
092:
093: /**
094: * @param columnTitle The columnTitle to set.
095: */
096: public void setColumnTitle(String columnTitle) {
097: this .columnTitle = columnTitle;
098: }
099:
100: /**
101: * @return Returns the propertyName.
102: */
103: public String getPropertyName() {
104: return propertyName;
105: }
106:
107: /**
108: * @param propertyName The propertyName to set.
109: */
110: public void setPropertyName(String propertyName) {
111: this .propertyName = propertyName;
112: }
113:
114: /**
115: * @return Returns the sortable.
116: */
117: public String getSortable() {
118: return sortable;
119: }
120:
121: /**
122: * @param sortable The sortable to set.
123: */
124: public void setSortable(String sortable) {
125: this .sortable = sortable;
126: }
127:
128: /**
129: * @return Returns the propertyURL.
130: */
131: public String getPropertyURL() {
132: return propertyURL;
133: }
134:
135: /**
136: * @param propertyURL The propertyURL to set.
137: */
138: public void setPropertyURL(String propertyURL) {
139: this .propertyURL = propertyURL;
140: }
141:
142: /**
143: * @return Returns the propertyValue.
144: */
145: public String getPropertyValue() {
146: return propertyValue;
147: }
148:
149: /**
150: * @param propertyValue The propertyValue to set.
151: */
152: public void setPropertyValue(String propertyValue) {
153: this .propertyValue = propertyValue;
154: }
155:
156: /**
157: * @return Returns the formatter.
158: */
159: public Formatter getFormatter() {
160: return formatter;
161: }
162:
163: /**
164: * @param formatter The formatter to set.
165: */
166: public void setFormatter(Formatter formatter) {
167: this .formatter = formatter;
168: }
169:
170: public Comparator getValueComparator() {
171: return valueComparator;
172: }
173:
174: public void setValueComparator(Comparator valueComparator) {
175: this .valueComparator = valueComparator;
176: }
177:
178: /**
179: * Returns the maximum column length. If propertyValue's length exceeds this value, then
180: * it will be truncated to this length when displayed
181: * @return
182: */
183: public int getMaxLength() {
184: return maxLength;
185: }
186:
187: /**
188: * Sets the maximum column length. If propertyValue's length exceeds this value, then
189: * it will be truncated to this length when displayed
190: * @param maxColumnLength
191: */
192: public void setMaxLength(int maxColumnLength) {
193: this.maxLength = maxColumnLength;
194: }
195: }
|