Search in sources :

Example 6 with BootstrapButton

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

the class PageSecureSMPIdentifierMappings method fillContent.

@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final BootstrapButtonToolbar aToolbar = aNodeList.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
    aToolbar.addChild(new BootstrapButton().addChild("Reload").setIcon(EDefaultIcon.REFRESH).setOnClick(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_RELOAD)));
    if (aWPEC.hasAction(ACTION_RELOAD)) {
        NiceNameHandler.reloadNames();
        aNodeList.addChild(success("Successfully reloaded name mappings"));
    }
    final BootstrapTabBox aTabBox = aNodeList.addAndReturnChild(new BootstrapTabBox());
    aTabBox.addTab("doctypes", "Document Types", _createList(aWPEC, NiceNameHandler.getAllDocumentTypeMappings(), "doctypes"));
    aTabBox.addTab("procs", "Processes", _createList(aWPEC, NiceNameHandler.getAllProcessMappings(), "procs"));
}
Also used : HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) BootstrapTabBox(com.helger.photon.bootstrap4.nav.BootstrapTabBox)

Example 7 with BootstrapButton

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

the class PageSecureServiceGroupMigrationInbound method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMPParticipantMigrationManager aParticipantMigrationMgr = SMPMetaManager.getParticipantMigrationMgr();
    final ISMPSettings aSettings = SMPMetaManager.getSettings();
    {
        final HCOL aOL = new HCOL();
        aOL.addItem("The migration was initiated by another SMP, and the SML must have been informed about the upcoming migration");
        aOL.addItem("This SMP, that is taking over the Service Group, must acknowledge the migration by providing the same migration code (created by the other SMP) to the SML");
        aOL.addItem("If the migration was successful, the Service Group must be deleted from the other SMP, ideally a temporary redirect to the new SMP is created");
        aNodeList.addChild(info().addChild(div("The process of migrating a Service Group to another SMP consists of multiple steps:")).addChild(aOL).addChild(div("If a Migration is unsuccessful, it can be retried later.")));
    }
    EValidity eCanMigrate = EValidity.VALID;
    if (aSettings.getSMLInfo() == null) {
        final BootstrapWarnBox aWarnBox = aNodeList.addAndReturnChild(warn().addChild(div("No valid SML Configuration is selected hence no participant can be migrated.")).addChild(new BootstrapButton().addChild("Select SML Configuration in the Settings").setOnClick(aWPEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).setIcon(EDefaultIcon.EDIT)));
        if (aSettings.isSMLEnabled() || aSettings.isSMLRequired()) {
            aWarnBox.addChild(div(new BootstrapButton().addChild("Create a new SML Configuration").setOnClick(createCreateURL(aWPEC, CMenuSecure.MENU_SML_CONFIGURATION)).setIcon(EDefaultIcon.YES)));
        }
        eCanMigrate = EValidity.INVALID;
    } else if (!aSettings.isSMLEnabled()) {
        aNodeList.addChild(warn().addChild(div("SML Connection is not enabled hence no participant can be migrated.")).addChild(div(new BootstrapButton().addChild("Enable SML in the Settings").setOnClick(aWPEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).setIcon(EDefaultIcon.EDIT))));
        eCanMigrate = EValidity.INVALID;
    }
    {
        final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
        aToolbar.addButton("Refresh", aWPEC.getSelfHref(), EDefaultIcon.REFRESH);
        aToolbar.addChild(new BootstrapButton().addChild("Start Participant Migration").setOnClick(createCreateURL(aWPEC)).setDisabled(eCanMigrate.isInvalid()).setIcon(EDefaultIcon.NEW));
        aNodeList.addChild(aToolbar);
    }
    final BootstrapTabBox aTabBox = aNodeList.addAndReturnChild(new BootstrapTabBox());
    final ICommonsList<ISMPParticipantMigration> aAllMigs = aParticipantMigrationMgr.getAllInboundParticipantMigrations(null);
    for (final EParticipantMigrationState eState : EParticipantMigrationState.values()) if (eState.isInboundState()) {
        final ICommonsList<ISMPParticipantMigration> aMatchingMigs = aAllMigs.getAll(x -> x.getState() == eState);
        aTabBox.addTab(eState.getID(), eState.getDisplayName() + " (" + aMatchingMigs.size() + ")", _createTable(aWPEC, aMatchingMigs, eState));
    }
}
Also used : CSMPServer(com.helger.phoss.smp.CSMPServer) HCOL(com.helger.html.hc.html.grouping.HCOL) SMPParticipantMigration(com.helger.phoss.smp.domain.pmigration.SMPParticipantMigration) WebPageExecutionContext(com.helger.photon.uicore.page.WebPageExecutionContext) EDefaultIcon(com.helger.photon.uicore.icon.EDefaultIcon) ISMPSettings(com.helger.phoss.smp.settings.ISMPSettings) LoggerFactory(org.slf4j.LoggerFactory) IMicroDocument(com.helger.xml.microdom.IMicroDocument) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) AbstractBootstrapWebPageActionHandlerDelete(com.helger.photon.bootstrap4.pages.handler.AbstractBootstrapWebPageActionHandlerDelete) FormErrorList(com.helger.photon.core.form.FormErrorList) BootstrapForm(com.helger.photon.bootstrap4.form.BootstrapForm) IIdentifierFactory(com.helger.peppolid.factory.IIdentifierFactory) ICommonsIterable(com.helger.commons.collection.impl.ICommonsIterable) Nonempty(com.helger.commons.annotation.Nonempty) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) Locale(java.util.Locale) IUser(com.helger.photon.security.user.IUser) HCA(com.helger.html.hc.html.textlevel.HCA) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) HCTextArea(com.helger.html.hc.html.forms.HCTextArea) ISMPParticipantMigrationManager(com.helger.phoss.smp.domain.pmigration.ISMPParticipantMigrationManager) SMPCommonUI(com.helger.phoss.smp.ui.SMPCommonUI) PDTToString(com.helger.commons.datetime.PDTToString) BootstrapViewForm(com.helger.photon.bootstrap4.form.BootstrapViewForm) BootstrapTabBox(com.helger.photon.bootstrap4.nav.BootstrapTabBox) IHCCell(com.helger.html.hc.html.tabular.IHCCell) BootstrapTechnicalUI(com.helger.photon.bootstrap4.uictrls.ext.BootstrapTechnicalUI) EWebPageFormAction(com.helger.photon.uicore.page.EWebPageFormAction) HCUserSelect(com.helger.phoss.smp.ui.secure.hc.HCUserSelect) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) SingleError(com.helger.commons.error.SingleError) ICommonsList(com.helger.commons.collection.impl.ICommonsList) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISMPServiceGroupManager(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager) PhotonSecurityManager(com.helger.photon.security.mgr.PhotonSecurityManager) ManageParticipantIdentifierServiceCaller(com.helger.peppol.smlclient.ManageParticipantIdentifierServiceCaller) DataTables(com.helger.photon.uictrls.datatables.DataTables) HCRow(com.helger.html.hc.html.tabular.HCRow) EValidity(com.helger.commons.state.EValidity) HCEdit(com.helger.html.hc.html.forms.HCEdit) BootstrapRow(com.helger.photon.bootstrap4.grid.BootstrapRow) AbstractSMPWebPageForm(com.helger.phoss.smp.ui.AbstractSMPWebPageForm) IHCNode(com.helger.html.hc.IHCNode) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) EParticipantMigrationState(com.helger.phoss.smp.domain.pmigration.EParticipantMigrationState) SMPKeyManager(com.helger.phoss.smp.security.SMPKeyManager) EDTColType(com.helger.photon.uictrls.datatables.column.EDTColType) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) ISimpleURL(com.helger.commons.url.ISimpleURL) HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapWarnBox(com.helger.photon.bootstrap4.alert.BootstrapWarnBox) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) Logger(org.slf4j.Logger) StringHelper(com.helger.commons.string.StringHelper) ISMPParticipantMigration(com.helger.phoss.smp.domain.pmigration.ISMPParticipantMigration) HCTable(com.helger.html.hc.html.tabular.HCTable) SMPMetaManager(com.helger.phoss.smp.domain.SMPMetaManager) RequestField(com.helger.photon.core.form.RequestField) SMPServerConfiguration(com.helger.phoss.smp.SMPServerConfiguration) LoggedInUserManager(com.helger.photon.security.login.LoggedInUserManager) ESortOrder(com.helger.commons.compare.ESortOrder) MicroReader(com.helger.xml.microdom.serialize.MicroReader) EValidity(com.helger.commons.state.EValidity) ICommonsList(com.helger.commons.collection.impl.ICommonsList) HCNodeList(com.helger.html.hc.impl.HCNodeList) EParticipantMigrationState(com.helger.phoss.smp.domain.pmigration.EParticipantMigrationState) BootstrapTabBox(com.helger.photon.bootstrap4.nav.BootstrapTabBox) BootstrapWarnBox(com.helger.photon.bootstrap4.alert.BootstrapWarnBox) ISMPParticipantMigration(com.helger.phoss.smp.domain.pmigration.ISMPParticipantMigration) ISMPSettings(com.helger.phoss.smp.settings.ISMPSettings) HCOL(com.helger.html.hc.html.grouping.HCOL) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) ISMPParticipantMigrationManager(com.helger.phoss.smp.domain.pmigration.ISMPParticipantMigrationManager) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)

