Search in sources :

Example 11 with Table

use of org.jboss.hal.ballroom.table.Table in project console by hal.

the class OtherSettingsView method attach.

@Override
public void attach() {
    super.attach();
    securityDomainElement.getTable().onSelectionChange(table -> {
        // update the list of realms for default-realm attribute
        if (table.hasSelection()) {
            List<String> realmList = table.selectedRow().get(REALMS).asList().stream().map(modelNode -> modelNode.get(REALM).asString()).collect(toList());
            SingleSelectBoxItem singleSelectBoxItem = (SingleSelectBoxItem) securityDomainElement.getForm().<String>getFormItem(DEFAULT_REALM);
            singleSelectBoxItem.updateAllowedValues(realmList);
        }
    });
    ldapKeyStoreElement.attach();
    policyElement.attach();
}
Also used : ModelNode(org.jboss.hal.dmr.ModelNode) SYSLOG_AUDIT_LOG(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.SYSLOG_AUDIT_LOG) SERVER_SSL_CONTEXT(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.SERVER_SSL_CONTEXT) AGGREGATE_PROVIDERS(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.AGGREGATE_PROVIDERS) CredentialReference(org.jboss.hal.core.elytron.CredentialReference) HashMap(java.util.HashMap) LayoutBuilder.column(org.jboss.hal.ballroom.LayoutBuilder.column) DIR_CONTEXT(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.DIR_CONTEXT) Inject(javax.inject.Inject) KEY_MANAGER(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.KEY_MANAGER) Arrays.asList(java.util.Arrays.asList) FILTERING_KEY_STORE(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.FILTERING_KEY_STORE) TRUST_MANAGER(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.TRUST_MANAGER) Map(java.util.Map) HalViewImpl(org.jboss.hal.core.mvp.HalViewImpl) AGGREGATE_SECURITY_EVENT_LISTENER(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.AGGREGATE_SECURITY_EVENT_LISTENER) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) PROVIDER_LOADER(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.PROVIDER_LOADER) SERVER_SSL_SNI_CONTEXT(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.SERVER_SSL_SNI_CONTEXT) AUTHENTICATION_CONFIGURATION(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.AUTHENTICATION_CONFIGURATION) Table(org.jboss.hal.ballroom.table.Table) LayoutBuilder.row(org.jboss.hal.ballroom.LayoutBuilder.row) CLIENT_SSL_CONTEXT(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.CLIENT_SSL_CONTEXT) Ids(org.jboss.hal.resources.Ids) CREDENTIAL_STORE(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.CREDENTIAL_STORE) SingleSelectBoxItem(org.jboss.hal.ballroom.form.SingleSelectBoxItem) FILE_AUDIT_LOG(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.FILE_AUDIT_LOG) VerticalNavigation(org.jboss.hal.ballroom.VerticalNavigation) PathsAutoComplete(org.jboss.hal.core.configuration.PathsAutoComplete) PERIODIC_ROTATING_FILE_AUDIT_LOG(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.PERIODIC_ROTATING_FILE_AUDIT_LOG) List(java.util.List) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) Collectors.toList(java.util.stream.Collectors.toList) KEY_STORE(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.KEY_STORE) CERTIFICATE_AUTHORITY_ACCOUNT(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.CERTIFICATE_AUTHORITY_ACCOUNT) MbuiContext(org.jboss.hal.core.mbui.MbuiContext) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) ResourceElement(org.jboss.hal.core.mbui.ResourceElement) CUSTOM_SECURITY_EVENT_LISTENER(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.CUSTOM_SECURITY_EVENT_LISTENER) SECURITY_DOMAIN(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.SECURITY_DOMAIN) NamedNode(org.jboss.hal.dmr.NamedNode) Collections(java.util.Collections) AUTHENTICATION_CONTEXT(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.AUTHENTICATION_CONTEXT) Form(org.jboss.hal.ballroom.form.Form) SIZE_ROTATING_FILE_AUDIT_LOG(org.jboss.hal.client.configuration.subsystem.elytron.ElytronResource.SIZE_ROTATING_FILE_AUDIT_LOG) SingleSelectBoxItem(org.jboss.hal.ballroom.form.SingleSelectBoxItem)

