Search in sources :

Example 16 with BootstrapButton

use of com.helger.photon.bootstrap4.button.BootstrapButton in project phoss-smp by phax.

the class PageSecureBusinessCard method _createContactInputForm.

@Nonnull
private static HCRow _createContactInputForm(@Nonnull final ILayoutExecutionContext aLEC, @Nonnull final String sEntityID, @Nullable final SMPBusinessCardContact aExistingContact, @Nullable final String sExistingID, @Nonnull final FormErrorList aFormErrors) {
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final String sContactID = StringHelper.hasText(sExistingID) ? sExistingID : TMP_ID_PREFIX + Integer.toString(GlobalIDFactory.getNewIntID());
    final HCRow aRow = new HCRow();
    // Type
    {
        final String sFieldType = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityID, PREFIX_CONTACT, sContactID, SUFFIX_TYPE);
        final HCEdit aCtrl = new HCEdit(new RequestField(sFieldType, aExistingContact == null ? null : aExistingContact.getType())).setPlaceholder("Contact type");
        aCtrl.addClass(CBootstrapCSS.FORM_CONTROL);
        aRow.addCell(aCtrl, BootstrapFormHelper.createDefaultErrorNode(aFormErrors.getListOfField(sFieldType), aDisplayLocale));
    }
    // Name
    {
        final String sFieldName = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityID, PREFIX_CONTACT, sContactID, SUFFIX_NAME);
        final HCEdit aCtrl = new HCEdit(new RequestField(sFieldName, aExistingContact == null ? null : aExistingContact.getName())).setPlaceholder("Contact name");
        aCtrl.addClass(CBootstrapCSS.FORM_CONTROL);
        aRow.addCell(aCtrl, BootstrapFormHelper.createDefaultErrorNode(aFormErrors.getListOfField(sFieldName), aDisplayLocale));
    }
    // Phone number
    {
        final String sFieldPhone = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityID, PREFIX_CONTACT, sContactID, SUFFIX_PHONE);
        final HCEdit aCtrl = new HCEdit(new RequestField(sFieldPhone, aExistingContact == null ? null : aExistingContact.getPhoneNumber())).setPlaceholder("Contact phone number");
        aCtrl.addClass(CBootstrapCSS.FORM_CONTROL);
        aRow.addCell(aCtrl, BootstrapFormHelper.createDefaultErrorNode(aFormErrors.getListOfField(sFieldPhone), aDisplayLocale));
    }
    // Email address
    {
        final String sFieldEmail = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityID, PREFIX_CONTACT, sContactID, SUFFIX_EMAIL);
        final HCEdit aCtrl = new HCEdit(new RequestField(sFieldEmail, aExistingContact == null ? null : aExistingContact.getEmail())).setPlaceholder("Contact email address");
        aCtrl.addClass(CBootstrapCSS.FORM_CONTROL);
        aRow.addCell(aCtrl, BootstrapFormHelper.createDefaultErrorNode(aFormErrors.getListOfField(sFieldEmail), aDisplayLocale));
    }
    aRow.addCell(new BootstrapButton(EBootstrapButtonSize.SMALL).setIcon(EDefaultIcon.DELETE).setOnClick(JQuery.idRef(aRow).remove()));
    return aRow;
}
Also used : Locale(java.util.Locale) HCEdit(com.helger.html.hc.html.forms.HCEdit) HCRow(com.helger.html.hc.html.tabular.HCRow) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) PDTToString(com.helger.commons.datetime.PDTToString) PDTFromString(com.helger.commons.datetime.PDTFromString) RequestField(com.helger.photon.core.form.RequestField) Nonnull(javax.annotation.Nonnull)

Example 17 with BootstrapButton

use of com.helger.photon.bootstrap4.button.BootstrapButton 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 18 with BootstrapButton

use of com.helger.photon.bootstrap4.button.BootstrapButton in project phoss-smp by phax.

