Lines 247-281
Link Here
|
247 |
return -1; |
247 |
return -1; |
248 |
} |
248 |
} |
249 |
|
249 |
|
250 |
/* If true, column property should be comparable - allows sorting |
250 |
/** |
|
|
251 |
* If true, column property should be comparable - allows sorting |
252 |
* @param column Index of a visible column |
251 |
*/ |
253 |
*/ |
252 |
boolean isComparableColumn(int column) { |
254 |
boolean isComparableColumn(int column) { |
253 |
Property p = allPropertyColumns[propertyColumns[column]].getProperty(); |
255 |
return isComparableColumnEx( propertyColumns[column] ); |
|
|
256 |
} |
257 |
|
258 |
/** |
259 |
* If true, column property should be comparable - allows sorting |
260 |
* @param column Index to the array of all properties |
261 |
*/ |
262 |
boolean isComparableColumnEx(int column) { |
263 |
Property p = allPropertyColumns[column].getProperty(); |
254 |
Object o = p.getValue( ATTR_COMPARABLE_COLUMN ); |
264 |
Object o = p.getValue( ATTR_COMPARABLE_COLUMN ); |
255 |
if ( o != null && o instanceof Boolean ) |
265 |
if ( o != null && o instanceof Boolean ) |
256 |
return ((Boolean)o).booleanValue(); |
266 |
return ((Boolean)o).booleanValue(); |
257 |
return false; |
267 |
return false; |
258 |
} |
268 |
} |
259 |
|
269 |
|
|
|
270 |
/** |
271 |
* @param column Index to the array of all properties |
272 |
* @return True if the property at the given index is visible |
273 |
*/ |
274 |
boolean isVisibleColumnEx( int column ) { |
275 |
for( int i=0; i<propertyColumns.length; i++ ) { |
276 |
if( column == propertyColumns[i] ) |
277 |
return true; |
278 |
} |
279 |
return false; |
280 |
} |
281 |
|
260 |
/* If true, at least one column is comparable |
282 |
/* If true, at least one column is comparable |
261 |
*/ |
283 |
*/ |
262 |
boolean existsComparableColumn() { |
284 |
boolean existsComparableColumn() { |
263 |
return existsComparableColumn; |
285 |
return existsComparableColumn; |
264 |
} |
286 |
} |
265 |
|
287 |
|
266 |
/* If true, column is currently used for sorting |
288 |
/** |
|
|
289 |
* If true, column is currently used for sorting |
290 |
* @param Index to the array of all properties (the column may not be visible) |
267 |
*/ |
291 |
*/ |
268 |
boolean isSortingColumn(int column) { |
292 |
boolean isSortingColumnEx(int column) { |
269 |
Property p = allPropertyColumns[propertyColumns[column]].getProperty(); |
293 |
Property p = allPropertyColumns[column].getProperty(); |
270 |
Object o = p.getValue( ATTR_SORTING_COLUMN ); |
294 |
Object o = p.getValue( ATTR_SORTING_COLUMN ); |
271 |
if ( o != null && o instanceof Boolean ) |
295 |
if ( o != null && o instanceof Boolean ) |
272 |
return ((Boolean)o).booleanValue(); |
296 |
return ((Boolean)o).booleanValue(); |
273 |
return false; |
297 |
return false; |
274 |
} |
298 |
} |
275 |
|
299 |
|
276 |
/* Sets column to be currently used for sorting |
300 |
/** |
|
|
301 |
* Sets column to be currently used for sorting |
302 |
*@param Index to the array of all properties (the column may not by visible) |
277 |
*/ |
303 |
*/ |
278 |
void setSortingColumn(int column) { |
304 |
void setSortingColumnEx(int column) { |
279 |
if ( sortColumn != -1 ) { |
305 |
if ( sortColumn != -1 ) { |
280 |
Property p = allPropertyColumns[ sortColumn ].getProperty(); |
306 |
Property p = allPropertyColumns[ sortColumn ].getProperty(); |
281 |
p.setValue( ATTR_SORTING_COLUMN, Boolean.FALSE ); |
307 |
p.setValue( ATTR_SORTING_COLUMN, Boolean.FALSE ); |
Lines 283-289
Link Here
|
283 |
} |
309 |
} |
284 |
|
310 |
|
285 |
if ( column != -1 ) { |
311 |
if ( column != -1 ) { |
286 |
sortColumn = propertyColumns[column]; |
312 |
sortColumn = column; //propertyColumns[column]; |
287 |
Property p = allPropertyColumns[ sortColumn ].getProperty(); |
313 |
Property p = allPropertyColumns[ sortColumn ].getProperty(); |
288 |
p.setValue( ATTR_SORTING_COLUMN, Boolean.TRUE ); |
314 |
p.setValue( ATTR_SORTING_COLUMN, Boolean.TRUE ); |
289 |
} |
315 |
} |
Lines 291-303
Link Here
|
291 |
sortColumn = -1; |
317 |
sortColumn = -1; |
292 |
} |
318 |
} |
293 |
|
319 |
|
|
|
320 |
int translateVisibleColumnIndex( int index ) { |
321 |
if( index < 0 ) |
322 |
return index; |
323 |
return propertyColumns[index]; |
324 |
} |
325 |
|
294 |
/* Gets column index of sorting column, if it's visible. |
326 |
/* Gets column index of sorting column, if it's visible. |
295 |
* Otherwise returns -1. |
327 |
* Otherwise returns -1. |
296 |
*/ |
328 |
*/ |
297 |
int getVisibleSortingColumn() { |
329 |
int getVisibleSortingColumn() { |
298 |
if ( sortColumn == -1 ) { |
330 |
if ( sortColumn == -1 ) { |
299 |
for (int i = 0; i < propertyColumns.length; i++) { |
331 |
for (int i = 0; i < propertyColumns.length; i++) { |
300 |
if ( isSortingColumn( i ) ) { |
332 |
if ( isSortingColumnEx( propertyColumns[i] ) ) { |
301 |
sortColumn = propertyColumns[i]; |
333 |
sortColumn = propertyColumns[i]; |
302 |
return i; |
334 |
return i; |
303 |
} |
335 |
} |
Lines 306-316
Link Here
|
306 |
else { |
338 |
else { |
307 |
if ( isVisible( allPropertyColumns[ sortColumn ].getProperty() ) ) |
339 |
if ( isVisible( allPropertyColumns[ sortColumn ].getProperty() ) ) |
308 |
return getVisibleIndex( sortColumn ); |
340 |
return getVisibleIndex( sortColumn ); |
309 |
sortColumn = -1; |
|
|
310 |
} |
341 |
} |
311 |
return -1; |
342 |
return -1; |
312 |
} |
343 |
} |
313 |
|
344 |
|
|
|
345 |
|
346 |
/* Gets column index of sorting column, if it's visible. |
347 |
* Otherwise returns -1. |
348 |
*/ |
349 |
int getSortingColumn() { |
350 |
if ( sortColumn == -1 ) { |
351 |
for (int i = 0; i < allPropertyColumns.length; i++) { |
352 |
if ( isSortingColumnEx( i ) ) { |
353 |
sortColumn = i; |
354 |
return i; |
355 |
} |
356 |
} |
357 |
} |
358 |
else { |
359 |
return sortColumn; |
360 |
} |
361 |
return -1; |
362 |
} |
363 |
|
314 |
/* If true, current sorting uses descending order. |
364 |
/* If true, current sorting uses descending order. |
315 |
*/ |
365 |
*/ |
316 |
boolean isSortOrderDescending() { |
366 |
boolean isSortOrderDescending() { |
Lines 357-372
Link Here
|
357 |
return nodeRows[row]; |
407 |
return nodeRows[row]; |
358 |
} |
408 |
} |
359 |
|
409 |
|
360 |
/** Helper method to ask for a property representant of column. |
410 |
/** |
|
|
411 |
* Helper method to ask for a property representant of column. |
412 |
* @param Index of a visible column |
361 |
*/ |
413 |
*/ |
362 |
Property propertyForColumn(int column) { |
414 |
Property propertyForColumn(int column) { |
|
|
415 |
if( column >= 0 ) |
416 |
column = propertyColumns[column]; |
417 |
return propertyForColumnEx( column ); |
418 |
} |
419 |
|
420 |
/** |
421 |
* Helper method to ask for a property representant of column. |
422 |
* @param Index to the array of all properties. |
423 |
*/ |
424 |
Property propertyForColumnEx(int column) { |
363 |
if ( column == -1 ) |
425 |
if ( column == -1 ) |
364 |
return treeColumnProperty; |
426 |
return treeColumnProperty; |
365 |
else |
427 |
else |
366 |
return allPropertyColumns[propertyColumns[column]].getProperty(); |
428 |
return allPropertyColumns[column].getProperty(); |
367 |
} |
429 |
} |
368 |
|
430 |
|
369 |
int getArrayColumnCount() { |
431 |
/** |
|
|
432 |
* @return The count of all properties (includes invisible columns) |
433 |
*/ |
434 |
int getColumnCountEx() { |
370 |
return allPropertyColumns.length; |
435 |
return allPropertyColumns.length; |
371 |
} |
436 |
} |
372 |
|
437 |
|
Lines 451-457
Link Here
|
451 |
* @return display name of property which represents column |
516 |
* @return display name of property which represents column |
452 |
*/ |
517 |
*/ |
453 |
public String getColumnName(int column) { |
518 |
public String getColumnName(int column) { |
454 |
return allPropertyColumns[propertyColumns[column]].getProperty().getDisplayName(); |
519 |
return getColumnNameEx( propertyColumns[column] ); |
|
|
520 |
} |
521 |
|
522 |
/** Getter for column name |
523 |
* @param column table column index |
524 |
* @return display name of property which represents column |
525 |
*/ |
526 |
String getColumnNameEx(int column) { |
527 |
return allPropertyColumns[column].getProperty().getDisplayName(); |
455 |
} |
528 |
} |
456 |
|
529 |
|
457 |
/* display panel to set/unset set of visible columns |
530 |
/* display panel to set/unset set of visible columns |
458 |
|
531 |
|