I'am trying to allow dropping items in a TreeGrid when a condition becomes true e.g. node is not a leaf.
Node:
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");
});
});
}
}
How to check if grid element is allowed to contain subelement? So how to add acceptance criteria?