item.setCaption("New folder");
item.setClickAction(new UXAbstractAction() {
@Override
public void doAction() {
if (newElementAction != null)
newElementAction.execute(new UXEvent(null, BookmarkTreeComp.this));
}
});
if (optionLevel > 1)
new UXMenuSeparator(menu);
}
if (Arrays.asList(2, 3, 6, 7).contains(optionLevel)) {
item = new UXMenuButton(menu);
item.setCaption("Edit");
item.setClickAction(new UXAbstractAction() {
@Override
public void doAction() {
TreeItem[] items = treeWidget.getSelection();
if (items.length <= 0) {
return;
}
TreeItem node = items[0];
if (node == null || node == rootNode) return;
if (map_1.get(node) != null && editElementAction != null) {
editElementAction.execute(new UXEvent(null, BookmarkTreeComp.this));
} else if (map_3.get(node) != null && editElementAction != null) {
editElementAction.execute(new UXEvent(null, BookmarkTreeComp.this));
}
}
});
}
if (Arrays.asList(4, 5, 6, 7).contains(optionLevel)) {
item = new UXMenuButton(menu);
item.setCaption("Remove");
item.setClickAction(new UXAbstractAction() {
@Override
public void doAction() {
TreeItem[] items = treeWidget.getSelection();
if (items.length <= 0) {
return;
}
TreeItem node = items[0];
if (node == null || node == rootNode) return;
if (map_1.get(node) != null && removeElementAction != null) {
removeElementAction.execute(new UXEvent(null, BookmarkTreeComp.this));
} else if (map_3.get(node) != null) {
removeElementAction.execute(new UXEvent(null, BookmarkTreeComp.this));
}
}
});
}
}