Example 8 with BootstrapButton

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

the class PageSecureRedirect method isValidToDisplayPage.

@Override
@Nonnull
protected IValidityIndicator isValidToDisplayPage(@Nonnull final WebPageExecutionContext aWPEC) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMPServiceGroupManager aServiceGroupManager = SMPMetaManager.getServiceGroupMgr();
    if (aServiceGroupManager.getSMPServiceGroupCount() <= 0) {
        aNodeList.addChild(warn("No Service Group is present! At least one Service Group must be present to create a Redirect for it."));
        aNodeList.addChild(new BootstrapButton().addChild("Create new Service Group").setOnClick(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)

Example 9 with BootstrapButton

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

the class SMPRendererSecure method _getNavbar.

@Nonnull
private static IHCNode _getNavbar(@Nonnull final ILayoutExecutionContext aLEC) {
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
    final ISimpleURL aLinkToStartPage = aLEC.getLinkToMenuItem(aLEC.getMenuTree().getDefaultMenuItemID());
    final BootstrapNavbar aNavbar = new BootstrapNavbar();
    aNavbar.addBrand(SMPRendererPublic.createLogo(aLEC), aLinkToStartPage);
    aNavbar.addBrand(new HCSpan().addChild(CSMP.getApplicationSuffix() + " Administration"), aLinkToStartPage);
    aNavbar.addAndReturnText().addChild(" [" + SMPServerConfiguration.getSMLSMPID() + "]");
    final BootstrapNavbarToggleable aToggleable = aNavbar.addAndReturnToggleable();
    {
        aToggleable.addChild(new BootstrapButton().addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MR_2).setOnClick(LinkHelper.getURLWithContext(AbstractPublicApplicationServlet.SERVLET_DEFAULT_PATH + "/")).addChild("Goto public view"));
        final IUser aUser = aLEC.getLoggedInUser();
        aToggleable.addAndReturnText().addClass(CBootstrapCSS.MX_2).addChild("Logged in as ").addChild(new HCStrong().addChild(SecurityHelper.getUserDisplayName(aUser, aDisplayLocale)));
        aToggleable.addChild(new BootstrapButton().addClass(CBootstrapCSS.MX_2).setOnClick(LinkHelper.getURLWithContext(aRequestScope, LogoutServlet.SERVLET_DEFAULT_PATH)).addChild(EPhotonCoreText.LOGIN_LOGOUT.getDisplayText(aDisplayLocale)));
    }
    return aNavbar;
}
Also used : Locale(java.util.Locale) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) HCSpan(com.helger.html.hc.html.textlevel.HCSpan) HCStrong(com.helger.html.hc.html.textlevel.HCStrong) BootstrapNavbar(com.helger.photon.bootstrap4.navbar.BootstrapNavbar) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapNavbarToggleable(com.helger.photon.bootstrap4.navbar.BootstrapNavbarToggleable) IUser(com.helger.photon.security.user.IUser) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) Nonnull(javax.annotation.Nonnull)

