From: Shamshad A. <sha...@gm...> - 2014-04-01 16:22:18
|
Hi, Today, I have tried to add this feature, but I do not found any concrete method implementation which support this feature. After a couple of hours of work, I found that there are two possible ways: First way - return null for all selected rows from ModelWrapper.getValueAt(rowIndex, columnIndex). If we do so all the selected row will appear together at top in ascending order sorting and at the bottom in descending order sorting. Second way - TableRowSorter extends javax.swing.DefaultRowSorter in which implementation of method sort() is available, But there is no way to extends the functionality of sort() method by overriding it. One option yet available is to create a copy of DefaultRowSorter and implement sort method in such a way that it will sort selected and unselected rows separately then merge both together. I have done first workaround and it is working but has certain limitation such as performance and selected rows are not get sorted, That is why, I think second workaround is better. Should I try second option? -- -Shamshad Alam +91 9911631198 LinkedIn : in.linkedin.com/pub/shamshad-alam/58/939/70 GitHub: @shamshad-npti Facbook: @shamshad.saralindia On Tue, Apr 1, 2014 at 6:28 PM, Till Schäfer <til...@tu...>wrote: > Hi, > sorry for the late answer. Some of us had a deadline on Monday, which > distracted us a bit from answering questions. > > To understand the current behavior of the table sorting i have to explain > lazy loading of properties first: > > To avoid unnecessary memory consumption we are not holding all properties > of all molecules in memory. Only the needed properties are loaded on demand > (this done by DbManager.lockAndLoad and DbManager.unlockAndUnload). Sorting > the Table would therefore require to load the sort-property completely (for > all molecules of the current subset) into the ram. As this is still not > very efficient. We have a DbManager method getSortOrder, that calculates > the sort order on the database level and returns this sort order only. > > You can start with the TableViewRowSorter class as an entry point. Please > note, that the table view does not use a very clean code structure. This is > the darker side of SH regarding the code quality ;-) . > > Greetings > Till > > Am Samstag, 29. März 2014, 21:45:28 schrieb Anjenson: > > Hi, > > > > I also would like to know where to find methods that apply different > > types of sorting to table when we press buttons in table header (eg. > > "Title" or any other property). I think I will need to reimplement > > sorting a little to provide stability after rows reordering. > > > > Regards, > > Andrew > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > > Scaffoldhunter-devel mailing list > > Sca...@li... > > https://lists.sourceforge.net/lists/listinfo/scaffoldhunter-devel > -- > Dipl.-Inf. Till Schäfer > TU Dortmund University > Chair 11 - Algorithm Engineering > Otto-Hahn-Str. 14 / Room 237 > 44227 Dortmund, Germany > > e-mail: til...@cs... > phone: +49(231)755-7706 > fax: +49(231)755-7740 > web: http://ls11-www.cs.uni-dortmund.de/staff/schaefer > pgp: > https://keyserver2.pgp.com/vkd/SubmitSearch.event?&&SearchCriteria=0xD84DED79 > > > ------------------------------------------------------------------------------ > _______________________________________________ > Scaffoldhunter-devel mailing list > Sca...@li... > https://lists.sourceforge.net/lists/listinfo/scaffoldhunter-devel > -- -Shamshad Alam +91 9911631198 LinkedIn : in.linkedin.com/pub/shamshad-alam/58/939/70 GitHub: @shamshad-npti Facbook: @shamshad.saralindia |