1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2006 STZ-IDA, Germany, http://www.stz-ida.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Til Schneider (til132)
************************************************************************ */
/* ************************************************************************
#module(ui_table)
************************************************************************ */
/**
* The data model of a table.
*
* @event dataChanged {qx.event.type.DataEvent} Fired when the table data changed
* (the stuff shown in the table body). The data property of the event
* may be null or a map having the following attributes:
* <ul>
* <li>firstRow: The index of the first row that has changed.</li>
* <li>lastRow: The index of the last row that has changed.</li>
* <li>firstColumn: The model index of the first column that has changed.</li>
* <li>lastColumn: The model index of the last column that has changed.</li>
* </ul>
* @event metaDataChanged {qx.event.type.Event} Fired when the meta data changed
* (the stuff shown in the table header).
*/
qx.OO.defineClass("qx.ui.table.TableModel", qx.core.Target,
function() {
qx.core.Target.call(this);
});
/**
* Returns the number of rows in the model.
*
* @return {Integer} the number of rows.
*/
qx.Proto.getRowCount = function() {
throw new Error("getRowCount is abstract");
}
/**
* <p>Returns the data of one row. This function may be overriden by models which hold
* all data of a row in one object. By using this function, clients have a way of
* quickly retrieving the entire row data.</p>
*
* <p><b>Important:</b>Models which do not have their row data accessible in one object
* may return null.</p>
*
* @param rowIndex {Integer} the model index of the row.
* @return {Object} the row data as an object or null if the model does not support row data
* objects. The details on the object returned are determined by the model
* implementation only.
*/
qx.Proto.getRowData = function(rowIndex) {
return null;
}
/**
* Returns the number of columns in the model.
*
* @return {Integer} the number of columns.
*/
qx.Proto.getColumnCount = function() {
throw new Error("getColumnCount is abstract");
}
/**
* Returns the ID of column. The ID may be used to identify columns
* independent from their index in the model. E.g. for being aware of added
* columns when saving the width of a column.
*
* @param columnIndex {Integer} the index of the column.
* @return {String} the ID of the column.
*/
qx.Proto.getColumnId = function(columnIndex) {
throw new Error("getColumnId is abstract");
}
/**
* Returns the index of a column.
*
* @param columnId {String} the ID of the column.
* @return {Integer} the index of the column.
*/
qx.Proto.getColumnIndexById = function(columnId) {
throw new Error("getColumnIndexById is abstract");
}
/**
* Returns the name of a column. This name will be shown to the user in the
* table header.
*
* @param columnIndex {Integer} the index of the column.
* @return {String} the name of the column.
*/
qx.Proto.getColumnName = function(columnIndex) {
throw new Error("getColumnName is abstract");
}
/**
* Returns whether a column is editable.
*
* @param columnIndex {Integer} the column to check.
* @return {Boolean} whether the column is editable.
*/
qx.Proto.isColumnEditable = function(columnIndex) {
return false;
}
/**
* Returns whether a column is sortable.
*
* @param columnIndex {Integer} the column to check.
* @return {Boolean} whether the column is sortable.
*/
qx.Proto.isColumnSortable = function(columnIndex) {
return false;
}
/**
* Sorts the model by a column.
*
* @param columnIndex {Integer} the column to sort by.
* @param ascending {Boolean} whether to sort ascending.
*/
qx.Proto.sortByColumn = function(columnIndex, ascending) {
}
/**
* Returns the column index the model is sorted by. If the model is not sorted
* -1 is returned.
*
* @return {Integer} the column index the model is sorted by.
*/
qx.Proto.getSortColumnIndex = function() {
return -1;
}
/**
* Returns whether the model is sorted ascending.
*
* @return {Boolean} whether the model is sorted ascending.
*/
qx.Proto.isSortAscending = function() {
return true;
}
/**
* Prefetches some rows. This is a hint to the model that the specified rows
* will be read soon.
*
* @param firstRowIndex {Integer} the index of first row.
* @param lastRowIndex {Integer} the index of last row.
*/
qx.Proto.prefetchRows = function(firstRowIndex, lastRowIndex) {
}
/**
* Returns a cell value by column index.
*
* @param columnIndex {Integer} the index of the column.
* @param rowIndex {Integer} the index of the row.
* @return {var} The value of the cell.
* @see #getValueById{}
*/
qx.Proto.getValue = function(columnIndex, rowIndex) {
throw new Error("getValue is abstract");
}
/**
* Returns a cell value by column ID.
* <p>
* Whenever you have the choice, use {@link #getValue()} instead,
* because this should be faster.
*
* @param columnId {String} the ID of the column.
* @param rowIndex {Integer} the index of the row.
* @return {var} the value of the cell.
*/
qx.Proto.getValueById = function(columnId, rowIndex) {
return this.getValue(this.getColumnIndexById(columnId), rowIndex);
}
/**
* Sets a cell value by column index.
*
* @param columnIndex {Integer} The index of the column.
* @param rowIndex {Integer} the index of the row.
* @param value {var} The new value.
* @see #setValueById{}
*/
qx.Proto.setValue = function(columnIndex, rowIndex, value) {
throw new Error("setValue is abstract");
}
/**
* Sets a cell value by column ID.
* <p>
* Whenever you have the choice, use {@link #setValue()} instead,
* because this should be faster.
*
* @param columnId {String} The ID of the column.
* @param rowIndex {Integer} The index of the row.
* @param value {var} The new value.
*/
qx.Proto.setValueById = function(columnId, rowIndex, value) {
return this.setValue(this.getColumnIndexById(columnId), rowIndex, value);
}
/** {string} The type of the event fired when the data changed. */
qx.Class.EVENT_TYPE_DATA_CHANGED = "dataChanged";
/** {string} The type of the event fired when the meta data changed. */
qx.Class.EVENT_TYPE_META_DATA_CHANGED = "metaDataChanged";
|