Search in sources :

Example 26 with BootstrapFormGroup

use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project phoss-smp by phax.

the class PageSecureBusinessCard method showInputForm.

@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ISMPBusinessCard aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
    final boolean bEdit = eFormAction.isEdit();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final IRequestWebScopeWithoutResponse aRequestScope = aWPEC.getRequestScope();
    final ISMPBusinessCardManager aBusinessCardMgr = SMPMetaManager.getBusinessCardMgr();
    aForm.addChild(getUIHandler().createActionHeader(bEdit ? "Edit Business Card" : "Create new Business Card"));
    if (bEdit) {
        aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Service Group").setCtrl(aSelectedObject.getID()).setErrorList(aFormErrors.getListOfField(FIELD_SERVICE_GROUP_ID)));
    } else {
        // Show only service groups that don't have a BC already
        aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Service Group").setCtrl(new HCServiceGroupSelect(new RequestField(FIELD_SERVICE_GROUP_ID, aSelectedObject != null ? aSelectedObject.getID() : null), aDisplayLocale, x -> aBusinessCardMgr.getSMPBusinessCardOfServiceGroup(x) == null)).setErrorList(aFormErrors.getListOfField(FIELD_SERVICE_GROUP_ID)));
    }
    final HCDiv aEntityContainer = aForm.addAndReturnChild(new HCDiv().setID("entitycontainer"));
    final IRequestParamMap aEntities = aWPEC.getRequestParamMap().getMap(PREFIX_ENTITY);
    if (bFormSubmitted) {
        // Re-show of form
        if (aEntities != null)
            for (final String sEntityRowID : aEntities.keySet()) aEntityContainer.addChild(_createEntityInputForm(aWPEC, null, sEntityRowID, aFormErrors, bFormSubmitted));
    } else {
        if (aSelectedObject != null) {
            // add all existing stored entities
            for (final SMPBusinessCardEntity aEntity : aSelectedObject.getAllEntities()) aEntityContainer.addChild(_createEntityInputForm(aWPEC, aEntity, (String) null, aFormErrors, bFormSubmitted));
        }
    }
    {
        final JSAnonymousFunction aJSAppend = new JSAnonymousFunction();
        final JSVar aJSAppendData = aJSAppend.param("data");
        aJSAppend.body().add(JQuery.idRef(aEntityContainer).append(aJSAppendData.ref(PhotonUnifiedResponse.HtmlHelper.PROPERTY_HTML)));
        final JSPackage aOnAdd = new JSPackage();
        aOnAdd.add(new JQueryAjaxBuilder().url(AJAX_CREATE_ENTITY.getInvocationURL(aRequestScope)).data(new JSAssocArray()).success(JSJQueryHelper.jqueryAjaxSuccessHandler(aJSAppend, null)).build());
        aForm.addChild(new BootstrapButton().addChild("Add Entity").setIcon(EDefaultIcon.PLUS).setOnClick(aOnAdd));
    }
}
Also used : Locale(java.util.Locale) GlobalIDFactory(com.helger.commons.id.factory.GlobalIDFactory) ILayoutExecutionContext(com.helger.photon.core.execcontext.ILayoutExecutionContext) PDClientProvider(com.helger.phoss.smp.app.PDClientProvider) EWithDeprecated(com.helger.photon.uicore.html.select.HCCountrySelect.EWithDeprecated) ISMPSettings(com.helger.phoss.smp.settings.ISMPSettings) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) FormErrorList(com.helger.photon.core.form.FormErrorList) BootstrapForm(com.helger.photon.bootstrap4.form.BootstrapForm) IIdentifierFactory(com.helger.peppolid.factory.IIdentifierFactory) HCServiceGroupSelect(com.helger.phoss.smp.ui.secure.hc.HCServiceGroupSelect) Nonempty(com.helger.commons.annotation.Nonempty) SMPBusinessCardIdentifier(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardIdentifier) HCA(com.helger.html.hc.html.textlevel.HCA) HCTextArea(com.helger.html.hc.html.forms.HCTextArea) CPageParam(com.helger.photon.uicore.css.CPageParam) PDTToString(com.helger.commons.datetime.PDTToString) BootstrapViewForm(com.helger.photon.bootstrap4.form.BootstrapViewForm) IHCCell(com.helger.html.hc.html.tabular.IHCCell) HCDiv(com.helger.html.hc.html.grouping.HCDiv) HCTextNode(com.helger.html.hc.impl.HCTextNode) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) ICommonsList(com.helger.commons.collection.impl.ICommonsList) HCExtHelper(com.helger.html.hc.ext.HCExtHelper) RegExHelper(com.helger.commons.regex.RegExHelper) IValidityIndicator(com.helger.commons.state.IValidityIndicator) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) RequestParamMap(com.helger.servlet.request.RequestParamMap) ICommonsMap(com.helger.commons.collection.impl.ICommonsMap) BootstrapCardBody(com.helger.photon.bootstrap4.card.BootstrapCardBody) JSJQueryHelper(com.helger.photon.uicore.js.JSJQueryHelper) ISMPBusinessCardManager(com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager) DataTables(com.helger.photon.uictrls.datatables.DataTables) IRequestParamMap(com.helger.servlet.request.IRequestParamMap) LinkHelper(com.helger.photon.app.url.LinkHelper) JSAssocArray(com.helger.html.jscode.JSAssocArray) BootstrapDateTimePicker(com.helger.photon.bootstrap4.uictrls.datetimepicker.BootstrapDateTimePicker) PDTFromString(com.helger.commons.datetime.PDTFromString) HCEdit(com.helger.html.hc.html.forms.HCEdit) IHCNode(com.helger.html.hc.IHCNode) JQuery(com.helger.html.jquery.JQuery) SMPBusinessCardEntity(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardEntity) Nullable(javax.annotation.Nullable) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) StringHelper(com.helger.commons.string.StringHelper) WorkInProgress(com.helger.commons.annotation.WorkInProgress) SMPMetaManager(com.helger.phoss.smp.domain.SMPMetaManager) BootstrapFormHelper(com.helger.photon.bootstrap4.form.BootstrapFormHelper) CAjax(com.helger.phoss.smp.ui.ajax.CAjax) HCA_MailTo(com.helger.html.hc.ext.HCA_MailTo) HCCol(com.helger.html.hc.html.tabular.HCCol) RequestField(com.helger.photon.core.form.RequestField) AbstractBootstrapWebPageActionHandler(com.helger.photon.bootstrap4.pages.handler.AbstractBootstrapWebPageActionHandler) ESortOrder(com.helger.commons.compare.ESortOrder) JSAnonymousFunction(com.helger.html.jscode.JSAnonymousFunction) LayoutExecutionContext(com.helger.photon.core.execcontext.LayoutExecutionContext) JSVar(com.helger.html.jscode.JSVar) WebPageExecutionContext(com.helger.photon.uicore.page.WebPageExecutionContext) EDefaultIcon(com.helger.photon.uicore.icon.EDefaultIcon) BootstrapSuccessBox(com.helger.photon.bootstrap4.alert.BootstrapSuccessBox) AbstractBootstrapWebPageActionHandlerDelete(com.helger.photon.bootstrap4.pages.handler.AbstractBootstrapWebPageActionHandlerDelete) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) Locale(java.util.Locale) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) EmailAddressValidator(com.helger.smtp.util.EmailAddressValidator) SMPCommonUI(com.helger.phoss.smp.ui.SMPCommonUI) BootstrapErrorBox(com.helger.photon.bootstrap4.alert.BootstrapErrorBox) HCCountrySelect(com.helger.photon.uicore.html.select.HCCountrySelect) EWebPageFormAction(com.helger.photon.uicore.page.EWebPageFormAction) BootstrapCard(com.helger.photon.bootstrap4.card.BootstrapCard) IAjaxFunctionDeclaration(com.helger.photon.ajax.decl.IAjaxFunctionDeclaration) PDClient(com.helger.pd.client.PDClient) CountryCache(com.helger.commons.locale.country.CountryCache) EFamFamIcon(com.helger.photon.uictrls.famfam.EFamFamIcon) LocalDate(java.time.LocalDate) SMPWebAppConfiguration(com.helger.phoss.smp.app.SMPWebAppConfiguration) ISMPServiceGroupManager(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager) ESuccess(com.helger.commons.state.ESuccess) ISMPBusinessCard(com.helger.phoss.smp.domain.businesscard.ISMPBusinessCard) HCRow(com.helger.html.hc.html.tabular.HCRow) EValidity(com.helger.commons.state.EValidity) PhotonUnifiedResponse(com.helger.photon.app.PhotonUnifiedResponse) AbstractSMPWebPageForm(com.helger.phoss.smp.ui.AbstractSMPWebPageForm) BootstrapTable(com.helger.photon.bootstrap4.table.BootstrapTable) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) CompareHelper(com.helger.commons.compare.CompareHelper) URLValidator(com.helger.commons.url.URLValidator) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Nonnull(javax.annotation.Nonnull) ISimpleURL(com.helger.commons.url.ISimpleURL) HCNodeList(com.helger.html.hc.impl.HCNodeList) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) CommonsArrayList(com.helger.commons.collection.impl.CommonsArrayList) CBootstrapCSS(com.helger.photon.bootstrap4.CBootstrapCSS) HCTable(com.helger.html.hc.html.tabular.HCTable) JQueryAjaxBuilder(com.helger.html.jquery.JQueryAjaxBuilder) SMPBusinessCardName(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardName) EBootstrapButtonSize(com.helger.photon.bootstrap4.button.EBootstrapButtonSize) EShowList(com.helger.photon.uicore.page.EShowList) EFamFamFlagIcon(com.helger.photon.uictrls.famfam.EFamFamFlagIcon) SMPBusinessCardContact(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardContact) JSPackage(com.helger.html.jscode.JSPackage) HCDiv(com.helger.html.hc.html.grouping.HCDiv) JSAnonymousFunction(com.helger.html.jscode.JSAnonymousFunction) SMPBusinessCardEntity(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardEntity) JSVar(com.helger.html.jscode.JSVar) PDTToString(com.helger.commons.datetime.PDTToString) PDTFromString(com.helger.commons.datetime.PDTFromString) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) ISMPBusinessCardManager(com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager) HCServiceGroupSelect(com.helger.phoss.smp.ui.secure.hc.HCServiceGroupSelect) JQueryAjaxBuilder(com.helger.html.jquery.JQueryAjaxBuilder) JSPackage(com.helger.html.jscode.JSPackage) JSAssocArray(com.helger.html.jscode.JSAssocArray) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) IRequestParamMap(com.helger.servlet.request.IRequestParamMap) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) RequestField(com.helger.photon.core.form.RequestField)