Example 12 with Table

use of org.jboss.hal.ballroom.table.Table in project console by hal.

the class JpaView method buildChildPanel.

private HTMLElement buildChildPanel(String baseId, AddressTemplate template, String title) {
    String resource = template.lastName();
    Metadata metadata = metadataRegistry.lookup(template);
    Table<NamedNode> table = new ModelNodeTable.Builder<NamedNode>(Ids.build(baseId, resource, Ids.TABLE), metadata).column(NAME, (cell, type, row, meta) -> row.getName()).build();
    Form<NamedNode> form = new ModelNodeForm.Builder<NamedNode>(Ids.build(baseId, resource, Ids.FORM), metadata).readOnly().includeRuntime().build();
    registerAttachable(table);
    registerAttachable(form);
    childTables.put(resource, table);
    childForms.put(resource, form);
    return section().add(h(1).textContent(title)).add(p().css(clearfix).add(span().textContent(metadata.getDescription().getDescription())).add(a().css(clickable, pullRight).on(click, event -> refresh()).add(span().css(fontAwesome("refresh"), marginRight5)).add(span().textContent(resources.constants().refresh())))).add(table.element()).add(form.element()).element();
}
Also used : ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) HashMap(java.util.HashMap) LayoutBuilder.column(org.jboss.hal.ballroom.LayoutBuilder.column) GWT(com.google.gwt.core.client.GWT) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Tabs(org.jboss.hal.ballroom.Tabs) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) AddressTemplate(org.jboss.hal.meta.AddressTemplate) Constants(org.jboss.hal.resources.Constants) HTMLElement(elemental2.dom.HTMLElement) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) NAME(org.jboss.hal.dmr.ModelDescriptionConstants.NAME) HalViewImpl(org.jboss.hal.core.mvp.HalViewImpl) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) ModelNodeHelper.asNamedNodes(org.jboss.hal.dmr.ModelNodeHelper.asNamedNodes) LinkedListMultimap(com.google.common.collect.LinkedListMultimap) Table(org.jboss.hal.ballroom.table.Table) LayoutBuilder.row(org.jboss.hal.ballroom.LayoutBuilder.row) Ids(org.jboss.hal.resources.Ids) CSS(org.jboss.hal.resources.CSS) EventType.click(org.jboss.gwt.elemento.core.EventType.click) VerticalNavigation(org.jboss.hal.ballroom.VerticalNavigation) List(java.util.List) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) Resources(org.jboss.hal.resources.Resources) NamedNode(org.jboss.hal.dmr.NamedNode) Elements(org.jboss.gwt.elemento.core.Elements) Form(org.jboss.hal.ballroom.form.Form) Metadata(org.jboss.hal.meta.Metadata) NamedNode(org.jboss.hal.dmr.NamedNode) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm)

Example 13 with Table

use of org.jboss.hal.ballroom.table.Table in project console by hal.

the class ClusteringView method init.

