Search in sources :

Example 21 with HCRow

use of com.helger.html.hc.html.tabular.HCRow 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 HCRow

use of com.helger.html.hc.html.tabular.HCRow 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 HCRow

use of com.helger.html.hc.html.tabular.HCRow in project phoss-smp by phax.

the class PageSecureSMPIdentifierMappings method _createList.

@Nonnull
private IHCNode _createList(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ICommonsOrderedMap<String, NiceNameEntry> aEntries, @Nonnull final String sSuffix) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCTable aTable = new HCTable(new DTCol("ID"), new DTCol("Name"), new DTCol("Deprecated?")).setID(getID() + sSuffix);
    for (final Map.Entry<String, NiceNameEntry> aEntry : aEntries.entrySet()) {
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(aEntry.getKey());
        aRow.addCell(aEntry.getValue().getName());
        aRow.addCell(EPhotonCoreText.getYesOrNo(aEntry.getValue().isDeprecated(), aDisplayLocale));
    }
    return new HCNodeList().addChild(aTable).addChild(BootstrapDataTables.createDefaultDataTables(aWPEC, aTable));
}
Also used : Locale(java.util.Locale) HCTable(com.helger.html.hc.html.tabular.HCTable) HCNodeList(com.helger.html.hc.impl.HCNodeList) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) HCRow(com.helger.html.hc.html.tabular.HCRow) NiceNameEntry(com.helger.phoss.smp.nicename.NiceNameEntry) ICommonsOrderedMap(com.helger.commons.collection.impl.ICommonsOrderedMap) Map(java.util.Map) Nonnull(javax.annotation.Nonnull)

Example 24 with HCRow

use of com.helger.html.hc.html.tabular.HCRow in project peppol-practical by phax.

the class PagePublicToolsTestEndpoints method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final TestEndpointManager aTestEndpointMgr = PPMetaManager.getTestEndpointMgr();
    final boolean bUserIsLoggedIn = LoggedInUserManager.getInstance().isUserLoggedInInCurrentSession();
    // Toolbar on top
    final BootstrapButtonToolbar aToolbar = aNodeList.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
    if (bUserIsLoggedIn)
        aToolbar.addButtonNew("Create new test endpoint", createCreateURL(aWPEC));
    else
        aToolbar.addChild(badgeInfo("You need to be logged in to create test endpoints."));
    aNodeList.addChild(info("Test endpoints are special Peppol participant identifiers whose sole purpose is the usage for testing. So if you are a Peppol AccessPoint provider and want to test your implementation you may use the below listed participant identifiers as test recipients."));
    // List existing
    final HCTable aTable = new HCTable(new DTCol("Participant ID"), new DTCol("Company").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Transport profile"), new DTCol("SML"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final TestEndpoint aCurObject : aTestEndpointMgr.getAllActiveTestEndpoints()) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(new HCA(aViewLink).addChild(aCurObject.getDisplayName()));
        aRow.addCell(aCurObject.getCompanyName());
        aRow.addCell(AppHelper.getSMPTransportProfileShortName(aCurObject.getTransportProfile()));
        aRow.addCell(aCurObject.getSML().getDisplayName());
        final IHCCell<?> aActionCell = aRow.addCell();
        if (isActionAllowed(aWPEC, EWebPageFormAction.EDIT, aCurObject))
            aActionCell.addChild(createEditLink(aWPEC, aCurObject));
        else
            aActionCell.addChild(createEmptyAction());
        aActionCell.addChild(new HCTextNode(" "));
        if (isActionAllowed(aWPEC, EWebPageFormAction.DELETE, aCurObject))
            aActionCell.addChild(createDeleteLink(aWPEC, aCurObject));
        else
            aActionCell.addChild(createEmptyAction());
        aActionCell.addChild(new HCTextNode(" "));
        if (bUserIsLoggedIn)
            aActionCell.addChild(createCopyLink(aWPEC, aCurObject));
        else
            aActionCell.addChild(createEmptyAction());
        aActionCell.addChild(new HCTextNode(" "));
        // Visible for all
        aActionCell.addChild(new HCA(_createParticipantInfoURL(aWPEC, aCurObject)).setTitle("Show participant information").addChild(EDefaultIcon.MAGNIFIER.getAsNode()));
    }
    aNodeList.addChild(aTable);
    final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
    aNodeList.addChild(aDataTables);
}
Also used : Locale(java.util.Locale) TestEndpoint(com.helger.peppol.testendpoint.TestEndpoint) HCNodeList(com.helger.html.hc.impl.HCNodeList) HCA(com.helger.html.hc.html.textlevel.HCA) TestEndpointManager(com.helger.peppol.testendpoint.TestEndpointManager) HCRow(com.helger.html.hc.html.tabular.HCRow) HCTable(com.helger.html.hc.html.tabular.HCTable) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) HCTextNode(com.helger.html.hc.impl.HCTextNode) DataTables(com.helger.photon.uictrls.datatables.DataTables) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)

