Search in sources :

Example 1 with Tree

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();
}
Also used : FlowContext(org.jboss.hal.flow.FlowContext) SelectionContext(org.jboss.hal.ballroom.tree.SelectionContext) IsElement(org.jboss.gwt.elemento.core.IsElement) Provider(javax.inject.Provider) Elements.a(org.jboss.gwt.elemento.core.Elements.a) Environment(org.jboss.hal.config.Environment) CHOOSE(org.jboss.hal.core.modelbrowser.SingletonState.CHOOSE) VALUE_TYPE(org.jboss.hal.dmr.ModelDescriptionConstants.VALUE_TYPE) LoggerFactory(org.slf4j.LoggerFactory) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) Node(org.jboss.hal.ballroom.tree.Node) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) CSS.modelBrowserButtons(org.jboss.hal.resources.CSS.modelBrowserButtons) HTMLElement(elemental2.dom.HTMLElement) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) Message(org.jboss.hal.spi.Message) FinishReset(org.jboss.hal.ballroom.form.Form.FinishReset) SERVER_GROUP(org.jboss.hal.dmr.ModelDescriptionConstants.SERVER_GROUP) READ_RESOURCE_OPERATION(org.jboss.hal.dmr.ModelDescriptionConstants.READ_RESOURCE_OPERATION) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) CrudOperations(org.jboss.hal.core.CrudOperations) Collections.emptyList(java.util.Collections.emptyList) LayoutBuilder.row(org.jboss.hal.ballroom.LayoutBuilder.row) MARGIN_BIG(org.jboss.hal.ballroom.Skeleton.MARGIN_BIG) CSS(org.jboss.hal.resources.CSS) Skeleton.applicationOffset(org.jboss.hal.ballroom.Skeleton.applicationOffset) EventType.click(org.jboss.gwt.elemento.core.EventType.click) STRING(org.jboss.hal.dmr.ModelDescriptionConstants.STRING) CSS.btnGroup(org.jboss.hal.resources.CSS.btnGroup) Sets(com.google.common.collect.Sets) Tree(org.jboss.hal.ballroom.tree.Tree) List(java.util.List) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) MetadataProcessor(org.jboss.hal.meta.processing.MetadataProcessor) CSS.tmTagRemove(org.jboss.hal.resources.CSS.tmTagRemove) Flow.series(org.jboss.hal.flow.Flow.series) Footer(org.jboss.hal.spi.Footer) CSS.tagManagerContainer(org.jboss.hal.resources.CSS.tagManagerContainer) ModelNodeHelper(org.jboss.hal.dmr.ModelNodeHelper) PROFILE(org.jboss.hal.dmr.ModelDescriptionConstants.PROFILE) CSS.fontAwesome(org.jboss.hal.resources.CSS.fontAwesome) MARGIN_SMALL(org.jboss.hal.ballroom.Skeleton.MARGIN_SMALL) ModelNode(org.jboss.hal.dmr.ModelNode) Completable(rx.Completable) Elements.div(org.jboss.gwt.elemento.core.Elements.div) TYPE(org.jboss.hal.dmr.ModelDescriptionConstants.TYPE) SELECTED_GROUP(org.jboss.hal.meta.StatementContext.Expression.SELECTED_GROUP) MessageEvent(org.jboss.hal.spi.MessageEvent) SuccessfulMetadataCallback(org.jboss.hal.meta.processing.SuccessfulMetadataCallback) ADD(org.jboss.hal.dmr.ModelDescriptionConstants.ADD) CSS.btnDefault(org.jboss.hal.resources.CSS.btnDefault) LayoutBuilder.column(org.jboss.hal.ballroom.LayoutBuilder.column) CSS.tmTag(org.jboss.hal.resources.CSS.tmTag) CSS.clickable(org.jboss.hal.resources.CSS.clickable) Stack(java.util.Stack) FlowContext(org.jboss.hal.flow.FlowContext) Outcome(org.jboss.hal.flow.Outcome) HashSet(java.util.HashSet) Inject(javax.inject.Inject) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) Property(org.jboss.hal.dmr.Property) OPERATIONS(org.jboss.hal.dmr.ModelDescriptionConstants.OPERATIONS) Task(org.jboss.hal.flow.Task) Progress(org.jboss.hal.flow.Progress) AddressTemplate(org.jboss.hal.meta.AddressTemplate) NameItem(org.jboss.hal.core.mbui.dialog.NameItem) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) REQUEST_PROPERTIES(org.jboss.hal.dmr.ModelDescriptionConstants.REQUEST_PROPERTIES) CSS.modelBrowserContent(org.jboss.hal.resources.CSS.modelBrowserContent) Elements.button(org.jboss.gwt.elemento.core.Elements.button) CSS.tagManagerTag(org.jboss.hal.resources.CSS.tagManagerTag) Logger(org.slf4j.Logger) Operation(org.jboss.hal.dmr.Operation) CREATE(org.jboss.hal.core.modelbrowser.SingletonState.CREATE) Ids(org.jboss.hal.resources.Ids) OBJECT(org.jboss.hal.dmr.ModelDescriptionConstants.OBJECT) Wizard(org.jboss.hal.ballroom.wizard.Wizard) EventBus(com.google.web.bindery.event.shared.EventBus) MODEL_BROWSER_ROOT(org.jboss.hal.resources.Ids.MODEL_BROWSER_ROOT) CSS.btn(org.jboss.hal.resources.CSS.btn) SelectionContext(org.jboss.hal.ballroom.tree.SelectionContext) CSS.vh(org.jboss.hal.resources.CSS.vh) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) Collectors.toList(java.util.stream.Collectors.toList) Resources(org.jboss.hal.resources.Resources) SELECTED_PROFILE(org.jboss.hal.meta.StatementContext.Expression.SELECTED_PROFILE) HTMLButtonElement(elemental2.dom.HTMLButtonElement) Collections(java.util.Collections) Elements.span(org.jboss.gwt.elemento.core.Elements.span) Elements(org.jboss.gwt.elemento.core.Elements) Form(org.jboss.hal.ballroom.form.Form) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder)

