ItEr44S10CUGravacionModelosUnidadesTraballoItEr43S12: Having to do a reload due to a zk bug.

This commit is contained in:
Óscar González Fernández 2010-01-22 20:50:39 +01:00
parent 9cc0e2c213
commit 2846af7044
2 changed files with 10 additions and 2 deletions

View file

@ -233,7 +233,7 @@ public class LeftTasksTree extends HtmlMacroComponent {
/**
* This class is a workaround for an issue with zk {@link Tree}. Once the
* tree is created, a node with more children can't be added. Only the top
* tree is created, adding a node with children is troublesome. Only the top
* element is added to the tree, although the element has children. The Tree
* discards the adding event for the children because the parent says it's
* not loaded. This is the condition that is not satisfied:<br />

View file

@ -119,8 +119,16 @@ public class OrderElementTreeController extends TreeController<OrderElement> {
public void found(OrderElementTemplate template) {
OrderLineGroup parent = (OrderLineGroup) getModel()
.getRoot();
orderModel.createFrom(parent, template);
OrderElement created = orderModel.createFrom(parent,
template);
getModel().addNewlyAddedChildrenOf(parent);
if (!created.getChildren().isEmpty()) {
// due to a bug of zk Tree, the children of a newly
// added element are not shown. Forcing reload.
// See comments at
// org.zkoss.ganttz.LeftTasksTree.DeferredFiller
Util.reloadBindings(tree);
}
}
});
}