use of org.jboss.hal.ballroom.tree.Tree in project console by hal.
the class ModelBrowser method emptyTree.
@SuppressWarnings("unchecked")
private void emptyTree() {
Context context = new Context(ResourceAddress.root(), Collections.emptySet());
Node<Context> rootNode = new Node.Builder<>(MODEL_BROWSER_ROOT, Names.NOT_AVAILABLE, context).asyncFolder().build();
tree = new Tree<>(Ids.MODEL_BROWSER, rootNode, (node, callback) -> callback.result(new Node[0]));
Elements.removeChildrenFrom(treeContainer);
treeContainer.appendChild(tree.element());
tree.attach();
childrenPanel.hide();
resourcePanel.hide();
}
use of org.jboss.hal.ballroom.tree.Tree in project console by hal.
the class BrowseContentElement method browseContent.
private Completable browseContent() {
ResourceAddress address = new ResourceAddress().add(DEPLOYMENT, content.getName());
Operation operation = new Operation.Builder(address, BROWSE_CONTENT).build();
return dispatcher.execute(operation).doOnSuccess(result -> {
String contentName = SafeHtmlUtils.htmlEscapeAllowEntities(content.getName());
Node<ContentEntry> root = new Node.Builder<>(Ids.CONTENT_TREE_ROOT, contentName, new ContentEntry()).root().folder().open().build();
JsArray<Node<ContentEntry>> nodes = new JsArray<>();
new ContentParser().parse(root, nodes, result.isDefined() ? result.asList() : emptyList());
if (tree != null) {
tree.destroy();
tree = null;
}
tree = new Tree<>(Ids.CONTENT_TREE, nodes);
Elements.removeChildrenFrom(treeContainer);
treeContainer.appendChild(tree.element());
tree.attach();
tree.onSelectionChange((event, selectionContext) -> {
if (!"ready".equals(selectionContext.action)) {
// NON-NLS
onNodeSelected(selectionContext);
}
});
}).toCompletable();
}
Aggregations