Example 2 with Tree

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();
}
Also used : Dialog(org.jboss.hal.ballroom.dialog.Dialog) IsElement(org.jboss.gwt.elemento.core.IsElement) NODE_ID(org.jboss.hal.client.deployment.ContentParser.NODE_ID) Environment(org.jboss.hal.config.Environment) Constraint(org.jboss.hal.meta.security.Constraint) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) Node(org.jboss.hal.ballroom.tree.Node) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Icons(org.jboss.hal.resources.Icons) TextBoxItem(org.jboss.hal.ballroom.form.TextBoxItem) Single(rx.Single) Search(org.jboss.hal.ballroom.Search) AuthorisationDecision(org.jboss.hal.meta.security.AuthorisationDecision) HTMLElement(elemental2.dom.HTMLElement) Message(org.jboss.hal.spi.Message) Metadata(org.jboss.hal.meta.Metadata) Elements.i(org.jboss.gwt.elemento.core.Elements.i) Names(org.jboss.hal.resources.Names) Skeleton.applicationHeight(org.jboss.hal.ballroom.Skeleton.applicationHeight) FileItem(org.jboss.hal.ballroom.form.FileItem) Collections.emptyList(java.util.Collections.emptyList) LayoutBuilder.row(org.jboss.hal.ballroom.LayoutBuilder.row) MARGIN_BIG(org.jboss.hal.ballroom.Skeleton.MARGIN_BIG) Set(java.util.Set) CSS(org.jboss.hal.resources.CSS) Skeleton.applicationOffset(org.jboss.hal.ballroom.Skeleton.applicationOffset) EventType.click(org.jboss.gwt.elemento.core.EventType.click) Sets(com.google.common.collect.Sets) JsArray(elemental2.core.JsArray) Tree(org.jboss.hal.ballroom.tree.Tree) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) UIConstants(org.jboss.hal.resources.UIConstants) Browser(org.jboss.hal.js.Browser) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) Attachable(org.jboss.hal.ballroom.Attachable) Optional(java.util.Optional) Math.max(java.lang.Math.max) ValidationResult(org.jboss.hal.ballroom.form.ValidationResult) MARGIN_SMALL(org.jboss.hal.ballroom.Skeleton.MARGIN_SMALL) ModelNode(org.jboss.hal.dmr.ModelNode) Completable(rx.Completable) Strings.nullToEmpty(com.google.common.base.Strings.nullToEmpty) MessageEvent(org.jboss.hal.spi.MessageEvent) LayoutBuilder.column(org.jboss.hal.ballroom.LayoutBuilder.column) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) AceEditor(org.jboss.hal.ballroom.editor.AceEditor) ConstructorContentsArrayUnionType(elemental2.dom.File.ConstructorContentsArrayUnionType) AddressTemplate(org.jboss.hal.meta.AddressTemplate) EmptyState(org.jboss.hal.ballroom.EmptyState) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) Operation(org.jboss.hal.dmr.Operation) Ids(org.jboss.hal.resources.Ids) File(elemental2.dom.File) Options(org.jboss.hal.ballroom.editor.Options) EventBus(com.google.web.bindery.event.shared.EventBus) SelectionContext(org.jboss.hal.ballroom.tree.SelectionContext) DialogFactory(org.jboss.hal.ballroom.dialog.DialogFactory) DomGlobal.window(elemental2.dom.DomGlobal.window) Consumer(java.util.function.Consumer) Content(org.jboss.hal.core.deployment.Content) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) Resources(org.jboss.hal.resources.Resources) Format(org.jboss.hal.ballroom.Format) HTMLButtonElement(elemental2.dom.HTMLButtonElement) Strings(org.jboss.hal.resources.Strings) HTMLImageElement(elemental2.dom.HTMLImageElement) Elements(org.jboss.gwt.elemento.core.Elements) Form(org.jboss.hal.ballroom.form.Form) JsArray(elemental2.core.JsArray) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Node(org.jboss.hal.ballroom.tree.Node) ModelNode(org.jboss.hal.dmr.ModelNode) Tree(org.jboss.hal.ballroom.tree.Tree) Operation(org.jboss.hal.dmr.Operation)

