fother
25 Aug 2009, 4:14 AM
actually in gxt if you set parent dont added the son at the parent..
code example..
final BaseTreeModel father = new BaseTreeModel();
final BaseTreeModel son = new BaseTreeModel();
son.setParent(father);
System.out.println(father.getChildren());
always will return a empty list...
my suggest is that if the model have the parent automatic should be have the son..
code example
final BaseTreeModel father = new BaseTreeModel();
final BaseTreeModel son = new BaseTreeModel() {
@Override
public void setParent(final TreeModel parent) {
super.setParent(parent);
parent.getChildren().add(this);
}
};
son.setParent(father);
System.out.println(father.getChildren());
will return the childrens...
code example..
final BaseTreeModel father = new BaseTreeModel();
final BaseTreeModel son = new BaseTreeModel();
son.setParent(father);
System.out.println(father.getChildren());
always will return a empty list...
my suggest is that if the model have the parent automatic should be have the son..
code example
final BaseTreeModel father = new BaseTreeModel();
final BaseTreeModel son = new BaseTreeModel() {
@Override
public void setParent(final TreeModel parent) {
super.setParent(parent);
parent.getChildren().add(this);
}
};
son.setParent(father);
System.out.println(father.getChildren());
will return the childrens...