Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » RowSelection right after creation (does not work)
icon5.gif  RowSelection right after creation (does not work) [message #1064370] Tue, 18 June 2013 19:30 Go to next message
Steven Robinson is currently offline Steven Robinson
Messages: 3
Registered: March 2013
Junior Member
Hello,

I tested today the latest version of NatTable and was very very glad to see that several bugs I had found disappeared. Great job guys with the 1.0 release!

However there is a problem I have been having for a long time now and using latest version did not solve it.

My functional problem is the following:

- I am using NatTable in the context of an Eclipse RCP app (Eclipse 3.x for now as E4 is still very buggy).
- My RCP app consists of multiple view parts, with most of them filled up with a NatTable.
- When I open one of those view parts, either initially closed, or in a non activated tab (happens when you restart the RCP app and the tab is not the default one: the tab for the view part will be visible but it's content is not loaded yet): I want to load some data and select some rows.


My NatTable problem is the following:
- loading the data in the createPartControl method of the ViewPart (which gets called by Eclipse workbench mecanism) works perfectly.
- calling the selection methods on the NatTable at the very end of the createPartControl() method OR the setFocus() method does not make the NatTable to select the rows. Nothing just happens.

I can sort of workaround it by using a timer:

this.getSite().getShell().getDisplay().timerExec(500, new Runnable() {
    @Override
    public void run() {
        doSelection();
    }
});


But years and years of UI coding tought me that using timer is a very bad code smell and that it will not work consistently etc...


I would love to find a correct and efficient way to be able to select a row right after creating and loading the NatTable. I am not exactly aware of the inner mecanisms of the NatTable, but I really hope something can be done.


I have created a small RCP app that illustrate that problems,
you can download the zip at http:// demo.ovh.com/en/ecc2271eafb7b621a47041b534bba6fb/ (sorry i don not have upload rights seems like).

This would be the steps to reproduce the problem:
1. Open the RCP app.
2. Click File > Open View
3. Select view 1: view 1 should show.
4. Now open View 2 as well: view 2 with the NatTable should show.
5. Select view1 such that view2 is hidden beind view1 but you can still see view2's tab.
6. Close the app and re-open it.
7. Select view 2
8. The nat table shows but no row selection happens.

You can try the same with changing the 'withTimer' boolean and see that now selection works.


Please let me know what you think!


SR
Re: RowSelection right after creation (does not work) [message #1064803 is a reply to message #1064370] Fri, 21 June 2013 03:52 Go to previous message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1255
Registered: July 2012
Senior Member
Hi,

sorry for the late reply on this. I just downloaded your example and tested your issue.

The issue is that you are exposing the API rather than using the command API. If you change your doSelection() to the following using the SelectRowsCommand, it works as intended.

	this.natTable.doCommand(new SelectRowsCommand(bodyLayer, 0, 80, false, false));
	this.natTable.doCommand(new SelectRowsCommand(bodyLayer, 0, 90, false, true));
	this.natTable.doCommand(new SelectRowsCommand(bodyLayer, 0, 91, false, true));


Quote:
Eclipse 3.x for now as E4 is still very buggy


I totally disagree with that statement. The main issues that are reported are related to the compatibility layer of Eclipse and the Eclipse IDE which is an application still based on Eclipse 3.x and the compatibility layer. Plain E4 applications work very good.

Greez,
Dirk
Previous Topic:Place a Button near the ColumnHeader
Next Topic:DataLayer: thread-safety
Goto Forum:
  


Current Time: Fri Aug 22 08:06:42 EDT 2014

Powered by FUDForum. Page generated in 0.03682 seconds