Update EventTableModel

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Update EventTableModel

Torben Dyrby
Message
In the FAQ it is suggested to find the index and call set. This may not be a problem, if the change originates from the view (a change in the Table), but in my case, the update comes from a listener interface. Let me describe:
 
The table should present a number of radar Tracks. A Track is an entity containing a position, velocity etc and a unique reference key making it easy to store and update in hashmaps. Usually a tracks is created and then updated maybe 1000 times before it is deleted, so I need an efficient way to update the element in the model. Of cause on each update I could iterate the list and look for the reference key, but...
 
Any ideas?
 
Regards
Torben
Reply | Threaded
Open this post in threaded view
|

Re: Update EventTableModel

James Lemieux
Torben,

     The easiest way to have changes to your Tracks objects reflected in the UI is via a glazedlist called ObservableElementList. You can watch a screencast tutorial that explains what it does and how to use it here:

http://publicobject.com/glazedlistsdeveloper/

     In short, if changes to a Tracks object can be observed by any external entity via some sort of Listener (typically a PropertyChangeListener) then GlazedLists can wire your list elements up to an EventList for you.

     Now, having said that, if you have a lot of these Tracks objects in your EventList (like say > 10000) and/or you frequently update these Tracks objects, then you may want to do better than the linear search that ObservableElementList performs. You may want a custom EventList implementation of your choosing to speed up your searching.

     Let us know if ObservableElementList is what you are looking for, or if you also have a performance issue.

James


On 8/18/05, Torben Dyrby <[hidden email]> wrote:
In the FAQ it is suggested to find the index and call set. This may not be a problem, if the change originates from the view (a change in the Table), but in my case, the update comes from a listener interface. Let me describe:
 
The table should present a number of radar Tracks. A Track is an entity containing a position, velocity etc and a unique reference key making it easy to store and update in hashmaps. Usually a tracks is created and then updated maybe 1000 times before it is deleted, so I need an efficient way to update the element in the model. Of cause on each update I could iterate the list and look for the reference key, but...
 
Any ideas?
 
Regards
Torben