Search in sources :

Example 1 with BRIDGE_TEMPLATE

use of org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.BRIDGE_TEMPLATE 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)

Aggregations

HTMLElement (elemental2.dom.HTMLElement)1 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1 PostConstruct (javax.annotation.PostConstruct)1 Elements.h (org.jboss.gwt.elemento.core.Elements.h)1 Elements.p (org.jboss.gwt.elemento.core.Elements.p)1 Elements.section (org.jboss.gwt.elemento.core.Elements.section)1 Tabs (org.jboss.hal.ballroom.Tabs)1 VerticalNavigation (org.jboss.hal.ballroom.VerticalNavigation)1 ReadChildrenAutoComplete (org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete)1 Form (org.jboss.hal.ballroom.form.Form)1 Scope (org.jboss.hal.ballroom.table.Scope)1 Table (org.jboss.hal.ballroom.table.Table)1 BRIDGE_TEMPLATE (org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.BRIDGE_TEMPLATE)1 SELECTED_SERVER_TEMPLATE (org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.SELECTED_SERVER_TEMPLATE)1 CredentialReference (org.jboss.hal.core.elytron.CredentialReference)1 MbuiContext (org.jboss.hal.core.mbui.MbuiContext)1 MbuiViewImpl (org.jboss.hal.core.mbui.MbuiViewImpl)1 ModelNodeForm (org.jboss.hal.core.mbui.form.ModelNodeForm)1 ModelNodeTable (org.jboss.hal.core.mbui.table.ModelNodeTable)1