PDA

View Full Version : Adding children to a tree of BeanModels



rian.k
25 May 2009, 1:33 AM
Hi,

I'm using a BeanModelReader to read some Beans into a tree. Some Beans contain Collections, which I'd like to render as their child nodes. Can I achieve this without using a TreeModel?


BeanModelReaderAdapter reader = new BeanModelReaderAdapter(new BeanModelReader());

TreeLoader loader = new BaseTreeLoader<BeanModel>(proxy, reader) {
@Override
public boolean hasChildren(BeanModel parent) {
List<BeanModel> roles = parent.get("collection");
return (collection != null && !collection.isEmpty());
}
};
loader.load();

TreeStore<BeanModel> store = new TreeStore<BeanModel>(loader);

TreeBinder binder = new TreeBinder<BeanModel>(usersTree, store);
binder.setAutoLoad(true);
binder.init();