Vaadin:如何在TreeGrid上设置drop标准

时间:2017-09-03 21:24:09

标签: vaadin treegrid vaadin8

我试图在条件变为真时允许在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元素包含子元素?那么如何添加验收标准?

0 个答案:

没有答案