Search in sources :

Example 21 with HCA

use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.

the class PagePublicStart method fillContent.

@Override
protected void fillContent(final WebPageExecutionContext aWPEC) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final IRequestWebScopeWithoutResponse aRequestScope = aWPEC.getRequestScope();
    if (SMPWebAppConfiguration.isStartPageParticipantsNone()) {
        // New in v5.0.4
        aNodeList.addChild(info("This SMP has disabled the list of participants."));
    } else {
        final ISMPServiceGroupManager aSMPServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
        final ICommonsList<ISMPServiceGroup> aServiceGroups = aSMPServiceGroupMgr.getAllSMPServiceGroups();
        // Use dynamic or static table?
        final boolean bUseDataTables = SMPWebAppConfiguration.isStartPageDynamicTable();
        final boolean bShowExtensionDetails = SMPWebAppConfiguration.isStartPageExtensionsShow();
        AbstractHCTable<?> aFinalTable;
        if (bUseDataTables) {
            // Dynamic
            final HCTable aTable = new HCTable(new DTCol("Participant ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol(bShowExtensionDetails ? "Extension" : "Extension?").setDataSort(1, 0), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
            aFinalTable = aTable;
        } else {
            // Static
            final BootstrapTable aTable = new BootstrapTable();
            aTable.setBordered(true);
            aTable.setCondensed(true);
            aTable.setStriped(true);
            aTable.addHeaderRow().addCell("Participant ID").addCell(bShowExtensionDetails ? "Extension" : "Extension?").addCell(EPhotonCoreText.ACTIONS.getDisplayText(aDisplayLocale));
            aFinalTable = aTable;
            // Sort manually
            aServiceGroups.sort(Comparator.comparing(x -> x.getParticipantIdentifier().getURIEncoded()));
        }
        for (final ISMPServiceGroup aServiceGroup : aServiceGroups) {
            final String sDisplayName = aServiceGroup.getParticipantIdentifier().getURIEncoded();
            final HCRow aRow = aFinalTable.addBodyRow();
            aRow.addCell(sDisplayName);
            if (bShowExtensionDetails) {
                if (aServiceGroup.extensions().isNotEmpty())
                    aRow.addCell(code(HCExtHelper.nl2divList(aServiceGroup.getFirstExtensionXML())));
                else
                    aRow.addCell();
            } else {
                aRow.addCell(EPhotonCoreText.getYesOrNo(aServiceGroup.extensions().isNotEmpty(), aDisplayLocale));
            }
            final SMPRestDataProvider aDP = new SMPRestDataProvider(aRequestScope, aServiceGroup.getParticipantIdentifier().getURIEncoded());
            aRow.addCell(new HCA(new SimpleURL(aDP.getServiceGroupHref(aServiceGroup.getParticipantIdentifier()))).setTitle("Perform SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_GO.getAsNode()));
        }
        if (aFinalTable.hasBodyRows()) {
            aNodeList.addChild(aFinalTable);
            if (bUseDataTables) {
                final BootstrapDataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aFinalTable);
                aNodeList.addChild(aDataTables);
            }
        } else
            aNodeList.addChild(info("This SMP does not manage any participant yet."));
    }
}
Also used : Locale(java.util.Locale) WebPageExecutionContext(com.helger.photon.uicore.page.WebPageExecutionContext) AbstractHCTable(com.helger.html.hc.html.tabular.AbstractHCTable) HCRow(com.helger.html.hc.html.tabular.HCRow) SMPRestDataProvider(com.helger.phoss.smp.rest.SMPRestDataProvider) SimpleURL(com.helger.commons.url.SimpleURL) AbstractSMPWebPage(com.helger.phoss.smp.ui.AbstractSMPWebPage) BootstrapTable(com.helger.photon.bootstrap4.table.BootstrapTable) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) Nonempty(com.helger.commons.annotation.Nonempty) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) Locale(java.util.Locale) HCA(com.helger.html.hc.html.textlevel.HCA) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) HCNodeList(com.helger.html.hc.impl.HCNodeList) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) HCTable(com.helger.html.hc.html.tabular.HCTable) SMPMetaManager(com.helger.phoss.smp.domain.SMPMetaManager) EPhotonCoreText(com.helger.photon.core.EPhotonCoreText) ICommonsList(com.helger.commons.collection.impl.ICommonsList) EFamFamIcon(com.helger.photon.uictrls.famfam.EFamFamIcon) HCExtHelper(com.helger.html.hc.ext.HCExtHelper) ESortOrder(com.helger.commons.compare.ESortOrder) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) Comparator(java.util.Comparator) SMPWebAppConfiguration(com.helger.phoss.smp.app.SMPWebAppConfiguration) ISMPServiceGroupManager(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager) ISMPServiceGroupManager(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager) HCNodeList(com.helger.html.hc.impl.HCNodeList) ISMPServiceGroup(com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup) HCA(com.helger.html.hc.html.textlevel.HCA) HCRow(com.helger.html.hc.html.tabular.HCRow) SMPRestDataProvider(com.helger.phoss.smp.rest.SMPRestDataProvider) SimpleURL(com.helger.commons.url.SimpleURL) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) AbstractHCTable(com.helger.html.hc.html.tabular.AbstractHCTable) HCTable(com.helger.html.hc.html.tabular.HCTable) BootstrapTable(com.helger.photon.bootstrap4.table.BootstrapTable) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction)

