Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » How to...(update data in nattable, with very customized config)
How to... [message #1011834] Wed, 20 February 2013 10:35 Go to next message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 471
Registered: July 2009
Senior Member

what i am doing is generating a full table config from config files.

so this is what i got included:
(columns - dynamic fom cfg files - also visibility of em, Groups etc...)

my main problem is due filtering/sorting i need to create FilterList, SortedList,
which will be passed to ColumnHeaderLayer and BodyLayer.

so whenever i get a new Input-list i need to dispose the table, and create another one (?)
thats what i am doing right now, but it would be WAY faster if i could simply exchange the data... and tell the table to check for changes (does not even need to happen automatically, as i know when this is going to happen Wink )

my table is fused with my dynamic config library, which is fused with my framework
so getting my table out of this context to show my problem is sort of tricky!

NOTE: i already tried to simply change the data in my AbstractDataSource (this class provides, columnNames, olumnIndexes for properties, propertyNames (as list), informations how to gain data from objects AND the list, which is displayed in the table )
but i have no clue which function from nattable api to call so it reads the data again and redraws...

any help appreciated.
thanks in advance
Re: How to... [message #1011861 is a reply to message #1011834] Wed, 20 February 2013 11:45 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2772
Registered: July 2012
Senior Member

well the SortedList and the FilterList are just wrapper around the main list. To exchange data I usually call clear() on the top most list (e.g. the FilterList instance) and addAll() with the new data. If you considered using GlazedListsEventLayer and GlazedListsDataProvider there is nothing more you have to do AFAIK. The update should be triggered automatically.

So there is no need for dispose and new creation of the table. You just need to change the content of the list that is used to propagate the table.

Hope that helps,
Re: How to... [message #1012236 is a reply to message #1011861] Thu, 21 February 2013 06:56 Go to previous message
Ludwig Moser is currently offline Ludwig MoserFriend
Messages: 471
Registered: July 2009
Senior Member
(my last post seems to be gone to a black hole)
once again dirk, confirmed.

i thought i have to recreate Event- Transformed- and ObservableElementList every time i set new data.
as you told me i changed my AbstractDataSource to this:

	public void setList(List<E> list, Class<?> clazz) {
		if (observableList == null ) {
			EventList<E> eventList = new BasicEventList<E>();
			TransformedList<E, E> objectList = GlazedLists
			observableList = new ObservableElementList<E>(objectList,
					(Connector<? super E>) GlazedLists.beanConnector(clazz));
		} else {
			if (list != null) {

and now its working like charm! no other changes were needed (adding 7 lines (could be done without brackets in 5 Wink )

thanks a lot for your hint/tips/information!
saves me quite some waiting time!
Previous Topic:Custom IConfigLabelAccumulator gets same row positions even after scrolling the table
Next Topic:NatTableBuilder download?
Goto Forum:

Current Time: Thu Jan 23 06:47:25 GMT 2020

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

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

Back to the top