Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » NatTable getColumnIndexByPosition returns -1 before
NatTable getColumnIndexByPosition returns -1 before [message #1012478] Thu, 21 February 2013 16:29 Go to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
In my App NatTable#getColumnIndexByPosition() allways gives my -1.

Only, when the NatTable was painted once . it returns the correct Index.

natTable.configure();
natTable.getColumnIndexByPosition(2); // gives -1


What should I do with the Table to make getColumnIndexByPosition() return the right value?

[Updated on: Thu, 21 February 2013 16:30]

Report message to a moderator

Re: NatTable getColumnIndexByPosition returns -1 before [message #1012753 is a reply to message #1012478] Fri, 22 February 2013 07:24 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Counter question: Why do you need to do position-index transition right after the creation of the instance?
Re: NatTable getColumnIndexByPosition returns -1 before [message #1012788 is a reply to message #1012753] Fri, 22 February 2013 08:27 Go to previous messageGo to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
In my app I am adding some renderers to the columns.

The renderers are passed as columnNumber-RendererObject pairs to the table.

I would like to attach the RendererObjects to the columns, independantly of the reordering, which is done by the table internally, so I would like to use positions instead of Indexes.
Re: NatTable getColumnIndexByPosition returns -1 before [message #1012792 is a reply to message #1012788] Fri, 22 February 2013 08:34 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
What renderers are you adding? And why are you adding something to the NatTable outside the NatTable?

The NatTable framework is so flexible that there should be no need to add something additional from the outside. It sounds like what you really need is a special ICellPainter.
Re: NatTable getColumnIndexByPosition returns -1 before [message #1012820 is a reply to message #1012792] Fri, 22 February 2013 09:28 Go to previous messageGo to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
Dirk, my cellRendeerers are in fact ICellPainters.

I add them to the Table, because I am generating the table dynamically with different IDataProviders.

I do not know which Objects will be provided, only the IDataProvider knows, so the Objects are added externally.

What is about my question? What should i do to map the position to the Index before the table is painted?
Re: NatTable getColumnIndexByPosition returns -1 before [message #1012829 is a reply to message #1012820] Fri, 22 February 2013 09:50 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Then I would create a ILabelProvider that provides labels dependent on the IDataProviders.

Quote:
What is about my question? What should i do to map the position to the Index before the table is painted?


I don't know and would need to debug myself. Seems there are some calculations done regarding the x/y coordinates somewhere in the layer stack.
Re: NatTable getColumnIndexByPosition returns -1 before [message #1012848 is a reply to message #1012829] Fri, 22 February 2013 10:24 Go to previous message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
Thnx for help Dirk
Previous Topic:Attaching one column to the right border?
Next Topic:Decommissioning old web site
Goto Forum:
  


Current Time: Thu Apr 25 20:06:21 GMT 2024

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

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

Back to the top