|[DataBinding] Model and UI Independence for Collections [message #1699121]
||Sun, 21 June 2015 15:46
| Dale Smith
Registered: June 2013
I want to use data binding for collection based entities and have full independence of the UI and Model. I want the model to hold an IObservableCollection (list, set or map), have the ability to update the model from both the UI thread and from tasks on other threads (such as an "import" job) and have the UI correctly reflect all collection changes no matter what thread they've occurred on.|
My approach so far is to have my model directly support observable collections. I've tried subclassing AbstractObservableSet with my collection entity but run into null Realm exceptions because Eclipse hasn't yet set the default Realm. And even if I moved model initialization to occur after default Realm setup, I have a hard dependency on the UI and UI setup and I believe (haven't tried or tested) limitations on what threads can update the Observable.
I've considered directly implementing an IObservableXXX interface but that looks quite messy to do.
Is there something fundamental that I'm not understanding here about using data binding and realms for collections in a way that 1) allows full UI and model independence and 2) allows multiple threads to update the observable and have the UI reflect those changes??
I've searched for a direct answer to this but have come up empty. Any help or references are greatly appreciated.
PS - I know that data binding works nicely for simple entities because the JavaBeans spec provides the mechanism for observing changes.
Powered by FUDForum
. Page generated in 0.02084 seconds