1
2
3
4
5
6
7
8
9
10
11 package de.jaret.util.ui.table.model;
12
13 import java.util.Comparator;
14
15 /***
16 * Interface for a column used in a jaret table model. The unique id is <b>only</b> used for storing view state
17 * information.
18 *
19 * @author Peter Kliem
20 * @version $Id: IColumn.java 608 2007-10-23 19:24:34Z kliem $
21 */
22 public interface IColumn extends Comparator<IRow> {
23 /***
24 * Id is used for storing the column width. It has to be unique among all columns if the use of the view state
25 * persisting support will be used.
26 *
27 * @return unique id.
28 */
29 String getId();
30
31 /***
32 * Return a textual label to be displayed as the column header label.
33 *
34 * @return header label
35 */
36 String getHeaderLabel();
37
38 /***
39 * Should return true for a header to be painted. Note that this ia a small violation of the separation between
40 * viewstate and data. However this can be tolerated.
41 *
42 * @return true when a header should be painted
43 */
44 boolean displayHeader();
45
46 /***
47 * Retrieve the value of the column for the given row.
48 *
49 * @param row the row
50 * @return the column value for the given row.
51 */
52 Object getValue(IRow row);
53
54 /***
55 * Set the value of the coloumn for a given row.
56 *
57 * @param row the row
58 * @param value value to set
59 */
60 void setValue(IRow row, Object value);
61
62 /***
63 * Check whether the column supports sorting.
64 *
65 * @return true when sorting is supported.
66 */
67 boolean supportsSorting();
68
69 /***
70 * To allow null values as column value and to support cell editing and displaying a column may support this method
71 * for supplying the information.
72 *
73 * @return the contained class or null if the information is not available.
74 */
75 Class<?> getContentClass();
76
77 /***
78 * To specify a content class per row this method may be implemented to reflect the appropriate class.
79 *
80 * @param row row of which to get the content class
81 * @return contained class or null if the information is not available.
82 */
83 Class<?> getContentClass(IRow row);
84
85 /***
86 * Check whether the column can be edited.
87 *
88 * @return true if the values of the columns can be changed
89 */
90 boolean isEditable();
91
92 /***
93 * Check whether a a specific cell of the column can be edited.
94 *
95 * @param row row specifying the cell in the column
96 * @return true if the ell can be changed
97 */
98 boolean isEditable(IRow row);
99
100 /***
101 * Add a listener to listen on changes on the column.
102 *
103 * @param cl listener to add
104 */
105 void addColumnListener(IColumnListener cl);
106
107 /***
108 * Remove a column listener.
109 *
110 * @param cl listener to remove
111 */
112 void remColumnListener(IColumnListener cl);
113
114 }