use of com.helger.html.hc.html.tabular.HCTable 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."));
}
}
use of com.helger.html.hc.html.tabular.HCTable 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);
}
use of com.helger.html.hc.html.tabular.HCTable 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));
}
use of com.helger.html.hc.html.tabular.HCTable 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);
}
use of com.helger.html.hc.html.tabular.HCTable 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);
}
Aggregations