@PostConstruct
void init() {
    Metadata metadata = mbuiContext.metadataRegistry().lookup(BRIDGE_TEMPLATE);
    crForm = cr.form(MESSAGING_SERVER, metadata, CREDENTIAL_REFERENCE, PASSWORD, () -> bridgeForm.<String>getFormItem(PASSWORD).getValue(), () -> presenter.bridgeAddress(bridgeTable.hasSelection() ? bridgeTable.selectedRow().getName() : null), () -> presenter.reload());
    bridgeTable = new ModelNodeTable.Builder<NamedNode>(Ids.build(MESSAGING_SERVER, BRIDGE, Ids.TABLE), metadata).button(mbuiContext.resources().constants().add(), table -> presenter.addBridge(ServerSubResource.BRIDGE), Constraint.executable(BRIDGE_TEMPLATE, ADD)).button(mbuiContext.resources().constants().remove(), table -> presenter.remove(ServerSubResource.BRIDGE, table.selectedRow()), Scope.SELECTED, Constraint.executable(BRIDGE_TEMPLATE, REMOVE)).column(NAME, (cell, type, row, meta) -> row.getName()).build();
    bridgeForm = new ModelNodeForm.Builder<NamedNode>(Ids.build(Ids.MESSAGING_BRIDGE, Ids.FORM), metadata).onSave((form, changedValues) -> presenter.save(ServerSubResource.BRIDGE, form, changedValues)).prepareReset(form -> presenter.reset(ServerSubResource.BRIDGE, form)).build();
    bridgeForm.addFormValidation(new CredentialReference.AlternativeValidation<>(PASSWORD, () -> crForm.getModel(), mbuiContext.resources()));
    Tabs tabs = new Tabs(Ids.build(MESSAGING_SERVER, BRIDGE, Ids.TAB_CONTAINER));
    tabs.add(Ids.build(MESSAGING_SERVER, BRIDGE, ATTRIBUTES, Ids.TAB), mbuiContext.resources().constants().attributes(), bridgeForm.element());
    tabs.add(Ids.build(MESSAGING_SERVER, BRIDGE, CREDENTIAL_REFERENCE, Ids.TAB), Names.CREDENTIAL_REFERENCE, crForm.element());
    HTMLElement bridgeSection = section().add(h(1).textContent(Names.BRIDGE)).add(p().textContent(metadata.getDescription().getDescription())).add(bridgeTable).add(tabs).element();
    registerAttachable(bridgeTable, bridgeForm, crForm);
    navigation.insertPrimary(Ids.build(MESSAGING_SERVER, BRIDGE, Ids.ITEM), null, Names.BRIDGE, "fa fa-road", bridgeSection);
}
Also used : ModelNode(org.jboss.hal.dmr.ModelNode) SELECTED_SERVER_TEMPLATE(org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.SELECTED_SERVER_TEMPLATE) Constraint(org.jboss.hal.meta.security.Constraint) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) CredentialReference(org.jboss.hal.core.elytron.CredentialReference) MbuiViewImpl(org.jboss.hal.core.mbui.MbuiViewImpl) Tabs(org.jboss.hal.ballroom.Tabs) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) Elements.section(org.jboss.gwt.elemento.core.Elements.section) AddressTemplate(org.jboss.hal.meta.AddressTemplate) MbuiElement(org.jboss.hal.spi.MbuiElement) Elements.p(org.jboss.gwt.elemento.core.Elements.p) HTMLElement(elemental2.dom.HTMLElement) Arrays.asList(java.util.Arrays.asList) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) Elements.h(org.jboss.gwt.elemento.core.Elements.h) BRIDGE_TEMPLATE(org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.BRIDGE_TEMPLATE) Table(org.jboss.hal.ballroom.table.Table) Ids(org.jboss.hal.resources.Ids) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete) VerticalNavigation(org.jboss.hal.ballroom.VerticalNavigation) ModelNodeHelper.failSafeGet(org.jboss.hal.dmr.ModelNodeHelper.failSafeGet) MESSAGING_SERVER(org.jboss.hal.resources.Ids.MESSAGING_SERVER) List(java.util.List) MbuiContext(org.jboss.hal.core.mbui.MbuiContext) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) PostConstruct(javax.annotation.PostConstruct) MbuiView(org.jboss.hal.spi.MbuiView) NamedNode(org.jboss.hal.dmr.NamedNode) Form(org.jboss.hal.ballroom.form.Form) Scope(org.jboss.hal.ballroom.table.Scope) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) CredentialReference(org.jboss.hal.core.elytron.CredentialReference) HTMLElement(elemental2.dom.HTMLElement) Metadata(org.jboss.hal.meta.Metadata) NamedNode(org.jboss.hal.dmr.NamedNode) Tabs(org.jboss.hal.ballroom.Tabs) PostConstruct(javax.annotation.PostConstruct)

