ItEr48S04ValidacionEProbasFuncionaisItEr47S04: [Bug #342] Fixing bug.
The problem arises from the fact that zk tree doesn't handle well insertion events on elements newly created. Using new facility of MutableTreeModel for only sending the insertion event for the top element.
This commit is contained in:
parent
2dd87e8c94
commit
5d064ab726
2 changed files with 11 additions and 9 deletions
|
|
@ -160,13 +160,6 @@ public class OrderElementTreeController extends TreeController<OrderElement> {
|
|||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.List;
|
|||
import org.navalplanner.business.trees.ITreeNode;
|
||||
import org.navalplanner.business.trees.ITreeParentNode;
|
||||
import org.zkoss.ganttz.util.MutableTreeModel;
|
||||
import org.zkoss.ganttz.util.MutableTreeModel.IChildrenExtractor;
|
||||
import org.zkoss.zul.TreeModel;
|
||||
|
||||
/**
|
||||
|
|
@ -231,11 +232,19 @@ public abstract class EntitiesTree<T extends ITreeNode<T>> {
|
|||
}
|
||||
for (WithPosition each : addings) {
|
||||
tree.add(parent.getThis(), each.position, Collections
|
||||
.singletonList(each.element));
|
||||
addChildren(tree, Collections.singletonList(each.element));
|
||||
.singletonList(each.element), childrenAdder());
|
||||
}
|
||||
}
|
||||
|
||||
private IChildrenExtractor<T> childrenAdder() {
|
||||
return new IChildrenExtractor<T>() {
|
||||
@Override
|
||||
public List<? extends T> getChildren(T parent) {
|
||||
return parent.getChildren();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private List<T> getTreeChildren(ITreeParentNode<T> parent) {
|
||||
List<T> result = new ArrayList<T>();
|
||||
int childCount = tree.getChildCount(parent);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue