public String getKey(ModelData model) {
return model.get("id");
}
});
ModelData m = createModel("Fast Tree");
store.add(m, false);
tree.addListener(Events.BeforeExpand, new Listener<TreePanelEvent<ModelData>>() {
public void handleEvent(TreePanelEvent<ModelData> be) {
if (be.getNode().getItemCount() != 0) {
return;
}
List<ModelData> list = new ArrayList<ModelData>();
for (int i = 0; i < 500; i++) {
ModelData m = createModel("Tree Item " + i);
list.add(m);
}
tree.getStore().insert(be.getNode().getModel(), list, 0, true);
}
});