Example 14 with Table

use of org.jboss.hal.ballroom.table.Table in project console by hal.

the class RemoteActiveMQView method init.

@PostConstruct
void init() {
    Metadata metadata = mbuiContext.metadataRegistry().lookup(POOLED_CONNECTION_FACTORY_REMOTE_TEMPLATE);
    crForm = cr.form(Ids.MESSAGING_REMOTE_ACTIVEMQ, metadata, CREDENTIAL_REFERENCE, PASSWORD, () -> pooledConnectionFactoryForm.<String>getFormItem(PASSWORD).getValue(), () -> presenter.pooledConnectionFactoryAddress(pooledConnectionFactoryTable.hasSelection() ? pooledConnectionFactoryTable.selectedRow().getName() : null), () -> presenter.reload());
    pooledConnectionFactoryTable = new ModelNodeTable.Builder<NamedNode>(Ids.build(MESSAGING_REMOTE_ACTIVEMQ, POOLED_CONNECTION_FACTORY, Ids.TABLE), metadata).button(mbuiContext.resources().constants().add(), table -> presenter.addConnectionFactory(RemoteActiveMQSubResource.POOLED_CONNECTION_FACTORY), Constraint.executable(POOLED_CONNECTION_FACTORY_TEMPLATE, ADD)).button(mbuiContext.resources().constants().remove(), table -> presenter.remove(RemoteActiveMQSubResource.POOLED_CONNECTION_FACTORY, table.selectedRow()), Scope.SELECTED, Constraint.executable(POOLED_CONNECTION_FACTORY_TEMPLATE, REMOVE)).column(NAME, (cell, type, row, meta) -> row.getName()).build();
    pooledConnectionFactoryForm = new ModelNodeForm.Builder<NamedNode>(Ids.build(Ids.MESSAGING_POOLED_CONNECTION_FACTORY, Ids.FORM), metadata).onSave((form, changedValues) -> presenter.save(RemoteActiveMQSubResource.POOLED_CONNECTION_FACTORY, form, changedValues)).prepareReset(form -> presenter.reset(RemoteActiveMQSubResource.POOLED_CONNECTION_FACTORY, form)).build();
    pooledConnectionFactoryForm.addFormValidation(new CredentialReference.AlternativeValidation<>(PASSWORD, () -> crForm.getModel(), mbuiContext.resources()));
    Tabs tabs = new Tabs(Ids.build(Ids.MESSAGING_REMOTE_ACTIVEMQ, POOLED_CONNECTION_FACTORY, Ids.TAB_CONTAINER));
    tabs.add(Ids.build(Ids.MESSAGING_REMOTE_ACTIVEMQ, POOLED_CONNECTION_FACTORY, ATTRIBUTES, Ids.TAB), mbuiContext.resources().constants().attributes(), pooledConnectionFactoryForm.element());
    tabs.add(Ids.build(Ids.MESSAGING_REMOTE_ACTIVEMQ, POOLED_CONNECTION_FACTORY, CREDENTIAL_REFERENCE, Ids.TAB), Names.CREDENTIAL_REFERENCE, crForm.element());
    HTMLElement htmlSection = section().add(h(1).textContent(Names.POOLED_CONNECTION_FACTORY)).add(p().textContent(metadata.getDescription().getDescription())).add(pooledConnectionFactoryTable).add(tabs).element();
    registerAttachable(pooledConnectionFactoryTable, pooledConnectionFactoryForm, crForm);
    String primId = Ids.build(MESSAGING_REMOTE_ACTIVEMQ, POOLED_CONNECTION_FACTORY, Ids.ITEM);
    navigation.insertPrimary(primId, "msg-remote-external-queue-item", Names.POOLED_CONNECTION_FACTORY, pfIcon("replicator"), htmlSection);
}
Also used : ModelNode(org.jboss.hal.dmr.ModelNode) Constraint(org.jboss.hal.meta.security.Constraint) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) CredentialReference(org.jboss.hal.core.elytron.CredentialReference) MbuiViewImpl(org.jboss.hal.core.mbui.MbuiViewImpl) Tabs(org.jboss.hal.ballroom.Tabs) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) Elements.section(org.jboss.gwt.elemento.core.Elements.section) AddressTemplate(org.jboss.hal.meta.AddressTemplate) MbuiElement(org.jboss.hal.spi.MbuiElement) Elements.p(org.jboss.gwt.elemento.core.Elements.p) HTMLElement(elemental2.dom.HTMLElement) Arrays.asList(java.util.Arrays.asList) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) Elements.h(org.jboss.gwt.elemento.core.Elements.h) AddressTemplates(org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates) Table(org.jboss.hal.ballroom.table.Table) Ids(org.jboss.hal.resources.Ids) CSS.pfIcon(org.jboss.hal.resources.CSS.pfIcon) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete) VerticalNavigation(org.jboss.hal.ballroom.VerticalNavigation) ModelNodeHelper.failSafeGet(org.jboss.hal.dmr.ModelNodeHelper.failSafeGet) List(java.util.List) MESSAGING_REMOTE_ACTIVEMQ(org.jboss.hal.resources.Ids.MESSAGING_REMOTE_ACTIVEMQ) MbuiContext(org.jboss.hal.core.mbui.MbuiContext) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) PostConstruct(javax.annotation.PostConstruct) MbuiView(org.jboss.hal.spi.MbuiView) NamedNode(org.jboss.hal.dmr.NamedNode) Form(org.jboss.hal.ballroom.form.Form) Scope(org.jboss.hal.ballroom.table.Scope) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) CredentialReference(org.jboss.hal.core.elytron.CredentialReference) HTMLElement(elemental2.dom.HTMLElement) Metadata(org.jboss.hal.meta.Metadata) NamedNode(org.jboss.hal.dmr.NamedNode) Tabs(org.jboss.hal.ballroom.Tabs) PostConstruct(javax.annotation.PostConstruct)