Aggregations

Sets (com.google.common.collect.Sets)2 SafeHtmlUtils (com.google.gwt.safehtml.shared.SafeHtmlUtils)2 EventBus (com.google.web.bindery.event.shared.EventBus)2 HTMLButtonElement (elemental2.dom.HTMLButtonElement)2 HTMLElement (elemental2.dom.HTMLElement)2 Collections.emptyList (java.util.Collections.emptyList)2 Elements (org.jboss.gwt.elemento.core.Elements)2 EventType.click (org.jboss.gwt.elemento.core.EventType.click)2 IsElement (org.jboss.gwt.elemento.core.IsElement)2 LabelBuilder (org.jboss.hal.ballroom.LabelBuilder)2 LayoutBuilder.column (org.jboss.hal.ballroom.LayoutBuilder.column)2 LayoutBuilder.row (org.jboss.hal.ballroom.LayoutBuilder.row)2 MARGIN_BIG (org.jboss.hal.ballroom.Skeleton.MARGIN_BIG)2 MARGIN_SMALL (org.jboss.hal.ballroom.Skeleton.MARGIN_SMALL)2 Skeleton.applicationOffset (org.jboss.hal.ballroom.Skeleton.applicationOffset)2 Form (org.jboss.hal.ballroom.form.Form)2 Node (org.jboss.hal.ballroom.tree.Node)2 SelectionContext (org.jboss.hal.ballroom.tree.SelectionContext)2 Tree (org.jboss.hal.ballroom.tree.Tree)2 Environment (org.jboss.hal.config.Environment)2