View Javadoc

1   /*
2    * Copyright 2006 Robert Hanson <iamroberthanson AT gmail.com>
3    * 
4    * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
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  
17  package org.gwtwidgets.client.ui.pagination;
18  
19  /***
20   * Column to be added as a header to the table. If a property is provided, the
21   * column will be sortable. The property can be any you will use to sort the
22   * results when results from a new page are retrieved.
23   * 
24   * @author Joe Toth (joetoth@gmail.com)
25   * 
26   */
27  public class Column {
28  
29  	String title;
30  
31  	String parameter;
32  
33  	boolean sortable;
34  
35  	/***
36  	 * Use this constructor if you do not want the column to be sortable.
37  	 * 
38  	 * @param title
39  	 */
40  	public Column(String title) {
41  		this.title = title;
42  	}
43  
44  	/***
45  	 * Use this constructor if you want the column to be sortable.
46  	 * 
47  	 * @param title
48  	 *            Column Header
49  	 * @param parameter
50  	 *            The underlying parameter is used to represent this column in
51  	 *            JDBC / EJB / Hibernate / etc. It can also be used to store and
52  	 *            send any extra data needed to perform the sort.
53  	 */
54  	public Column(String title, String parameter) {
55  		this(title);
56  		this.parameter = parameter;
57  		this.sortable = true;
58  	}
59  
60  	public String getParameter() {
61  		return parameter;
62  	}
63  
64  	public void setParameter(String parameter) {
65  		this.parameter = parameter;
66  		this.sortable = true;
67  	}
68  
69  	public String getTitle() {
70  		return title;
71  	}
72  
73  	public void setTitle(String title) {
74  		this.title = title;
75  	}
76  
77  	public boolean isSortable() {
78  		return sortable;
79  	}
80  
81  }