Example 27 with BootstrapFormGroup

use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project phoss-smp by phax.

the class PageSecureRedirect method showSelectedObject.

@Override
protected void showSelectedObject(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPRedirect aSelectedObject) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    aNodeList.addChild(getUIHandler().createActionHeader("Show details of Redirect"));
    final BootstrapViewForm aForm = new BootstrapViewForm();
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Service Group").setCtrl(new HCA(createViewURL(aWPEC, CMenuSecure.MENU_SERVICE_GROUPS, aSelectedObject.getServiceGroup())).addChild(aSelectedObject.getServiceGroupID())));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Document type ID").setCtrl(NiceNameUI.getDocumentTypeID(aSelectedObject.getDocumentTypeIdentifier(), true)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Target URL").setCtrl(HCA.createLinkedWebsite(aSelectedObject.getTargetHref(), HC_Target.BLANK)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Subject unique identifier").setCtrl(aSelectedObject.getSubjectUniqueIdentifier()));
    if (aSelectedObject.extensions().isNotEmpty())
        aForm.addFormGroup(new BootstrapFormGroup().setLabel("Extension").setCtrl(SMPCommonUI.getExtensionDisplay(aSelectedObject)));
    aNodeList.addChild(aForm);
}
Also used : HCNodeList(com.helger.html.hc.impl.HCNodeList) HCA(com.helger.html.hc.html.textlevel.HCA) BootstrapViewForm(com.helger.photon.bootstrap4.form.BootstrapViewForm) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup)

Example 28 with BootstrapFormGroup

use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project phoss-smp by phax.

the class PageSecureSMLConfiguration method showInputForm.

@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ISMLInfo aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
    final boolean bEdit = eFormAction.isEdit();
    aForm.addChild(getUIHandler().createActionHeader(bEdit ? "Edit SML configuration '" + aSelectedObject.getDisplayName() + "'" : "Create new SML configuration"));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Name").setCtrl(new HCEdit(new RequestField(FIELD_DISPLAY_NAME, aSelectedObject != null ? aSelectedObject.getDisplayName() : null))).setHelpText("The name of the SML configuration. This is for informational purposes only and has no effect on the functionality.").setErrorList(aFormErrors.getListOfField(FIELD_DISPLAY_NAME)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("DNS Zone").setCtrl(new HCEdit(new RequestField(FIELD_DNS_ZONE, aSelectedObject != null ? aSelectedObject.getDNSZone() : null))).setHelpText(new HCTextNode("The name of the DNS Zone that this SML is working upon (e.g. "), code("acc.edelivery.tech.ec.europa.eu"), new HCTextNode("). The value will automatically converted to all-lowercase!")).setErrorList(aFormErrors.getListOfField(FIELD_DNS_ZONE)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Management Service URL").setCtrl(new HCEdit(new RequestField(FIELD_MANAGEMENT_ADDRESS_URL, aSelectedObject != null ? aSelectedObject.getManagementServiceURL() : null))).setHelpText("The service URL where the SML management application is running on including the host name. It may not contain the '" + CSMLDefault.MANAGEMENT_SERVICE_METADATA + "' or '" + CSMLDefault.MANAGEMENT_SERVICE_PARTICIPANTIDENTIFIER + "' path elements!").setErrorList(aFormErrors.getListOfField(FIELD_MANAGEMENT_ADDRESS_URL)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Client Certificate required?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_CLIENT_CERTIFICATE_REQUIRED, aSelectedObject != null ? aSelectedObject.isClientCertificateRequired() : DEFAULT_CLIENT_CERTIFICATE_REQUIRED))).setHelpText("Check this if this SML requires a client certificate for access. Both Peppol production SML and SMK require a client certificate. Only a locally running SML software may not require a client certificate.").setErrorList(aFormErrors.getListOfField(FIELD_CLIENT_CERTIFICATE_REQUIRED)));
}
Also used : RequestFieldBoolean(com.helger.photon.core.form.RequestFieldBoolean) HCEdit(com.helger.html.hc.html.forms.HCEdit) HCCheckBox(com.helger.html.hc.html.forms.HCCheckBox) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) HCTextNode(com.helger.html.hc.impl.HCTextNode) RequestField(com.helger.photon.core.form.RequestField)

