public static class TreeRendererFactory {
public static TreeitemRenderer getBeanTreeitemRenderer() {
return new TreeitemRenderer() {
public void render(Treeitem item, Object data) throws Exception {
SampleBean b = (SampleBean) ((DefaultTreeNode) data).getData();
Treerow tr;
if (item.getTreerow() == null) {
tr = new Treerow();
tr.setParent(item);
} else {
tr = item.getTreerow();
tr.getChildren().clear();
}
tr.appendChild(new Treecell(b.getName()));
tr.appendChild(new Treecell(b.getNumber()+""));
tr.appendChild(new Treecell(df.format(b.getDate())));
item.setValue(data);
item.setOpen(true);
}
};
}