我试图在条件变为真时允许在TreeGrid中删除项目,例如节点不是叶子。
节点:
public class Node {
List<Node> children;
...
public boolean isLeaf() {
return children.isEmpty()
}
}
的TreeView:
public class TreeView extends TreeGrid<Node> {
public TreeView(){
...
TreeGridDropTarget<Node> dropTarget = new TreeGridDropTarget<>(this, DropMode.ON_TOP);
dropTarget.setDropEffect(DropEffect.MOVE);
dropTarget.addGridDropListener(event -> {
event.getDragSourceExtension().ifPresent(source -> {
Notification.show("it works");
});
});
}
}
如何检查是否允许grid元素包含子元素?那么如何添加验收标准?