Example 29 with BootstrapFormGroup

use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project phoss-smp by phax.

the class PageSecureSMLConfiguration method showSelectedObject.

@Override
protected void showSelectedObject(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMLInfo aSelectedObject) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    aNodeList.addChild(getUIHandler().createActionHeader("Show details of SML configuration '" + aSelectedObject.getDisplayName() + "'"));
    final BootstrapViewForm aForm = new BootstrapViewForm();
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Name").setCtrl(aSelectedObject.getDisplayName()));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("DNS Zone").setCtrl(aSelectedObject.getDNSZone()));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Publisher DNS Zone").setCtrl(aSelectedObject.getPublisherDNSZone()));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Management Service URL").setCtrl(HCA.createLinkedWebsite(aSelectedObject.getManagementServiceURL())));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Manage Service Metadata Endpoint").setCtrl(HCA.createLinkedWebsite(aSelectedObject.getManageServiceMetaDataEndpointAddress().toExternalForm())));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Manage Participant Identifier Endpoint").setCtrl(HCA.createLinkedWebsite(aSelectedObject.getManageParticipantIdentifierEndpointAddress().toExternalForm())));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Client certificate required?").setCtrl(EPhotonCoreText.getYesOrNo(aSelectedObject.isClientCertificateRequired(), aDisplayLocale)));
    aNodeList.addChild(aForm);
}
Also used : Locale(java.util.Locale) HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapViewForm(com.helger.photon.bootstrap4.form.BootstrapViewForm) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup)