Example 10 with BootstrapButton

use of com.helger.photon.bootstrap4.button.BootstrapButton in project peppol-practical by phax.

the class LayoutAreaContentProviderSecure method _getNavbar.

@Nonnull
private static IHCNode _getNavbar(@Nonnull final LayoutExecutionContext aLEC) {
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
    final ISimpleURL aLinkToStartPage = aLEC.getLinkToMenuItem(aLEC.getMenuTree().getDefaultMenuItemID());
    final BootstrapNavbar aNavbar = new BootstrapNavbar();
    aNavbar.addBrand(new HCNodeList().addChild(new HCSpan().addClass(AppCommonUI.CSS_CLASS_LOGO1).addChild(AppHelper.getApplicationTitle())).addChild(new HCSpan().addClass(AppCommonUI.CSS_CLASS_LOGO2).addChild(" Administration")), aLinkToStartPage);
    final BootstrapNavbarToggleable aToggleable = aNavbar.addAndReturnToggleable();
    final IUser aUser = LoggedInUserManager.getInstance().getCurrentUser();
    aToggleable.addAndReturnText().addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MX_2).addChild("Welcome ").addChild(new HCStrong().addChild(SecurityHelper.getUserDisplayName(aUser, aDisplayLocale)));
    aToggleable.addChild(new BootstrapButton().setOnClick(LinkHelper.getURLWithContext(AbstractPublicApplicationServlet.SERVLET_DEFAULT_PATH)).addChild("Public area").addClass(CBootstrapCSS.MX_2));
    aToggleable.addChild(new BootstrapButton().setOnClick(LinkHelper.getURLWithContext(aRequestScope, LogoutServlet.SERVLET_DEFAULT_PATH)).addChild(EPhotonCoreText.LOGIN_LOGOUT.getDisplayText(aDisplayLocale)).addClass(CBootstrapCSS.MX_2));
    return aNavbar;
}
Also used : Locale(java.util.Locale) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) HCSpan(com.helger.html.hc.html.textlevel.HCSpan) HCStrong(com.helger.html.hc.html.textlevel.HCStrong) HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapNavbar(com.helger.photon.bootstrap4.navbar.BootstrapNavbar) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapNavbarToggleable(com.helger.photon.bootstrap4.navbar.BootstrapNavbarToggleable) IUser(com.helger.photon.security.user.IUser) 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