Search in sources :

Example 1 with INBOUND

use of org.jboss.hal.client.configuration.SocketBinding.INBOUND in project console by hal.

the class SocketBindingGroupView method init.

@PostConstruct
@SuppressWarnings("ConstantConditions")
void init() {
    AddressTemplate inboundTemplate = ROOT_TEMPLATE.append(INBOUND.templateSuffix());
    Metadata inboundMetadata = mbuiContext.metadataRegistry().lookup(inboundTemplate);
    inboundTable = new ModelNodeTable.Builder<NamedNode>(Ids.build(INBOUND.baseId, Ids.TABLE), inboundMetadata).button(mbuiContext.tableButtonFactory().add(inboundTemplate, table -> presenter.addSocketBinding(INBOUND))).button(mbuiContext.tableButtonFactory().remove(inboundTemplate, table -> presenter.removeSocketBinding(INBOUND, table.selectedRow().getName()))).column(NAME, (cell, type, row, meta) -> row.getName()).column(PORT, (cell, type, row, meta) -> row.get(PORT).asString()).column(new InlineAction<>(Names.CLIENT_MAPPINGS, row -> presenter.showClientMappings(row))).build();
    inboundForm = new ModelNodeForm.Builder<NamedNode>(Ids.build(INBOUND.baseId, Ids.FORM), inboundMetadata).include(INTERFACE, PORT, FIXED_PORT, MULTICAST_ADDRESS, MULTICAST_PORT).unsorted().onSave((form, changedValues) -> presenter.saveSocketBinding(INBOUND, form, changedValues)).prepareReset(form -> presenter.resetSocketBinding(INBOUND, form)).build();
    HTMLElement inboundSection = section().add(h(1).textContent(Names.INBOUND)).add(p().textContent(inboundMetadata.getDescription().getDescription())).add(inboundTable).add(inboundForm).element();
    Metadata clientMappingsMetadata = inboundMetadata.forComplexAttribute(CLIENT_MAPPINGS);
    clientMappingTable = new ModelNodeTable.Builder<NamedNode>(Ids.SOCKET_BINDING_GROUP_INBOUND_CLIENT_MAPPING_TABLE, clientMappingsMetadata).button(mbuiContext.tableButtonFactory().add(inboundTemplate, table -> presenter.addClientMapping(clientMappingsMetadata))).button(mbuiContext.tableButtonFactory().remove(inboundTemplate, table -> presenter.removeClientMapping(table.selectedRow().get(INDEX).asInt(-1)))).column(SOURCE_NETWORK).column(Names.DESTINATION, (cell, type, row, meta) -> {
        String address = row.get(DESTINATION_ADDRESS).asString();
        if (row.hasDefined(DESTINATION_PORT)) {
            address += ":" + row.get(DESTINATION_PORT).asInt();
        }
        return address;
    }).build();
    clientMappingForm = new ModelNodeForm.Builder<NamedNode>(Ids.SOCKET_BINDING_GROUP_INBOUND_CLIENT_MAPPING_FORM, clientMappingsMetadata).include(SOURCE_NETWORK, DESTINATION_ADDRESS, DESTINATION_PORT).unsorted().onSave((form, changedValues) -> presenter.saveClientMapping(clientMappingsMetadata, form.getModel(), changedValues)).build();
    HTMLElement clientMappingSection = section().add(h(1).textContent(Names.CLIENT_MAPPINGS)).add(p().textContent(clientMappingsMetadata.getDescription().getDescription())).add(clientMappingTable).add(clientMappingForm).element();
    String id = Ids.build(INBOUND.baseId, Ids.PAGES);
    String parentId = Ids.build(INBOUND.baseId, Ids.PAGE);
    inboundPages = new Pages(id, parentId, inboundSection);
    inboundPages.addPage(parentId, Ids.SOCKET_BINDING_GROUP_INBOUND_CLIENT_MAPPING_PAGE, () -> Names.INBOUND + ": " + presenter.inbound, () -> Names.CLIENT_MAPPINGS, clientMappingSection);
    navigation.insertPrimary(Ids.build(INBOUND.baseId, Ids.ITEM), // NON-NLS
    "socket-binding-group-outbound-local-item", Names.INBOUND, fontAwesome("arrow-circle-o-left"), inboundPages);
    registerAttachable(inboundTable, inboundForm, clientMappingTable, clientMappingForm);
}
Also used : AddressTemplate(org.jboss.hal.meta.AddressTemplate) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) MbuiViewImpl(org.jboss.hal.core.mbui.MbuiViewImpl) INBOUND(org.jboss.hal.client.configuration.SocketBinding.INBOUND) 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) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) Elements.h(org.jboss.gwt.elemento.core.Elements.h) ModelNodeHelper.asNamedNodes(org.jboss.hal.dmr.ModelNodeHelper.asNamedNodes) Pages(org.jboss.hal.ballroom.Pages) Table(org.jboss.hal.ballroom.table.Table) Ids(org.jboss.hal.resources.Ids) VerticalNavigation(org.jboss.hal.ballroom.VerticalNavigation) ModelNodeHelper.failSafePropertyList(org.jboss.hal.dmr.ModelNodeHelper.failSafePropertyList) List(java.util.List) MbuiContext(org.jboss.hal.core.mbui.MbuiContext) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) ROOT_TEMPLATE(org.jboss.hal.client.configuration.SocketBindingGroupPresenter.ROOT_TEMPLATE) InlineAction(org.jboss.hal.ballroom.table.InlineAction) PostConstruct(javax.annotation.PostConstruct) MbuiView(org.jboss.hal.spi.MbuiView) NamedNode(org.jboss.hal.dmr.NamedNode) CSS.fontAwesome(org.jboss.hal.resources.CSS.fontAwesome) Form(org.jboss.hal.ballroom.form.Form) HTMLElement(elemental2.dom.HTMLElement) Metadata(org.jboss.hal.meta.Metadata) NamedNode(org.jboss.hal.dmr.NamedNode) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) Pages(org.jboss.hal.ballroom.Pages) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) PostConstruct(javax.annotation.PostConstruct)

Aggregations

HTMLElement (elemental2.dom.HTMLElement)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 Pages (org.jboss.hal.ballroom.Pages)1 VerticalNavigation (org.jboss.hal.ballroom.VerticalNavigation)1 Form (org.jboss.hal.ballroom.form.Form)1 InlineAction (org.jboss.hal.ballroom.table.InlineAction)1 Table (org.jboss.hal.ballroom.table.Table)1 INBOUND (org.jboss.hal.client.configuration.SocketBinding.INBOUND)1 ROOT_TEMPLATE (org.jboss.hal.client.configuration.SocketBindingGroupPresenter.ROOT_TEMPLATE)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 ModelDescriptionConstants (org.jboss.hal.dmr.ModelDescriptionConstants)1 ModelNodeHelper.asNamedNodes (org.jboss.hal.dmr.ModelNodeHelper.asNamedNodes)1 ModelNodeHelper.failSafePropertyList (org.jboss.hal.dmr.ModelNodeHelper.failSafePropertyList)1