> Is this already supported (and I can't see the wood for the trees)? If
> not, is there an interest in adding this? I would try to help where I
> can.
This functionality isn't available but seems like it should be doable.
If anything I think having custom per-binding base classes would be a useful
feature, and `List` could just have it's own out-of-the-box custom base class.
Dunno, let me look in to it.
> When the domain object d changes, the panel gets magically notified
> and in order to refresh itself, removes the sub-views of all the items
> of the old list and subsequently adds sub-views for the items in the
> current list.
Thanks for including the use case--I'm really curious about what exactly should
happen. Let me try a concrete example and hopefully I won't be too slow to
understand what you're trying to do.
Company c = // get from some where
List<Employee> ees = c.getEmployees(); // this is what you want a binding for
// so make a company binding
CompanyBinding cB = new CompanyBinding(c);
// get ListBinding for employees
ListBinding eesB = cB.employees();
// show the company's ees on the screen
ListUiWidget w = // get from some where
w.setModel(eesB);
// Inside ListUiWidget.render():
List itemsInList = model.get(); // returns List<Employee>
for (int i = 0; i < itemsInList; i++) {
Object itemI = itemsInList.get(i);
// here is the sub-view for itemI
addUiForModel(itemI);
}
Hm. So...yeah, here each UI sub-view is getting the real Employee object, which
it could read getters/setters from, but you're saying is not powerful enough to
out and out, say, replace the 2nd EmployeeA with a different EmployeeB in its
place?
What happens if your `Company` model changes and there is no longer a 2nd or
3rd employee in the list? If the sub-view had gotten a binding from `itemAt(2)`
or `itemAt(3)`, they those bindings now just return null?
You mentioned new sub-views are added when the `Company` changes--wouldn't the
entire `ListUiWidget.render` re-run?
Just trying to understand the expected behavior you want--sorry that I'm not
getting it right away.
- Stephen