-
Type:
Enhancement
-
Resolution: Unresolved
-
Priority:
P4
-
None
-
Affects Version/s: 5.0
-
Component/s: client-libs
-
x86
-
windows_xp
A DESCRIPTION OF THE REQUEST :
It has repeatedly come up in our client code that we have a need to keep JTable's selection consistent when modifying the underlying table data. It would greatly enhance our code if it were possible for the TableModel to notify the TableModelListener's that a row was moved, instead of removed then inserted. This would allow listeners (including JTable) to maintain its state for that row.
JUSTIFICATION :
We have to right application specific logic to maintain row identity due to underlying table model changes (sorting specifically). If the TableModel interface allowed for a row moved event, the application logic could be removed and selection would remain consistent without any further logic.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would like JTable to be able to keep track of row selection throughout modifications to the table model (specifically moving rows around).
ACTUAL -
To move a row, you must now fire a row deleted event (clearing the selection of that row if it was selected) and then inserting the row at the desired position (which the JTable treats as a new row and does not maintain selection)
---------- BEGIN SOURCE ----------
Self explanatory / no code necessary
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Application must keep track of row identify and maintain selection.
###@###.### 10/19/04 19:42 GMT
It has repeatedly come up in our client code that we have a need to keep JTable's selection consistent when modifying the underlying table data. It would greatly enhance our code if it were possible for the TableModel to notify the TableModelListener's that a row was moved, instead of removed then inserted. This would allow listeners (including JTable) to maintain its state for that row.
JUSTIFICATION :
We have to right application specific logic to maintain row identity due to underlying table model changes (sorting specifically). If the TableModel interface allowed for a row moved event, the application logic could be removed and selection would remain consistent without any further logic.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would like JTable to be able to keep track of row selection throughout modifications to the table model (specifically moving rows around).
ACTUAL -
To move a row, you must now fire a row deleted event (clearing the selection of that row if it was selected) and then inserting the row at the desired position (which the JTable treats as a new row and does not maintain selection)
---------- BEGIN SOURCE ----------
Self explanatory / no code necessary
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Application must keep track of row identify and maintain selection.
###@###.### 10/19/04 19:42 GMT