Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Problem with row selection: Same row, different column
Problem with row selection: Same row, different column [message #1004983] Thu, 24 January 2013 09:06 Go to next message
Andreas Saremba is currently offline Andreas Saremba
Messages: 5
Registered: January 2013
Junior Member
In my plugin using NatTable for a list of work items, I have three additional views to show the details of the currently selected item; depending on the column selected by the user, the selected item (=row) is shown in the appropriate detail view. That works fine as long as I select a different row each time; but when I select a different column in the same row, the details view remains unchanged. My customer refuses to accept this.

Searching for the reason I found that the base class for my CustomRowSelectionProvider, the NatTable class RowSelectionProvider has a method handleLayerEvent that informs the change listeners if and only if the selected row has changed. This does not take into account my special case where column selection is significant. To make things worse, I cannot even override handleLayerEvent in my derived class because it uses private variables.

I do not want to argue whether this is a bug or just a rough edge of an otherwise wonderful library. In any case, I suggest to make the RowSelectionProvider more flexible, providing some means to allow for making column selection significant.

Of course, one always has the workaround to copy the source code, change the affected method and add any special behaviour needed - which is what I did, of course. But this is not OOP, right?
Re: Problem with row selection: Same row, different column [message #1005125 is a reply to message #1004983] Thu, 24 January 2013 14:21 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1300
Registered: July 2012
Senior Member
Hi,

well IMHO the RowSelectionProvider is doing what it is supposed to do, it provides information about the selection object represented in a row in NatTable.

What you need is some type of CellSelectionProvider, which is not provided by NatTable core. The reason for not providing something like that is, that you also need to implement setSelection() if you create your own ISelectionProvider, and with only having the Object value of a cell, you can't determine to which cell it should belong. With rows and the RowSelectionProvider that uses a IRowIdAccessor, it is possible to determine what to select.

Of course it is not a good OOP principle to copy and modify code. But it is also discussable in framework creation if everything needs always to be visible and accessible. Wink

Nevertheless, if you solved the issue I tried to explain above then please feel free to contribute. We are an open source project and would appreciate any help with such things. If you have a more local solution that only fits your needs, than please tell me which member variables need to be accessible, so I will have a look what I can do. Also a little explanation with code could be helpful to understand how you solved your issue locally.

Greez,
Dirk
Re: Problem with row selection: Same row, different column [message #1005165 is a reply to message #1005125] Thu, 24 January 2013 15:23 Go to previous messageGo to next message
Andreas Saremba is currently offline Andreas Saremba
Messages: 5
Registered: January 2013
Junior Member
A CellSelectionProvider is not what I need - the object of interest is the whole row, and the RowSelectionProvider does NEARLY what I need, with just one small difference: I want the listeners to be informed EACH time the user selects, not only when the set of selected rows changes, because in my application the selected column is significant for the action taken by the listener.

The pragmatic solution I have found for my project is not satisfactory from a SW engineering point of view, so I would suggest a small enhancement to the class. If somebody is kind enough to tell me how to attach a file to a topic in this forum (all I see is "Maximum files per message: 0), I will gladly share my proposal.
Re: Problem with row selection: Same row, different column [message #1005169 is a reply to message #1005165] Thu, 24 January 2013 15:27 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1300
Registered: July 2012
Senior Member
Hi,

the best way would be to open a bug for this in bugzilla so the actions that are done are tracked in a clean way. There you can attach your files or even create a patch that can be contributed.

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=NatTable

Greez,
Dirk
Re: Problem with row selection: Same row, different column [message #1005734 is a reply to message #1005169] Mon, 28 January 2013 13:11 Go to previous message
Andreas Saremba is currently offline Andreas Saremba
Messages: 5
Registered: January 2013
Junior Member
Bugzilla entry created, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=399254.

Thank you, Dirk!
Previous Topic:How to get rows, currently visible in viewport?
Next Topic:Filtering custom event handler on filter input.
Goto Forum:
  


Current Time: Tue Sep 30 23:55:27 GMT 2014

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

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