ObservableList vs Models

Knut Arne Vedaa knut.arne.vedaa at broadpark.no
Wed Oct 17 14:10:52 PDT 2012

So what you want is one single backing list, and any numbers of "views" 
into that list that can be independently sorted and filtered without 
changing or making a copy of the backing list, with these views being 
observable as well?

I'm not sure if this would be possible, but probably the implementations 
of the upcoming SortedList and FilteredList 
(http://javafx-jira.kenai.com/browse/RT-17053) will shed some light on 
the issue.

Perhaps someone in the know could give some info on the features of 
those and how and if they relate to OPs question...

Knut Arne Vedaa

On 17.10.2012 22:01, Mark Claassen wrote:
> I really like the promise of the ObservableList, but am a bit wary of the
> current implementation.
> We have several instances in our code where we rely on unique models
> wrapping the same data.  We can have a large list of items, and show them
> in a combo box, and list, and a table.  Generally, only one of these is
> visible at a given time, but having a single backing list is very handy.
> Further, each list can be independently sorted and filtered via a decorator
> construct in the model.
> By tweaking the underlying list object (so it fires events) and model (so
> that it listens to events), we accomplished something similar to an
> ObservableList:
> * Changes to the underlying list fires events to the models
> * Models could then respond as appropriate, add/deleting/changing items as
> necessary...perhaps triggering the view to re-sort the decorator as
> necessary
> However, different from ObservableList, we can manage the
> side-effects...not sorting and filtering all models in an identical fashion.
> Is there a mechanism to do this in JavaFX?  The Swing methodology seemed a
> nice way to do it.  With ObservableLists, it seems that in the end, I don't
> get much.  The more common / trivial case is handled.  However, in the case
> of a our application, I will need to
> * Make several ObservableLists, one for each control
> * Manage the synchronization between these lists programmaticly by myself.
> Am I missing something?   Is there a way to have an ObservableList
> listening to another ObservableList, so that list #2 can notice the updates
> without forcing the sort order and filtering on list #1?  Or am I just
> going to end up having to cut through extra/different layers of abstraction
> to re-implement what I had in Swing.
> Mark

More information about the openjfx-dev mailing list