Example 15 with Table

use of org.jboss.hal.ballroom.table.Table in project console by hal.

the class LoggingView method init.

@PostConstruct
void init() {
    noRootLogger = new EmptyState.Builder("logging-root-logger-empty", mbuiContext.resources().constants().noRootLogger()).description(mbuiContext.resources().constants().noRootLoggerDescription()).icon("fa fa-sitemap").primaryAction(mbuiContext.resources().constants().add(), this::addRootLogger).build();
    noRootLogger.element().classList.add(marginTopLarge);
    // hack which relies on the element hierarchy given in the template. will break if you change that hierarchy.
    rootLoggerForm.element().parentNode.appendChild(noRootLogger.element());
    rootLoggerVisibility(true);
    // --------------------------- json formatter
    LabelBuilder labelBuilder = new LabelBuilder();
    Metadata jsonMetadata = mbuiContext.metadataRegistry().lookup(JSON_FORMATTER_TEMPLATE);
    Metadata jsonKeyOverridesMetadata = jsonMetadata.forComplexAttribute(KEY_OVERRIDES);
    String jsonLabel = labelBuilder.label(JSON_FORMATTER_TEMPLATE.lastName());
    jsonFormatterTable = new ModelNodeTable.Builder<NamedNode>(Ids.build(LOGGING, JSON, FORMATTER, TABLE), jsonMetadata).button(mbuiContext.tableButtonFactory().add(Ids.build(LOGGING, JSON, FORMATTER, Ids.ADD), jsonLabel, JSON_FORMATTER_TEMPLATE, (name, address) -> presenter.reload())).button(mbuiContext.tableButtonFactory().remove(jsonLabel, JSON_FORMATTER_TEMPLATE, table -> table.selectedRow().getName(), () -> presenter.reload())).column(NAME, (cell, type, row, meta) -> row.getName()).build();
    jsonFormatterForm = new ModelNodeForm.Builder<NamedNode>(Ids.build(LOGGING, JSON, FORMATTER, FORM), jsonMetadata).onSave((form, changedValues) -> mbuiContext.crud().save(jsonLabel, form.getModel().getName(), JSON_FORMATTER_TEMPLATE, changedValues, () -> presenter.reload())).prepareReset(form -> mbuiContext.crud().reset(jsonLabel, jsonFormatterTable.selectedRow().getName(), JSON_FORMATTER_TEMPLATE, form, jsonMetadata, () -> presenter.reload())).build();
    jsonKeyOverridesForm = new ModelNodeForm.Builder<>(Ids.build(LOGGING, FORMATTER, JSON, KEY_OVERRIDES, FORM), jsonKeyOverridesMetadata).singleton(() -> {
        StatementContext jsonStatementContext = new SelectionAwareStatementContext(presenter.getStatementContext(), () -> jsonFormatterTable.selectedRow().getName());
        return new Operation.Builder(JSON_FORMATTER_TEMPLATE.resolve(jsonStatementContext), READ_ATTRIBUTE_OPERATION).param(NAME, KEY_OVERRIDES).build();
    }, () -> presenter.addComplexObject(jsonLabel, jsonFormatterTable.selectedRow().getName(), KEY_OVERRIDES, JSON_FORMATTER_TEMPLATE)).onSave((form, changedValues) -> presenter.saveComplexObject(jsonLabel, jsonFormatterTable.selectedRow().getName(), KEY_OVERRIDES, JSON_FORMATTER_TEMPLATE, changedValues)).prepareReset(form -> presenter.resetComplexObject(jsonLabel, jsonFormatterTable.selectedRow().getName(), KEY_OVERRIDES, JSON_FORMATTER_TEMPLATE, jsonKeyOverridesMetadata, form)).prepareRemove(form -> presenter.removeComplexObject(jsonLabel, jsonFormatterTable.selectedRow().getName(), KEY_OVERRIDES, JSON_FORMATTER_TEMPLATE)).build();
    Tabs jsonTabs = new Tabs(Ids.build(LOGGING, FORMATTER, JSON, TAB_CONTAINER));
    jsonTabs.add(Ids.build(LOGGING, FORMATTER, JSON, ATTRIBUTES, TAB), mbuiContext.resources().constants().attributes(), jsonFormatterForm.element());
    jsonTabs.add(Ids.build(LOGGING, FORMATTER, JSON, KEY_OVERRIDES, TAB), Names.KEY_OVERRIDES, jsonKeyOverridesForm.element());
    HTMLElement jsonSection = section().add(h(1).textContent(Names.JSON_FORMATTER)).add(p().textContent(jsonMetadata.getDescription().getDescription())).add(jsonFormatterTable).add(jsonTabs).element();
    registerAttachable(jsonFormatterTable, jsonFormatterForm, jsonKeyOverridesForm);
    navigation.insertSecondary(LOGGING_FORMATTER_ITEM, Ids.build(LOGGING, FORMATTER, JSON, Ids.ITEM), null, Names.JSON_FORMATTER, jsonSection);
    // --------------------------- xml formatter
    Metadata xmlMetadata = mbuiContext.metadataRegistry().lookup(XML_FORMATTER_TEMPLATE);
    Metadata xmlKeyOverridesMetadata = xmlMetadata.forComplexAttribute(KEY_OVERRIDES);
    String xmlLabel = labelBuilder.label(XML_FORMATTER_TEMPLATE.lastName());
    xmlFormatterTable = new ModelNodeTable.Builder<NamedNode>(Ids.build(LOGGING, XML, FORMATTER, TABLE), xmlMetadata).button(mbuiContext.tableButtonFactory().add(Ids.build(LOGGING, XML, FORMATTER, Ids.ADD), xmlLabel, XML_FORMATTER_TEMPLATE, (name, address) -> presenter.reload())).button(mbuiContext.tableButtonFactory().remove(xmlLabel, XML_FORMATTER_TEMPLATE, table -> table.selectedRow().getName(), () -> presenter.reload())).column(NAME, (cell, type, row, meta) -> row.getName()).build();
    xmlFormatterForm = new ModelNodeForm.Builder<NamedNode>(Ids.build(LOGGING, XML, FORMATTER, FORM), xmlMetadata).onSave((form, changedValues) -> mbuiContext.crud().save(xmlLabel, form.getModel().getName(), XML_FORMATTER_TEMPLATE, changedValues, () -> presenter.reload())).prepareReset(form -> mbuiContext.crud().reset(xmlLabel, xmlFormatterTable.selectedRow().getName(), XML_FORMATTER_TEMPLATE, form, xmlMetadata, () -> presenter.reload())).build();
    xmlKeyOverridesForm = new ModelNodeForm.Builder<>(Ids.build(LOGGING, FORMATTER, XML, KEY_OVERRIDES, FORM), xmlKeyOverridesMetadata).singleton(() -> {
        StatementContext xmlStatementContext = new SelectionAwareStatementContext(presenter.getStatementContext(), () -> xmlFormatterTable.selectedRow().getName());
        return new Operation.Builder(XML_FORMATTER_TEMPLATE.resolve(xmlStatementContext), READ_ATTRIBUTE_OPERATION).param(NAME, KEY_OVERRIDES).build();
    }, () -> presenter.addComplexObject(xmlLabel, xmlFormatterTable.selectedRow().getName(), KEY_OVERRIDES, XML_FORMATTER_TEMPLATE)).onSave((form, changedValues) -> presenter.saveComplexObject(xmlLabel, xmlFormatterTable.selectedRow().getName(), KEY_OVERRIDES, XML_FORMATTER_TEMPLATE, changedValues)).prepareReset(form -> presenter.resetComplexObject(xmlLabel, xmlFormatterTable.selectedRow().getName(), KEY_OVERRIDES, XML_FORMATTER_TEMPLATE, xmlKeyOverridesMetadata, form)).prepareRemove(form -> presenter.removeComplexObject(xmlLabel, xmlFormatterTable.selectedRow().getName(), KEY_OVERRIDES, XML_FORMATTER_TEMPLATE)).build();
    Tabs xmlTabs = new Tabs(Ids.build(LOGGING, FORMATTER, XML, TAB_CONTAINER));
    xmlTabs.add(Ids.build(LOGGING, FORMATTER, XML, ATTRIBUTES, TAB), mbuiContext.resources().constants().attributes(), xmlFormatterForm.element());
    xmlTabs.add(Ids.build(LOGGING, FORMATTER, XML, KEY_OVERRIDES, TAB), Names.KEY_OVERRIDES, xmlKeyOverridesForm.element());
    HTMLElement xmlSection = section().add(h(1).textContent(Names.XML_FORMATTER)).add(p().textContent(xmlMetadata.getDescription().getDescription())).add(xmlFormatterTable).add(xmlTabs).element();
    registerAttachable(xmlFormatterTable, xmlFormatterForm, xmlKeyOverridesForm);
    navigation.insertSecondary(LOGGING_FORMATTER_ITEM, Ids.build(LOGGING, FORMATTER, XML, Ids.ITEM), null, Names.XML_FORMATTER, xmlSection);
}
Also used : ModelNode(org.jboss.hal.dmr.ModelNode) StatementContext(org.jboss.hal.meta.StatementContext) MessageEvent(org.jboss.hal.spi.MessageEvent) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) TAB_CONTAINER(org.jboss.hal.resources.Ids.TAB_CONTAINER) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) MbuiViewImpl(org.jboss.hal.core.mbui.MbuiViewImpl) Elements.setVisible(org.jboss.gwt.elemento.core.Elements.setVisible) Tabs(org.jboss.hal.ballroom.Tabs) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) TAB(org.jboss.hal.resources.Ids.TAB) LOGGING_FORMATTER_ITEM(org.jboss.hal.resources.Ids.LOGGING_FORMATTER_ITEM) Elements.section(org.jboss.gwt.elemento.core.Elements.section) MbuiElement(org.jboss.hal.spi.MbuiElement) Elements.p(org.jboss.gwt.elemento.core.Elements.p) HTMLElement(elemental2.dom.HTMLElement) Arrays.asList(java.util.Arrays.asList) Message(org.jboss.hal.spi.Message) EmptyState(org.jboss.hal.ballroom.EmptyState) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) Elements.h(org.jboss.gwt.elemento.core.Elements.h) DomGlobal.document(elemental2.dom.DomGlobal.document) Table(org.jboss.hal.ballroom.table.Table) Operation(org.jboss.hal.dmr.Operation) SuggestHandler(org.jboss.hal.ballroom.form.SuggestHandler) Ids(org.jboss.hal.resources.Ids) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete) FORM(org.jboss.hal.resources.Ids.FORM) CSS.marginTopLarge(org.jboss.hal.resources.CSS.marginTopLarge) VerticalNavigation(org.jboss.hal.ballroom.VerticalNavigation) ModelNodeHelper.failSafeGet(org.jboss.hal.dmr.ModelNodeHelper.failSafeGet) List(java.util.List) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) AddressTemplates(org.jboss.hal.client.configuration.subsystem.logging.AddressTemplates) SelectionAwareStatementContext(org.jboss.hal.meta.SelectionAwareStatementContext) MbuiContext(org.jboss.hal.core.mbui.MbuiContext) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) PostConstruct(javax.annotation.PostConstruct) MbuiView(org.jboss.hal.spi.MbuiView) NamedNode(org.jboss.hal.dmr.NamedNode) Form(org.jboss.hal.ballroom.form.Form) EmptyState(org.jboss.hal.ballroom.EmptyState) HTMLElement(elemental2.dom.HTMLElement) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) Metadata(org.jboss.hal.meta.Metadata) NamedNode(org.jboss.hal.dmr.NamedNode) Operation(org.jboss.hal.dmr.Operation) SelectionAwareStatementContext(org.jboss.hal.meta.SelectionAwareStatementContext) StatementContext(org.jboss.hal.meta.StatementContext) SelectionAwareStatementContext(org.jboss.hal.meta.SelectionAwareStatementContext) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) Tabs(org.jboss.hal.ballroom.Tabs) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) PostConstruct(javax.annotation.PostConstruct)

