I trying to use treegrid, first I catch all the code in demo and put in my app, but the tree grid don`t show the childs, he only show the first time…
so now I tryng to create my ow DemoContainer just like this:
public class DemoContainer extends HierarchicalContainer implements Collapsible, Measurable {
static final String PROPERTY_NAME = "Name";
static final String PROPERTY_HOURS = "Hoursdone";
public DemoContainer() {
super.addContainerProperty("Name", String.class, "");
super.addContainerProperty("Hoursdone", String.class, "");
}
public Item addItem(TbCategoriaReceitaDespesa categoria){
Item r = super.addItem(categoria);
r.getItemProperty("Name").setValue(categoria.getNmDespesaCategoria());
r.getItemProperty("Hoursdone").setValue(categoria.getIdDespesaCategoria());
super.setChildrenAllowed(r,true);
return r;
}
public void addChildren(TbCategoriaReceitaDespesa categoria, TbCategoriaReceitaDespesa parent){
Item r = addItem(categoria);
super.setParent(categoria,parent);
}
@Override
public void setCollapsed(Object o, boolean b) {
System.out.println("entrou 1");
}
@Override
public boolean isCollapsed(Object o) {
System.out.println("entrou 2");
return true;
}
@Override
public int getDepth(Object o) {
return 0;
}
}
But in my Code I can`t add children he put below the parent and not inside.
how can I fix this?
tks