I have a general question related to refreshing the contents of JTable and handling some application specific requirements.In our application we are planning to refresh the contents of JTable automatically after certain period of time by fetching data from database and update the JTable contents or user has clicked refresh button.
But following scenarios we are planning to handle when refresh is called automatically or user has clicked refresh button.
1) User is working with data of JTable. Like rows of JTable has checkBoxes and user selects them and doing operation like viewing the details of selected rows in new details dialog. So if refreshing is done then the selection will be lost if I update the whole data in JTable.
a)Will it be possible to append the data at the end of JTable rows without disturbing the existing JTable contents.
b) Is it feasible to compare the data of existing rows and newly fetched rows and update only the rows whose values are changed in database or update specifically updated columns. But this comparision for finding changed values will result in performance problems.So are there any other alternatives of doing this, ideas are most welcome.
c) Simple way is to alert the user that data will be updated and everything will be refreshed will be the choice in worst case.
I guess many may have encountered such problems and may have solved it depending on the product requirements.