Aggregations

VerticalNavigation (org.jboss.hal.ballroom.VerticalNavigation)15 Form (org.jboss.hal.ballroom.form.Form)15 Table (org.jboss.hal.ballroom.table.Table)15 List (java.util.List)14 NamedNode (org.jboss.hal.dmr.NamedNode)13 Metadata (org.jboss.hal.meta.Metadata)12 Ids (org.jboss.hal.resources.Ids)12 Names (org.jboss.hal.resources.Names)12 HTMLElement (elemental2.dom.HTMLElement)11 PostConstruct (javax.annotation.PostConstruct)11 MbuiContext (org.jboss.hal.core.mbui.MbuiContext)11 MbuiViewImpl (org.jboss.hal.core.mbui.MbuiViewImpl)11 ModelNodeForm (org.jboss.hal.core.mbui.form.ModelNodeForm)11 ModelNodeTable (org.jboss.hal.core.mbui.table.ModelNodeTable)11 ModelDescriptionConstants (org.jboss.hal.dmr.ModelDescriptionConstants)11 MbuiElement (org.jboss.hal.spi.MbuiElement)11 MbuiView (org.jboss.hal.spi.MbuiView)11 Elements.h (org.jboss.gwt.elemento.core.Elements.h)10 Elements.p (org.jboss.gwt.elemento.core.Elements.p)10 Elements.section (org.jboss.gwt.elemento.core.Elements.section)10