It would be pretty easy to wrap an agent (as pmf suggests) to notify your
model class if a Vector changes.  You could then do something like
 (map = old_vec new_vec)

And then look for false results in the array and send a notification to
Swing.

On Fri, Feb 20, 2009 at 5:40 AM, Rowdy Rednose <rowdy.redn...@gmx.net>wrote:

>
> All the clojure swing examples I've seen so far use JTables in a
> static way, i.e. the data is not programmatically modified once the
> table got created.
>
> Has anyone actually tried to implement a TableModel that is backed by
> a clojure Vector/Map and fires events to TableModelListeners when the
> underlying data changes?
>
> I've got a few ideas on how to implement this, but none of them seems
> to be very elegant (which is why I am interested in clojure in the
> first place).
>
> For those of you who don't know the events that a TableModel fires,
> they are:
>
> * Table has changed ( => redraw the whole thing)
> * Rows x through y have changed (=> redraw only those)
> * Rows x through y have been inserted
> * Rows x through y have been deleted
>
> (Full details:
> http://java.sun.com/javase/6/docs/api/javax/swing/event/TableModelEvent.html
> )
>
> Any elegant ideas or examples on how to do this when the underlying
> data structure is (a ref to) one of clojure's (immutable) collections,
> so that a change to that structure will fire the appropriate event?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to