Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Fill columnwise
Fill columnwise [message #998382] Wed, 09 January 2013 22:12 Go to next message
Aljoscha Steffens is currently offline Aljoscha SteffensFriend
Messages: 302
Registered: November 2012
Senior Member
Hi,
I looked through most of the example classes, but I did't find an example where the data is filled in columnwise.
I really just want to display an execelsheet, as it is, in a table. Maybe the cells should be editable, but thats it. But I can't figure out how to learn this from the examples.

I think my needs can be achieved with a dataProvider?
Re: Fill columnwise [message #998653 is a reply to message #998382] Thu, 10 January 2013 12:44 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
Hi,

the default cases we recognized with the NatTable is to show lists of objects. Of course there are multiple other use cases, but as they are quite special, there is no default implementation for these cases.

To show lists of objects, there are the ListDataProvider that is used together with a custom IColumnAccessor.
If you want to use another approach for loading data into a NatTable, e.g. columnwise, you need to implement your own IDataProvider. In this case you don't need an IColumnAccessor.
Re: Fill columnwise [message #998830 is a reply to message #998653] Thu, 10 January 2013 19:34 Go to previous messageGo to next message
Aljoscha Steffens is currently offline Aljoscha SteffensFriend
Messages: 302
Registered: November 2012
Senior Member
Thank you Smile finally did it.
One more question:
when I create the natTable (in a (view)part) the scrollbars doesn't work at first. I need to resize the part to change that.
I already tried to call the redraw(), update() and layout() method on the parents of my view but it doesn't work.
Is this a natTable related problem or should I ask/look rather in another forum?
Re: Fill columnwise [message #1000184 is a reply to message #998830] Mon, 14 January 2013 07:58 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
Hi and sorry for the late reply,

I also use the NatTable in a part, and I don't see an issue with the scrollbars. Maybe it is related to the layout manager you are using. Which layout manager are you using and how do you create your layout?

Greez,
Dirk
Re: Fill columnwise [message #1000442 is a reply to message #1000184] Mon, 14 January 2013 19:34 Go to previous messageGo to next message
Aljoscha Steffens is currently offline Aljoscha SteffensFriend
Messages: 302
Registered: November 2012
Senior Member
Well.. actually I didn't use any Layout. But now I created a FillLayout.
@PostConstruct
	private void createContents(Composite parent){
		Composite container = new Composite(parent, SWT.NONE);
		
		container.setLayout(new FillLayout());
		dataTable = new NatTable(container, false);
	}


	private void setViewerInput(ArrayList<ArrayList<String>> input){
		DataProvider dataProvider = new DataProvider(input);
		ViewportLayer layer = new ViewportLayer( new DataLayer(dataProvider) );

		dataTable.setLayer(layer);
		dataTable.addConfiguration(new DefaultNatTableStyleConfiguration());
		dataTable.addConfiguration(new HeaderMenuConfiguration(dataTable));
		dataTable.configure();

	}


this is how I create the NatTable (this code belongs to a class which I assign to a part)
Re: Fill columnwise [message #1000655 is a reply to message #1000442] Tue, 15 January 2013 07:29 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
Hi,

the issue seems to be related to the creation of your NatTable instance. You are setting the layer after creation and not on creating your NatTable. This should be possible tho, so this might be something to look at.

What you can do now is, if you want to leave your code as is, try to call dataTable.refresh() at the end of your setViewerInput().

But I would suggest to change your code to only change the input rather than the whole layer stack, as there is no change to the layer stack except the content. Without using GlazedLists for automatic eventing you would then still need to call refresh() on your NatTable instance to rerender.

Greez,
Dirk
Re: Fill columnwise [message #1000989 is a reply to message #1000655] Tue, 15 January 2013 20:38 Go to previous message
Aljoscha Steffens is currently offline Aljoscha SteffensFriend
Messages: 302
Registered: November 2012
Senior Member
Works perfectly as well Smile Thanks a lot!!

[Updated on: Tue, 15 January 2013 20:38]

Report message to a moderator

Previous Topic:Filter Row - set row height
Next Topic:Greater than (>) does not work at filter using regular expression?
Goto Forum:
  


Current Time: Sat Dec 20 09:57:16 GMT 2014

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

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