Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Detecting changes in a list - without glazedlists
Detecting changes in a list - without glazedlists [message #1059549] Mon, 20 May 2013 12:22 Go to next message
Mircea Lemnaru is currently offline Mircea LemnaruFriend
Messages: 2
Registered: May 2013
Junior Member
Hello,

My name is Mircea and I am trying to adopt NatTables to replace the regular SWT / eclipse tables , among the functionalities that I need are:

- searching
- filtering (column based)
- databinding (detecting when a record has been added/removed/changed - and updating the table accordingly)

I have noticed some exaples by using glazedlists. Is there any way I can get these functionalities without using glazedlists + glazedlists extension ? By just using the nattable core (without adding glazedlists dependency )??

Thanks,
Mircea

Re: Detecting changes in a list - without glazedlists [message #1059740 is a reply to message #1059549] Tue, 21 May 2013 13:14 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi,

searching is implemented independent of GlazedLists as far as I know.

Column based filtering is possible, but you need to implement the filter logic then on your own. I know that somebody achieved this lately, but I'm not sure if there is any documentation on the how anywhere. In the end you need to implement an IFilterStrategy that you register with the filter row.

Talking about databinding and automatic refreshes of changing data in the back, well how do you want to get informed if there is nobody who is able to tell you that. Using plain Java lists, there are no events on changing data in the back. So you would need to implement actions, commands and command handlers that will perform the modification to your list and fire the necessary refresh events to tell the NatTable to rerender. In fact you would implement some kind of databinding yourself, but as there are no events from your list, it is not a real databinding.

GlazedLists is an implementation of the Java list API to make working with collections much faster, giving some additional functionality like e.g. event handling for changes in the list. We are providing an extension that makes use of GlazedLists for some convenience. When I started with NatTable a few years ago, I was also sceptical about using GlazedLists. But today I don't want to miss the features.

If you have a list that already fires events, e.g. a WritableList, you would "simply" need to implement a listener that takes the events from the WritableList and transforms it into NatTable events. But you should be aware of threading and stuff. You could have a look at the GlazedListsEventLayer which is handling the event transformation for GlazedLists.

Greez,
Dirk
Re: Detecting changes in a list - without glazedlists [message #1059755 is a reply to message #1059740] Tue, 21 May 2013 14:11 Go to previous messageGo to next message
Mircea Lemnaru is currently offline Mircea LemnaruFriend
Messages: 2
Registered: May 2013
Junior Member
Hi,

And thanks for the answers. I have decided to use glazedlist afterall , and it seems to be working fine for now , well almost fine.

I am trying to add all the wanted functionality to create a fully working table , but I am having some issues with adding all the stuff.

The layering / composing is somewhat messy I could really use an example with all this implemented , you happen to know one somewhere (full working one ) ??

I need:
- sort
- filter
- row only selection (done)
- databinding (managed to do it with glazedlists ... works ok for now)

Right now with all the things I have added I am getting an exception:

java.util.ConcurrentModificationException: Cannot begin a new event while another event is in progress by thread, Worker-2
at ca.odell.glazedlists.event.ListEventAssembler.beginEvent(ListEventAssembler.java:100)
at ca.odell.glazedlists.event.ListEventAssembler.beginEvent(ListEventAssembler.java:78)
at ca.odell.glazedlists.SortedList.listChanged(SortedList.java:232)

I am suspecting that I am building the layers in a wrong manner ... but can't figure out just yet what's the problem.

Thanks,
Mircea
Re: Detecting changes in a list - without glazedlists [message #1059757 is a reply to message #1059755] Tue, 21 May 2013 14:14 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
The message tells you that you are trying to modify your list while another modification is not finished. That is because GlazedLists is not threadsafe but thread ready.

Nevertheless, I am not sure what you have done. But there are some examples here http://www.beone-group.com/publikationen.html. The articles are in German but the examples are documented in English.
Previous Topic:Is my Styling approach correct.
Next Topic:ColumnReorderEvent values incorrect
Goto Forum:
  


Current Time: Thu Apr 25 05:56:54 GMT 2024

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

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

Back to the top