the class PageSecureBusinessCard method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMPBusinessCardManager aBusinessCardMgr = SMPMetaManager.getBusinessCardMgr();
    final ICommonsList<ISMPBusinessCard> aAllBusinessCards = aBusinessCardMgr.getAllSMPBusinessCards();
    final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
    aToolbar.addButton("Create new Business Card", createCreateURL(aWPEC), EDefaultIcon.NEW);
    aToolbar.addChild(new BootstrapButton().setOnClick(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_PUBLISH_ALL_TO_INDEXER)).setIcon(EFamFamIcon.ARROW_REDO).addChild("Update all Business Cards in " + SMPWebAppConfiguration.getDirectoryName()).setDisabled(aAllBusinessCards.isEmpty()));
    aNodeList.addChild(aToolbar);
    final HCTable aTable = new HCTable(new DTCol("Service Group").setDataSort(0, 1).setInitialSorting(ESortOrder.ASCENDING), new DTCol("Name"), new DTCol("Country"), new DTCol("GeoInfo"), new DTCol("Identifiers"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final ISMPBusinessCard aCurObject : aAllBusinessCards) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final String sDisplayName = aCurObject.getID();
        if (aCurObject.getEntityCount() == 0) {
            final HCRow aRow = aTable.addBodyRow();
            aRow.addCell(new HCA(aViewLink).addChild(sDisplayName));
            for (int i = 1; i < aTable.getColumnCount() - 1; ++i) aRow.addCell();
            aRow.addCell(_createActionCell(aWPEC, aCurObject));
        } else {
            for (final SMPBusinessCardEntity aEntity : aCurObject.getAllEntities()) {
                final HCRow aRow = aTable.addBodyRow();
                aRow.addCell(new HCA(aViewLink).addChild(sDisplayName));
                aRow.addCell(aEntity.names().getFirst().getName());
                final Locale aCountry = CountryCache.getInstance().getCountry(aEntity.getCountryCode());
                final IHCCell<?> aCountryCell = aRow.addCell();
                final EFamFamFlagIcon eIcon = EFamFamFlagIcon.getFromIDOrNull(aCountry.getCountry());
                if (eIcon != null)
                    aCountryCell.addChild(eIcon.getAsNode()).addChild(" ");
                aCountryCell.addChild(aCountry.getDisplayCountry(aDisplayLocale));
                aRow.addCell(HCExtHelper.nl2divList(aEntity.getGeographicalInformation()));
                {
                    final HCNodeList aIdentifiers = new HCNodeList();
                    for (final SMPBusinessCardIdentifier aIdentifier : aEntity.identifiers()) aIdentifiers.addChild(div(aIdentifier.getScheme()).addChild(" - ").addChild(aIdentifier.getValue()));
                    aRow.addCell(aIdentifiers);
                }
                aRow.addCell(_createActionCell(aWPEC, aCurObject));
            }
        }
    }
    final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
    aNodeList.addChild(aTable).addChild(aDataTables);
}
Also used : Locale(java.util.Locale) HCNodeList(com.helger.html.hc.impl.HCNodeList) HCA(com.helger.html.hc.html.textlevel.HCA) SMPBusinessCardEntity(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardEntity) HCRow(com.helger.html.hc.html.tabular.HCRow) PDTToString(com.helger.commons.datetime.PDTToString) PDTFromString(com.helger.commons.datetime.PDTFromString) SMPBusinessCardIdentifier(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardIdentifier) ISMPBusinessCard(com.helger.phoss.smp.domain.businesscard.ISMPBusinessCard) ISMPBusinessCardManager(com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager) HCTable(com.helger.html.hc.html.tabular.HCTable) EFamFamFlagIcon(com.helger.photon.uictrls.famfam.EFamFamFlagIcon) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) DataTables(com.helger.photon.uictrls.datatables.DataTables) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)

Example 19 with BootstrapButton

use of com.helger.photon.bootstrap4.button.BootstrapButton in project phoss-smp by phax.

the class PageSecureBusinessCard method _createIdentifierInputForm.

