Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Problem with RowReorderLayer and indexes.
Problem with RowReorderLayer and indexes. [message #1131276] Thu, 10 October 2013 11:25 Go to next message
SD Khan is currently offline SD KhanFriend
Messages: 63
Registered: May 2013
Member
Hi!

Actually i have applied labels on the base of row indexes getting from event list, now, when i sort the row indexes, and apply styles on the base of labels, everything works fine but when i use reorder layer to move rows up, down then labels get disturbed and after reordering when i apply style on a row then it gets applied on some other row.

I investigated issue and found that when sorting is applied, row indexes are not changed in the event list, only change is done in the filter list and as a result labeling does not disturbed, but when i perform row reordering then rows are moved and their indexes are get changed in the event list so now labeling get disturbed and now styles get disturbed.

Situation is now.

If i get the row indexes from row reorder layer then get the wrong indexes after sorting performed because row reorder layer does not update its indexes on sorting.

If i get the row indexes from the event list then get the wrong indexes after row reordering is performed because it changes actual row indexes in the event list.


Is this right behaviour of Row reorder layer ? or i am missing something ? , or if there is any work around to get it through on both scenarios i.e sorting and reordering without having problems with assigned labels ?

Regards,
Safdar Khan

[Updated on: Thu, 10 October 2013 11:26]

Report message to a moderator

Re: Problem with RowReorderLayer and indexes. [message #1131292 is a reply to message #1131276] Thu, 10 October 2013 11:43 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Puh ...

Ok, let's start with index vs. position.

The index points to the element in the base list, while the position is the transformation of the index in the current layer. So in the RowReorderLayer the row at position 2 might point to the element at index 10 in the base list (if you moved the row from index 10 to position 2).
http://eclipse.org/nattable/documentation.php?page=layer

The row reordering does not change the underlying list. It just renders the list in a different order. The same is true for EventList and SortedList for example. While the SortedList might show a sorted ordering, the underlying list hasn't changed. The base list is not ordered, there is just another view on the list.

I don't understand why you are applying labels based on the index? There is fairly no use case for something like that. Either use the position if you want to do something similar than alternating row coloring, or use labels based on content rather than position. At least from the architectural point of view, this is the correct way.

Greez,
Dirk
Re: Problem with RowReorderLayer and indexes. [message #1131302 is a reply to message #1131292] Thu, 10 October 2013 11:52 Go to previous messageGo to next message
SD Khan is currently offline SD KhanFriend
Messages: 63
Registered: May 2013
Member
Thanks Dirk for the detailed reply. When we apply sorting only the order in filterlist change but the order in eventlist doesn't change. But when i drag a row and change its position the filter list change as well as the eventlist. So,Let me put my question in another way.

Is there any way to reorder rows (objects) in filterlist without disturbing the eventlist order??
Re: Problem with RowReorderLayer and indexes. [message #1131309 is a reply to message #1131302] Thu, 10 October 2013 12:05 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I don't understand the question. AFAIK if you drag a row, you don't modify the list. You change the transformation that is applied for the visualization in the RowReorderLayer. The lists, FilterList aswell as the underlying EventList shouldn't change.

I might be wrong of course, but that is my understanding of the RowReorderLayer.

If it's just about the lists, I'm not sure. I'm not a GlazedLists expert. But AFAIK the FilterList applies filter transformations. Changes in ordering are delegated to the underlying list. So I guess no, you can't change the order in the FilterList while keeping the ordering in the underlying list.

For those reasons the RowReorderLayer exists.
Re: Problem with RowReorderLayer and indexes. [message #1131393 is a reply to message #1131309] Thu, 10 October 2013 13:30 Go to previous message
SD Khan is currently offline SD KhanFriend
Messages: 63
Registered: May 2013
Member
Right, As i verified now, RowReorderLayer do change the indexes in the event list. But as you said, the right behavior is to not disturb that. Moreover when sorting is applied there should be a change in the transformation list of RowReorderLayer, which is not happening at the moment.
Previous Topic:How to listen for RowReorderEvents?
Next Topic:Loosing selection
Goto Forum:
  


Current Time: Wed Apr 24 20:28:11 GMT 2024

Powered by FUDForum. Page generated in 0.03567 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top