Example 30 with BootstrapFormGroup

use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project phoss-smp by phax.

the class PageSecureSMLRegistration method fillContent.

@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
    if (!_canShowPage(aWPEC))
        return;
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final FormErrorList aFormErrors = new FormErrorList();
    final boolean bShowInput = true;
    final ISMLInfo aDefaultSML = SMPMetaManager.getSettings().getSMLInfo();
    final String sSMPID = SMPServerConfiguration.getSMLSMPID();
    if (aDefaultSML != null) {
        // Check if this SMP is already registered
        final String sPublisherDNSName = sSMPID + "." + aDefaultSML.getPublisherDNSZone();
        try {
            final InetAddress aIA = InetAddress.getByName(sPublisherDNSName);
            aNodeList.addChild(success(div("An SMP is already registered at the configured SML using the DNS name '" + sPublisherDNSName + "'. The determined IP address is " + aIA.getHostAddress())).addChild(div("Note: this can be a different machine than this one, if another SMP uses the same ID as this one (" + sSMPID + ")")));
        } catch (final UnknownHostException ex) {
        // continue
        }
    }
    if (aWPEC.hasAction(CPageParam.ACTION_PERFORM)) {
        if (aWPEC.hasSubAction(SUBACTION_SMP_REGISTER))
            _registerSMPtoSML(aWPEC, aFormErrors);
        else if (aWPEC.hasSubAction(SUBACTION_SMP_UPDATE))
            _updateSMPatSML(aWPEC, aFormErrors);
        else if (aWPEC.hasSubAction(SUBACTION_SMP_DELETE))
            _deleteSMPfromSML(aWPEC, aFormErrors);
    }
    if (bShowInput) {
        // Get default from configuration
        final String sPhysicalAddress = SMPServerConfiguration.getSMLSMPIP();
        final String sLogicalAddress = SMPServerConfiguration.getSMLSMPHostname();
        String sDefaultPhysicalAddress = "";
        String sDefaultLogicalAddress = "";
        try {
            final InetAddress aLocalHost = InetAddress.getLocalHost();
            sDefaultPhysicalAddress = aLocalHost.getHostAddress();
            sDefaultLogicalAddress = "http://" + aLocalHost.getCanonicalHostName();
        } catch (final UnknownHostException ex) {
            LOGGER.error("Error determining localhost address", ex);
        }
        final BootstrapTabBox aTabBox = new BootstrapTabBox();
        final Predicate<ISMLInfo> aSMLFilter = ISMLInfo::isClientCertificateRequired;
        // Register SMP at SML
        {
            final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC).setLeft(3);
            aForm.addChild(info("Register this SMP to the SML. This must only be done once per SMP!"));
            aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_ID, aDefaultSML != null ? aDefaultSML.getID() : null), aDisplayLocale, aSMLFilter)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
            aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP ID").setCtrl(em(sSMPID)).setHelpText(HELPTEXT_SMP_ID));
            aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Physical address").setCtrl(new HCEdit(new RequestField(FIELD_PHYSICAL_ADDRESS, sPhysicalAddress)).setPlaceholder("The IPv4 address of your SMP. E.g. 1.2.3.4")).setHelpText(TextHelper.getFormattedText(HELPTEXT_PHYSICAL_ADDRESS, sDefaultPhysicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_PHYSICAL_ADDRESS)));
            aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Logical address").setCtrl(new HCEdit(new RequestField(FIELD_LOGICAL_ADDRESS, sLogicalAddress)).setPlaceholder("The domain name of your SMP server. E.g. http://smp.example.org")).setHelpText(TextHelper.getFormattedText(HELPTEXT_LOGICAL_ADDRESS, sDefaultLogicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_LOGICAL_ADDRESS)));
            final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
            aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
            aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_REGISTER);
            aToolbar.addSubmitButton("Register SMP at SML");
            aTabBox.addTab("register", "Register SMP to SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_REGISTER));
        }
        // Update SMP at SML
        {
            final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC).setLeft(3);
            aForm.addChild(info("Update this SMP at the SML. This must only be done when either the IP address or the host name of the SMP changed!"));
            aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_ID, aDefaultSML == null ? null : aDefaultSML.getID()), aDisplayLocale, aSMLFilter)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
            aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP ID").setCtrl(em(sSMPID)).setHelpText(HELPTEXT_SMP_ID));
            aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Physical address").setCtrl(new HCEdit(new RequestField(FIELD_PHYSICAL_ADDRESS, sPhysicalAddress)).setPlaceholder("The IPv4 address of your SMP. E.g. 1.2.3.4")).setHelpText(TextHelper.getFormattedText(HELPTEXT_PHYSICAL_ADDRESS, sDefaultPhysicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_PHYSICAL_ADDRESS)));
            aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Logical address").setCtrl(new HCEdit(new RequestField(FIELD_LOGICAL_ADDRESS, sLogicalAddress)).setPlaceholder("The domain name of your SMP server. E.g. http://smp.example.org")).setHelpText(TextHelper.getFormattedText(HELPTEXT_LOGICAL_ADDRESS, sDefaultLogicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_LOGICAL_ADDRESS)));
            final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
            aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
            aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_UPDATE);
            aToolbar.addSubmitButton("Update SMP at SML");
            aTabBox.addTab("update", "Update SMP at SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_UPDATE));
        }
        // Delete SMP from SML
        {
            final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC).setLeft(3);
            aForm.addChild(info("Delete this SMP from the SML."));
            aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_ID, aDefaultSML == null ? null : aDefaultSML.getID()), aDisplayLocale, aSMLFilter)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
            aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP ID").setCtrl(em(sSMPID)).setHelpText(HELPTEXT_SMP_ID));
            final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
            aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
            aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_DELETE);
            aToolbar.addSubmitButton("Delete SMP from SML");
            aTabBox.addTab("delete", "Delete SMP from SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_DELETE));
        }
        aNodeList.addChild(aTabBox);
    }
}
Also used : Locale(java.util.Locale) HCSMLSelect(com.helger.phoss.smp.ui.secure.hc.HCSMLSelect) HCNodeList(com.helger.html.hc.impl.HCNodeList) UnknownHostException(java.net.UnknownHostException) ISMLInfo(com.helger.peppol.sml.ISMLInfo) FormErrorList(com.helger.photon.core.form.FormErrorList) HCEdit(com.helger.html.hc.html.forms.HCEdit) BootstrapTabBox(com.helger.photon.bootstrap4.nav.BootstrapTabBox) BootstrapForm(com.helger.photon.bootstrap4.form.BootstrapForm) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) InetAddress(java.net.InetAddress) RequestField(com.helger.photon.core.form.RequestField)