Example 22 with HCA

use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.

the class PageSecureTransportProfiles method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMPTransportProfileManager aTransportProfileMgr = SMPMetaManager.getTransportProfileMgr();
    aNodeList.addChild(info("This page lets you create custom transport profiles that can be used in service information endpoints."));
    final ICommonsList<ISMPTransportProfile> aList = aTransportProfileMgr.getAllSMPTransportProfiles();
    final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
    aToolbar.addChild(new BootstrapButton().addChild("Create new transport profile").setOnClick(createCreateURL(aWPEC)).setIcon(EDefaultIcon.NEW));
    final ICommonsSet<String> aExistingIDs = new CommonsHashSet<>(aList, ISMPTransportProfile::getID);
    if (!aExistingIDs.containsAll(DEFAULT_PROFILE_IDS)) {
        // Show button only on demand
        aToolbar.addChild(new BootstrapButton().addChild("Ensure all default transport profiles").setOnClick(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_ENSURE_DEFAULT)).setIcon(EDefaultIcon.PLUS));
    }
    aNodeList.addChild(aToolbar);
    final HCTable aTable = new HCTable(new DTCol("ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Name"), new DTCol("Deprecated?"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final ISMPTransportProfile aCurObject : aList) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(new HCA(aViewLink).addChild(aCurObject.getID()));
        aRow.addCell(aCurObject.getName());
        aRow.addCell(EPhotonCoreText.getYesOrNo(aCurObject.isDeprecated(), aDisplayLocale));
        aRow.addCell(createEditLink(aWPEC, aCurObject, "Edit " + aCurObject.getID()), new HCTextNode(" "), createCopyLink(aWPEC, aCurObject, "Copy " + aCurObject.getID()), new HCTextNode(" "), isActionAllowed(aWPEC, EWebPageFormAction.DELETE, aCurObject) ? createDeleteLink(aWPEC, aCurObject, "Delete " + aCurObject.getID()) : createEmptyAction());
    }
    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) HCRow(com.helger.html.hc.html.tabular.HCRow) HCTable(com.helger.html.hc.html.tabular.HCTable) ISMPTransportProfileManager(com.helger.phoss.smp.domain.transportprofile.ISMPTransportProfileManager) ISMPTransportProfile(com.helger.peppol.smp.ISMPTransportProfile) 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) HCTextNode(com.helger.html.hc.impl.HCTextNode) CommonsHashSet(com.helger.commons.collection.impl.CommonsHashSet) DataTables(com.helger.photon.uictrls.datatables.DataTables) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)

Example 23 with HCA

use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.

the class SMPRendererSecure method getMenuContent.

