Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » table reinit scrollbars problem
table reinit scrollbars problem [message #1019198] Fri, 15 March 2013 08:20 Go to next message
Sascha Smoo is currently offline Sascha SmooFriend
Messages: 56
Registered: November 2012
Member
Hello,

I've got a problem with my nattable implementation.

public class YearlyFactorTable extends NatTable {

public YearlyFactorTable(Composite parent) {
		super(parent, false);
		
		init();
	}

private void init() {
		setConfigRegistry(configRegistry);
		

		dataGrid = new FactorDataGridLayer(configRegistry, structureElement,
				globalFactorsMode, editMode, AdminMessages.YEAR_FAC_TAB_NAME);

		setLayer(dataGrid);

		addCustomSelectionBehaviour();

		// configure table
		configure();
}
}


The code you see is a snippet from a class extending the super class NatTable. This init method will be called within the constructor of the extending class and will be called again if the table input changes.
Now the problem starts after reinit of the table. Sometimes after reinit the scrollsbars of the table do not work anymore. They are still visible, but scrolling does not influence the table anymore. Tried to refresh the parent composite but nothing seems to help. If I dispose the table and build it up again it works, but I don't want to dispose the table everytime the input changes. Any ideas?

Greetings,
Sascha
Re: table reinit scrollbars problem [message #1019204 is a reply to message #1019198] Fri, 15 March 2013 08:35 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Well first, why do you extend NatTable?

Your problem is th init method because you are changing the underying layer. Technically this should be possible, but because of some architectural issues we will try to solve in the future, it currently breaks at some points.

Why do you change the layer if the content changes? Are you trying to exchange the whole table then? Or is it just the content? Because if you want to only change the content, then you shouldn't change the whole layer composition.

Greez,
Dirk
Re: table reinit scrollbars problem [message #1019209 is a reply to message #1019204] Fri, 15 March 2013 08:44 Go to previous messageGo to next message
Sascha Smoo is currently offline Sascha SmooFriend
Messages: 56
Registered: November 2012
Member
Hello Dirk,

I'm extending the NatTable class because I have some other special helper methods I need in this class. And yes, I'm trying to exchange the whole table because the number of columns/rows changes with the new input. Let me explain my usecase to you. I've got a table showing year based data, with the year selected by a swt combobox outside the table. So if the year changes, the input of the shown table has to change too. The amount and type of shown data changes from year to year.

Greetings,
Sascha

[Updated on: Fri, 15 March 2013 08:50]

Report message to a moderator

Re: table reinit scrollbars problem [message #1019218 is a reply to message #1019209] Fri, 15 March 2013 08:58 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I'd suggest to implement a dynamic data provider instead of exchanging the whole table. Have a look at the DynamicColumnExample.

There are not too much use cases where you really need to exchange the layer composition. Most of the issues with dynamic parts (rows, columns, ...) can be solved using the given structures. Smile
Re: table reinit scrollbars problem [message #1019221 is a reply to message #1019218] Fri, 15 March 2013 09:08 Go to previous messageGo to next message
Sascha Smoo is currently offline Sascha SmooFriend
Messages: 56
Registered: November 2012
Member
Ok. let me have a look! Thanks so far!
Re: table reinit scrollbars problem [message #1021622 is a reply to message #1019221] Wed, 20 March 2013 12:07 Go to previous messageGo to next message
Sascha Smoo is currently offline Sascha SmooFriend
Messages: 56
Registered: November 2012
Member
Dirk, let me ask one last question. I've managed to update my table input without recreating the layer! Just manipulating the data list in the gridlayer now and refreshing the table afterwards. This works fine so far, but there is one problem left. The cell labels won't be updated for "new" cells. I have a class extending the AbstractOverrider to set labels to the cells and set special configurations to every cell. But it seems the dynamic input mechanism does not update the cell labels at all. Any ideas on this?

Greetings,
Sascha

[Updated on: Wed, 20 March 2013 12:08]

Report message to a moderator

Re: table reinit scrollbars problem [message #1021629 is a reply to message #1021622] Wed, 20 March 2013 12:30 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
That depends on how you refresh and if you ensured that the AbstractOverrider has the correct reference to the list and not working on the old list reference.
Re: table reinit scrollbars problem [message #1021648 is a reply to message #1021629] Wed, 20 March 2013 13:07 Go to previous messageGo to next message
Sascha Smoo is currently offline Sascha SmooFriend
Messages: 56
Registered: November 2012
Member
Ok, that was something I was missing. Updated the reference for the AbstractOverrider now, but the problem stays the same. The refresh is a simple refresh() call on the nattable, like it's done in the DynamicColumnExample too.
Re: table reinit scrollbars problem [message #1021664 is a reply to message #1021648] Wed, 20 March 2013 13:29 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
So refresh() seems to be correct. Are the data provider and all layer returning the correct column and row counts?
Re: table reinit scrollbars problem [message #1021671 is a reply to message #1021664] Wed, 20 March 2013 13:43 Go to previous messageGo to next message
Sascha Smoo is currently offline Sascha SmooFriend
Messages: 56
Registered: November 2012
Member
It seems the BodyLayer causes the problem. If I reinstance my bodylayer and set it to the GridLayer again via setBodyLayer() the labels are correct again, but the table is messed up if I do so. (doulbe data entries, etc)
Re: table reinit scrollbars problem [message #1021674 is a reply to message #1021671] Wed, 20 March 2013 13:48 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
then you should search for the reference that is not updated in your body layer.
Re: table reinit scrollbars problem [message #1022085 is a reply to message #1021674] Thu, 21 March 2013 09:04 Go to previous message
Sascha Smoo is currently offline Sascha SmooFriend
Messages: 56
Registered: November 2012
Member
Finally everything works fine! Thanks Dirk!
Previous Topic:Bug in VerticalTextPainter.paintCell()
Next Topic:Decorate icons with text in NatTable Tree
Goto Forum:
  


Current Time: Thu Apr 18 16:05:21 GMT 2024

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

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

Back to the top