@Nonnull
private static HCRow _createIdentifierInputForm(@Nonnull final ILayoutExecutionContext aLEC, @Nonnull final String sEntityID, @Nullable final SMPBusinessCardIdentifier aExistingIdentifier, @Nullable final String sExistingID, @Nonnull final FormErrorList aFormErrors) {
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final String sIdentifierID = StringHelper.hasText(sExistingID) ? sExistingID : TMP_ID_PREFIX + Integer.toString(GlobalIDFactory.getNewIntID());
    final HCRow aRow = new HCRow();
    // Identifier scheme
    {
        final String sFieldScheme = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityID, PREFIX_IDENTIFIER, sIdentifierID, SUFFIX_SCHEME);
        final HCEdit aCtrl = new HCEdit(new RequestField(sFieldScheme, aExistingIdentifier == null ? null : aExistingIdentifier.getScheme())).setPlaceholder("Identifier scheme");
        aCtrl.addClass(CBootstrapCSS.FORM_CONTROL);
        aRow.addCell(aCtrl, BootstrapFormHelper.createDefaultErrorNode(aFormErrors.getListOfField(sFieldScheme), aDisplayLocale));
    }
    // Identifier Value
    {
        final String sFieldValue = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityID, PREFIX_IDENTIFIER, sIdentifierID, SUFFIX_VALUE);
        final HCEdit aCtrl = new HCEdit(new RequestField(sFieldValue, aExistingIdentifier == null ? null : aExistingIdentifier.getValue())).setPlaceholder("Identifier value");
        aCtrl.addClass(CBootstrapCSS.FORM_CONTROL);
        aRow.addCell(aCtrl, BootstrapFormHelper.createDefaultErrorNode(aFormErrors.getListOfField(sFieldValue), aDisplayLocale));
    }
    aRow.addCell(new BootstrapButton(EBootstrapButtonSize.SMALL).setIcon(EDefaultIcon.DELETE).setOnClick(JQuery.idRef(aRow).remove()));
    return aRow;
}
Also used : Locale(java.util.Locale) HCEdit(com.helger.html.hc.html.forms.HCEdit) HCRow(com.helger.html.hc.html.tabular.HCRow) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) PDTToString(com.helger.commons.datetime.PDTToString) PDTFromString(com.helger.commons.datetime.PDTFromString) RequestField(com.helger.photon.core.form.RequestField) Nonnull(javax.annotation.Nonnull)

Example 20 with BootstrapButton

use of com.helger.photon.bootstrap4.button.BootstrapButton in project phoss-smp by phax.

the class PageSecureEndpointChangeCertificate method isValidToDisplayPage.

@Override
@Nonnull
protected IValidityIndicator isValidToDisplayPage(@Nonnull final WebPageExecutionContext aWPEC) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
    if (aServiceGroupMgr.getSMPServiceGroupCount() <= 0) {
        aNodeList.addChild(warn("No service group is present! At least one service group must be present to change certificates."));
        aNodeList.addChild(new BootstrapButton().addChild("Create new service group").setOnClick(AbstractWebPageForm.createCreateURL(aWPEC, CMenuSecure.MENU_SERVICE_GROUPS)).setIcon(EDefaultIcon.YES));
        return EValidity.INVALID;
    }
    return super.isValidToDisplayPage(aWPEC);
}
Also used : ISMPServiceGroupManager(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager) HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) Nonnull(javax.annotation.Nonnull)

Aggregations

BootstrapButton (com.helger.photon.bootstrap4.button.BootstrapButton)34 HCNodeList (com.helger.html.hc.impl.HCNodeList)25 Locale (java.util.Locale)23 Nonnull (javax.annotation.Nonnull)21 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)14 IRequestWebScopeWithoutResponse (com.helger.web.scope.IRequestWebScopeWithoutResponse)14 ISimpleURL (com.helger.commons.url.ISimpleURL)12 HCDiv (com.helger.html.hc.html.grouping.HCDiv)10 HCRow (com.helger.html.hc.html.tabular.HCRow)10 ISMPServiceGroupManager (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager)10 PDTToString (com.helger.commons.datetime.PDTToString)9 HCEdit (com.helger.html.hc.html.forms.HCEdit)9 RequestField (com.helger.photon.core.form.RequestField)9 IUser (com.helger.photon.security.user.IUser)9 DTCol (com.helger.photon.uictrls.datatables.column.DTCol)8 HCTable (com.helger.html.hc.html.tabular.HCTable)7 HCA (com.helger.html.hc.html.textlevel.HCA)7 HCStrong (com.helger.html.hc.html.textlevel.HCStrong)7 BootstrapFormGroup (com.helger.photon.bootstrap4.form.BootstrapFormGroup)7 ISMPSettings (com.helger.phoss.smp.settings.ISMPSettings)6