Example 25 with HCRow

use of com.helger.html.hc.html.tabular.HCRow in project peppol-practical by phax.

the class PageSecureSMLConfiguration method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMLConfigurationManager aSMLConfigurationMgr = PPMetaManager.getSMLConfigurationMgr();
    aNodeList.addChild(info("This page lets you create custom SML configurations that can be used for registration."));
    final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
    aToolbar.addButton("Create new SML configuration", createCreateURL(aWPEC), EDefaultIcon.NEW);
    aNodeList.addChild(aToolbar);
    final HCTable aTable = new HCTable(new DTCol("ID"), new DTCol("Name").setInitialSorting(ESortOrder.ASCENDING), new DTCol("DNS Zone"), new DTCol("Management Service URL"), new DTCol("Client Cert?"), new DTCol("SMP API type"), new DTCol("SMP ID type"), new DTCol("Production?"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final ISMLConfiguration aCurObject : aSMLConfigurationMgr.getAll()) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(aCurObject.getID());
        aRow.addCell(new HCA(aViewLink).addChild(aCurObject.getDisplayName()));
        aRow.addCell(aCurObject.getDNSZone());
        aRow.addCell(aCurObject.getManagementServiceURL());
        aRow.addCell(EPhotonCoreText.getYesOrNo(aCurObject.isClientCertificateRequired(), aDisplayLocale));
        aRow.addCell(aCurObject.getSMPAPIType().getDisplayName());
        aRow.addCell(aCurObject.getSMPIdentifierType().getDisplayName());
        aRow.addCell(EPhotonCoreText.getYesOrNo(aCurObject.isProduction(), 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.getDisplayName()) : 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) ISMLConfiguration(com.helger.peppol.domain.ISMLConfiguration) HCRow(com.helger.html.hc.html.tabular.HCRow) HCTable(com.helger.html.hc.html.tabular.HCTable) ISMLConfigurationManager(com.helger.peppol.app.mgr.ISMLConfigurationManager) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) HCTextNode(com.helger.html.hc.impl.HCTextNode) DataTables(com.helger.photon.uictrls.datatables.DataTables) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)

Aggregations

HCRow (com.helger.html.hc.html.tabular.HCRow)25 Locale (java.util.Locale)24 HCNodeList (com.helger.html.hc.impl.HCNodeList)23 DTCol (com.helger.photon.uictrls.datatables.column.DTCol)21 HCTable (com.helger.html.hc.html.tabular.HCTable)20 ISimpleURL (com.helger.commons.url.ISimpleURL)19 HCA (com.helger.html.hc.html.textlevel.HCA)19 BootstrapDTColAction (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction)18 BootstrapDataTables (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)17 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)16 DataTables (com.helger.photon.uictrls.datatables.DataTables)16 HCTextNode (com.helger.html.hc.impl.HCTextNode)11 PDTToString (com.helger.commons.datetime.PDTToString)8 Nonnull (javax.annotation.Nonnull)8 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)6 ICommonsList (com.helger.commons.collection.impl.ICommonsList)5 BootstrapButton (com.helger.photon.bootstrap4.button.BootstrapButton)5 PDTFromString (com.helger.commons.datetime.PDTFromString)4 ISMPServiceInformation (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformation)4 ISMPServiceInformationManager (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformationManager)4