Aggregations

BootstrapFormGroup (com.helger.photon.bootstrap4.form.BootstrapFormGroup)37 Locale (java.util.Locale)31 HCNodeList (com.helger.html.hc.impl.HCNodeList)27 RequestField (com.helger.photon.core.form.RequestField)22 BootstrapViewForm (com.helger.photon.bootstrap4.form.BootstrapViewForm)18 HCEdit (com.helger.html.hc.html.forms.HCEdit)17 BootstrapForm (com.helger.photon.bootstrap4.form.BootstrapForm)14 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)13 FormErrorList (com.helger.photon.core.form.FormErrorList)12 HCA (com.helger.html.hc.html.textlevel.HCA)11 IIdentifierFactory (com.helger.peppolid.factory.IIdentifierFactory)11 PDTToString (com.helger.commons.datetime.PDTToString)10 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)9 HCTextArea (com.helger.html.hc.html.forms.HCTextArea)8 Nonnull (javax.annotation.Nonnull)8 ICommonsList (com.helger.commons.collection.impl.ICommonsList)6 HCCheckBox (com.helger.html.hc.html.forms.HCCheckBox)6 HCRow (com.helger.html.hc.html.tabular.HCRow)6 BootstrapCard (com.helger.photon.bootstrap4.card.BootstrapCard)6 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)5