@Nonnull
public static IHCNode getMenuContent(@Nonnull final ILayoutExecutionContext aLEC) {
    final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
    final HCNodeList ret = new HCNodeList();
    final ISMPSettings aSettings = SMPMetaManager.getSettings();
    ret.addChild(BootstrapMenuItemRenderer.createSideBarMenu(aLEC));
    final BootstrapSuccessBox aBox = new BootstrapSuccessBox().addClass(CBootstrapCSS.MT_2);
    if (SMPMetaManager.getInstance().getBackendConnectionState().isFalse()) {
        aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" No database connection: ").addChild(new HCA(CAjax.FUNCTION_BACKEND_CONNECTION_RESET.getInvocationURL(aRequestScope)).addChild("Retry")));
        aBox.setType(EBootstrapAlertType.DANGER);
    }
    // Information on SML usage
    if (aSettings.isSMLEnabled()) {
        aBox.addChild(new HCDiv().addChild(EDefaultIcon.YES.getAsNode()).addChild(" SML connection is configured."));
        if (aSettings.getSMLInfo() == null) {
            aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" No SML is selected. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
            aBox.setType(EBootstrapAlertType.DANGER);
        }
    } else {
        // Warn only if SML is needed
        if (aSettings.isSMLRequired()) {
            aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" SML connection is NOT configured. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
            aBox.setTypeIfWorse(EBootstrapAlertType.WARNING);
        }
    }
    if (aSettings.isDirectoryIntegrationRequired()) {
        if (aSettings.isDirectoryIntegrationEnabled()) {
            aBox.addChild(new HCDiv().addChild(EDefaultIcon.YES.getAsNode()).addChild(" Directory support is configured."));
            if (StringHelper.hasNoText(aSettings.getDirectoryHostName())) {
                aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" No Directory host is provided. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
                aBox.setType(EBootstrapAlertType.DANGER);
            }
        } else {
            // Warn only if Directory is needed
            aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" Directory support is NOT configured. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
            aBox.setTypeIfWorse(EBootstrapAlertType.WARNING);
        }
    }
    // Information on certificate
    if (!SMPKeyManager.isKeyStoreValid()) {
        aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" Certificate configuration is invalid."));
        aBox.setType(EBootstrapAlertType.DANGER);
    }
    ret.addChild(aBox);
    return ret;
}
Also used : HCDiv(com.helger.html.hc.html.grouping.HCDiv) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) HCNodeList(com.helger.html.hc.impl.HCNodeList) ISMPSettings(com.helger.phoss.smp.settings.ISMPSettings) HCA(com.helger.html.hc.html.textlevel.HCA) BootstrapSuccessBox(com.helger.photon.bootstrap4.alert.BootstrapSuccessBox) Nonnull(javax.annotation.Nonnull)

Example 24 with HCA

use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.

the class PageSecureSMPSettings method showInputForm.

