PDA

View Full Version : BaseTreeModel implementation issue



francescoNemesi
20 Jul 2009, 11:31 AM
Hello there,

I migrated my GXT1.2 application to GXT 2.0 with less hassle than I was expecting, which is good... I have an issue with the new implementation of the BaseTreeModel class...

Gxt 1.2.4 used a Generics implementation so that the model could "contain" T extending TreeModel:


public class BaseTreeModel<T extends TreeModel> extends BaseModel implements TreeModel<T> .......

Gxt 2.0 now uses a more rigid implementation:


public class BaseTreeModel extends BaseModel implements TreeModel ....

My application makes use of several trees with their own model. In GXT 1.2 I was able to write a class like this



public class MyTreeModel extends BaseTreeModel<MyTreeModel> {

private static final long serialVersionUID = -7113778574106602153L;

public MyTreeModel() {
super();
}

@Override
public void setChildren(List<MyTreeModel> children) {
super.setChildren(children);
//DO SOMETHING ELSE...
}

}


and then have some other class populate the model and setChildren(). End of the story.

With GXT 2.0 I can not do this anymore as the setChildren method only accepts List<ModelData>. Period. This means that I have to change the old code to adapt to this new less flexible approach, which, IMHO, is something that could have been avoided by leaving the TreeModel implementation as it was.

Why was this choice made? Am I overlooking some basics??? Is there a quick workaround to this?

Thanks,
Francesco