Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Property Changes on EventList / EventLayer working for adding/removing list elements only
Property Changes on EventList / EventLayer working for adding/removing list elements only [message #940113] Thu, 11 October 2012 10:24 Go to next message
Michi Classen is currently offline Michi Classen
Messages: 36
Registered: March 2012
Member
Using the event list to propate changes to the event layer works for adding/removing list elements only. Changing the content of a list element propates the changes correctly to the event list, but the content at the layer doesn't change. As soon as the NatTable view is focused by the user manually, the content changes will be made.

How do I change this behavior, that the changes are made as soon as the property change has been propagated?

Re: Property Changes on EventList / EventLayer working for adding/removing list elements only [message #940127 is a reply to message #940113] Thu, 11 October 2012 10:38 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk Fauth
Messages: 1335
Registered: July 2012
Senior Member
You need to register an ILayerListener to the GlazedListsEventLayer. In this you can do your property updates the way you like. The easiest and most expensive would be to do a simple NatTable.refresh() everytime a property changes. For smaller tables this should do the trick. You could also try to do some more specific update dependent on the PropertyUpdateEvent generated by the GlazedListsEventLayer on propertyChange(). E.g. find the corresponding column and row position and fire a CellVisualChangeEvent (like in UpdateDataCommandHandler).
Re: Property Changes on EventList / EventLayer working for adding/removing list elements only [message #940131 is a reply to message #940127] Thu, 11 October 2012 10:42 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk Fauth
Messages: 1335
Registered: July 2012
Senior Member
BTW the BlinkLayer is one of the layers that reacts on the PropertyUpdateEvents to highlight data in the table that was updated in the background.
Re: Property Changes on EventList / EventLayer working for adding/removing list elements only [message #940135 is a reply to message #940127] Thu, 11 October 2012 10:47 Go to previous messageGo to next message
Michi Classen is currently offline Michi Classen
Messages: 36
Registered: March 2012
Member
My first solution was to register the GlazedListsEventLayer as listener to the model. This works fine, if the content is changed, like expected. But in this case, the adding / removing list elements is not propagated. Maybe I have to use both solutions:
- to propagate the add/remove list elements events: using the event list and add/remove elements on it
- to propagate the content changes: using the underlying data model on which the GlazedListsEventlayer is listening

[Updated on: Thu, 11 October 2012 10:56]

Report message to a moderator

Re: Property Changes on EventList / EventLayer working for adding/removing list elements only [message #940182 is a reply to message #940135] Thu, 11 October 2012 11:47 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk Fauth
Messages: 1335
Registered: July 2012
Senior Member
Hi,

sorry as I haven't used the automatic update feature yet, I missed something.

Yes, to add/remove elements from the list you should use the EventList. This way the events are fired by GlazedLists which are then handled by the GlazedListsEventLayer.
The GlazedListsEventLayer is itself a PropertyChangeListener. So you should add it to the model so the property changes can be handled by GlazedLists.

GlazedLists are of course only able to fire events regarding changes to the list, like adding and removing elements. It doesn't know about the elements it contains.
Only the model elements itself can tell the outside world that something has changed, so they need to be able to fire PropertyChangeEvents. The GlazedListsEventLayer as a PropertyChangeListener then needs to be added to the model elements so it gets informed about the property changes.
Looking at the architecture there from a distance, this is the only way to do it at the moment.

Have a look at BlinkingGlazedListExample. There you should find an example for what you are looking for.

Greez,
Dirk
Re: Property Changes on EventList / EventLayer working for adding/removing list elements only [message #947872 is a reply to message #940182] Wed, 17 October 2012 14:28 Go to previous message
Michi Classen is currently offline Michi Classen
Messages: 36
Registered: March 2012
Member
The BlinkLayer was a good idea! Thanks! Now it works.
Previous Topic:NatTableExamples
Next Topic:Does anyone has an example for Date Picker in NatTable?
Goto Forum:
  


Current Time: Tue Oct 21 07:25:13 GMT 2014

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

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