@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPSettings aObject, @Nonnull final BootstrapForm aForm, @Nonnull final EWebPageSimpleFormAction eSimpleFormAction, @Nonnull final FormErrorList aFormErrors) {
    final String sDirectoryName = SMPWebAppConfiguration.getDirectoryName();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    aForm.setLeft(3);
    aForm.addChild(getUIHandler().createDataGroupHeader("REST API"));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("REST writable API disabled?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SMP_REST_WRITABLE_API_DISABLED, aObject.isRESTWritableAPIDisabled()))).setHelpText("If this checkbox is checked, all non-standard writing REST APIs are disabled.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_REST_WRITABLE_API_DISABLED)));
    aForm.addChild(getUIHandler().createDataGroupHeader("SMK/SML"));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("SML connection required?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SML_REQUIRED, aObject.isSMLRequired()))).setHelpText("If this checkbox is checked, warnings are emitted if the SML connection is not enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SML_REQUIRED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("SML connection enabled?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SML_ACTIVE, aObject.isSMLEnabled()))).setHelpText("If this checkbox is checked, service group changes are propagated to the SML.").setErrorList(aFormErrors.getListOfField(FIELD_SML_ACTIVE)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("SML configuration").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_INFO, aObject.getSMLInfoID()), aDisplayLocale, null)).setHelpText(new HCTextNode("Select the SML to operate on. The list of available configurations can be "), new HCA(aWPEC.getLinkToMenuItem(CMenuSecure.MENU_SML_CONFIGURATION)).addChild("customized"), new HCTextNode(".")).setErrorList(aFormErrors.getListOfField(FIELD_SML_INFO)));
    aForm.addChild(getUIHandler().createDataGroupHeader(sDirectoryName));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " connection required?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SML_DIRECTORY_INTEGRATION_REQUIRED, aObject.isDirectoryIntegrationRequired()))).setHelpText("If this checkbox is checked, warnings are emitted if the " + sDirectoryName + " connection is not enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SML_DIRECTORY_INTEGRATION_REQUIRED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " integration enabled?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SMP_DIRECTORY_INTEGRATION_ENABLED, aObject.isDirectoryIntegrationEnabled()))).setHelpText("If this checkbox is checked, the " + sDirectoryName + " integration is enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_DIRECTORY_INTEGRATION_ENABLED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " integration automatic update?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SMP_DIRECTORY_INTEGRATION_AUTO_UPDATE, aObject.isDirectoryIntegrationAutoUpdate()))).setHelpText("If the " + sDirectoryName + " integration is enabled and this checkbox is checked, all business card creations, modifications and deletions are automatically pushed to the " + sDirectoryName + " server.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_DIRECTORY_INTEGRATION_ENABLED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " hostname").setCtrl(new HCEdit(new RequestField(FIELD_SMP_DIRECTORY_HOSTNAME, aObject.getDirectoryHostName()))).setHelpText("The " + sDirectoryName + " host where the business cards should be published to. This URL is only used if the " + sDirectoryName + " integration (see above) is enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_DIRECTORY_HOSTNAME)));
}
Also used : Locale(java.util.Locale) HCSMLSelect(com.helger.phoss.smp.ui.secure.hc.HCSMLSelect) RequestFieldBoolean(com.helger.photon.core.form.RequestFieldBoolean) HCA(com.helger.html.hc.html.textlevel.HCA) 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 25 with HCA

use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.

the class PageSecureServiceGroupMigrationInbound method showSelectedObject.

@Override
protected void showSelectedObject(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPParticipantMigration aSelectedObject) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    aNodeList.addChild(getUIHandler().createActionHeader("Show details of inbound Participant Migration"));
    final BootstrapViewForm aForm = new BootstrapViewForm();
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Service Group").setCtrl(new HCA(createViewURL(aWPEC, CMenuSecure.MENU_SERVICE_GROUPS, aSelectedObject.getParticipantIdentifier().getURIEncoded())).addChild(aSelectedObject.getParticipantIdentifier().getURIEncoded())));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Migration state").setCtrl(aSelectedObject.getState().getDisplayName()));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Initiation datetime").setCtrl(PDTToString.getAsString(aSelectedObject.getInitiationDateTime(), aDisplayLocale)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Migration Key").setCtrl(code(aSelectedObject.getMigrationKey())));
    aNodeList.addChild(aForm);
}
Also used : Locale(java.util.Locale) 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)

Aggregations

HCA (com.helger.html.hc.html.textlevel.HCA)25 HCNodeList (com.helger.html.hc.impl.HCNodeList)22 Locale (java.util.Locale)19 ISimpleURL (com.helger.commons.url.ISimpleURL)15 HCRow (com.helger.html.hc.html.tabular.HCRow)14 HCTable (com.helger.html.hc.html.tabular.HCTable)13 BootstrapDTColAction (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction)13 DTCol (com.helger.photon.uictrls.datatables.column.DTCol)13 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)11 BootstrapDataTables (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)11 DataTables (com.helger.photon.uictrls.datatables.DataTables)10 HCTextNode (com.helger.html.hc.impl.HCTextNode)9 BootstrapFormGroup (com.helger.photon.bootstrap4.form.BootstrapFormGroup)8 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)6 Nonnull (javax.annotation.Nonnull)6 PDTToString (com.helger.commons.datetime.PDTToString)5 ISMPEndpoint (com.helger.phoss.smp.domain.serviceinfo.ISMPEndpoint)5 ISMPProcess (com.helger.phoss.smp.domain.serviceinfo.ISMPProcess)5 BootstrapViewForm (com.helger.photon.bootstrap4.form.BootstrapViewForm)5 ICommonsList (com.helger.commons.collection.impl.ICommonsList)4