use of com.helger.photon.bootstrap4.nav.BootstrapTabBox in project phoss-directory by phax.
the class AbstractPagePublicSearch method createParticipantDetails.
@Nonnull
protected HCNodeList createParticipantDetails(@Nonnull final Locale aDisplayLocale, @Nonnull final String sParticipantID, @Nonnull final IParticipantIdentifier aParticipantID, final boolean bIsLoggedInUserAdministrator) {
final HCNodeList aDetails = new HCNodeList();
// Search document matching participant ID
final ICommonsList<PDStoredBusinessEntity> aResultDocs = PDMetaManager.getStorageMgr().getAllDocumentsOfParticipant(aParticipantID);
// Group by participant ID
final ICommonsMap<IParticipantIdentifier, ICommonsList<PDStoredBusinessEntity>> aGroupedDocs = PDStorageManager.getGroupedByParticipantID(aResultDocs);
if (aGroupedDocs.isEmpty())
LOGGER.error("No stored document matches participant identifier '" + sParticipantID + "' - cannot show details");
else {
if (aGroupedDocs.size() > 1)
LOGGER.warn("Found " + aGroupedDocs.size() + " entries for participant identifier '" + sParticipantID + "' - weird");
// Get the first one
final ICommonsList<PDStoredBusinessEntity> aStoredEntities = aGroupedDocs.getFirstValue();
// Details header
{
IHCNode aDetailsHeader = null;
final boolean bIsPeppolDefault = aParticipantID.hasScheme(PeppolIdentifierFactory.INSTANCE.getDefaultParticipantIdentifierScheme());
if (bIsPeppolDefault) {
final IParticipantIdentifierScheme aIIA = ParticipantIdentifierSchemeManager.getSchemeOfIdentifier(aParticipantID);
if (aIIA != null) {
final HCH1 aH1 = h1("Details for: " + aParticipantID.getValue());
if (StringHelper.hasText(aIIA.getSchemeAgency()))
aH1.addChild(small(" (" + aIIA.getSchemeAgency() + ")"));
aDetailsHeader = new BootstrapPageHeader().addChild(aH1);
}
}
if (aDetailsHeader == null) {
// Fallback
aDetailsHeader = BootstrapWebPageUIHandler.INSTANCE.createPageHeader("Details for " + sParticipantID);
}
aDetails.addChild(aDetailsHeader);
}
final BootstrapTabBox aTabBox = new BootstrapTabBox();
// Business information
{
final HCNodeList aOL = new HCNodeList();
int nIndex = 1;
for (final PDStoredBusinessEntity aStoredEntity : aStoredEntities) {
final BootstrapCard aCard = aOL.addAndReturnChild(new BootstrapCard());
aCard.addClass(CSS_CLASS_RESULT_PANEL);
if (aStoredEntities.size() > 1)
aCard.createAndAddHeader().addChild("Business information entity " + nIndex);
final BootstrapViewForm aViewForm = PDCommonUI.showBusinessInfoDetails(aStoredEntity, aDisplayLocale);
aViewForm.addFormGroup(new BootstrapFormGroup().setLabel("Full Peppol participant ID").setCtrl(code(sParticipantID)));
if (GlobalDebug.isDebugMode() || bIsLoggedInUserAdministrator) {
aViewForm.addChild(new HCHR());
aViewForm.addFormGroup(new BootstrapFormGroup().setLabel("[Debug] Creation DT").setCtrl(PDTToString.getAsString(aStoredEntity.getMetaData().getCreationDT(), aDisplayLocale)));
aViewForm.addFormGroup(new BootstrapFormGroup().setLabel("[Debug] Owner ID").setCtrl(code(aStoredEntity.getMetaData().getOwnerID())));
aViewForm.addFormGroup(new BootstrapFormGroup().setLabel("[Debug] Requesting Host").setCtrl(code(aStoredEntity.getMetaData().getRequestingHost())));
}
aCard.createAndAddBody().addChild(aViewForm);
++nIndex;
}
// Add whole list or just the first item?
final IHCNode aTabLabel = span("Business information ").addChild(badgePrimary(aStoredEntities.size()));
aTabBox.addTab("businessinfo", aTabLabel, aOL, true);
}
// Document types
{
final HCNodeList aDocTypeCtrl = new HCNodeList();
final ICommonsList<String> aNames = new CommonsArrayList<>();
for (final PDStoredBusinessEntity aStoredEntity : aStoredEntities) aNames.addAllMapped(aStoredEntity.names(), PDStoredMLName::getName);
aDocTypeCtrl.addChild(info("The following document types are supported by " + _getImplodedMapped(", ", " and ", aNames, x -> "'" + x + "'") + ":"));
HCOL aDocTypeOL = null;
final ICommonsList<IDocumentTypeIdentifier> aDocTypeIDs = aResultDocs.getFirst().documentTypeIDs().getSorted(IDocumentTypeIdentifier.comparator());
for (final IDocumentTypeIdentifier aDocTypeID : aDocTypeIDs) {
if (aDocTypeOL == null)
aDocTypeOL = aDocTypeCtrl.addAndReturnChild(new HCOL());
final HCLI aLI = aDocTypeOL.addItem();
aLI.addChild(NiceNameUI.getDocumentTypeID(aDocTypeID));
}
if (aDocTypeOL == null)
aDocTypeCtrl.addChild(warn("This participant does not support any document types!"));
aTabBox.addTab("doctypes", span("Supported document types ").addChild(badgePrimary(aDocTypeIDs.size())), aDocTypeCtrl, false);
}
aDetails.addChild(aTabBox);
}
return aDetails;
}
use of com.helger.photon.bootstrap4.nav.BootstrapTabBox in project phoss-smp by phax.
the class PageSecureCertificateInformation method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final ZonedDateTime aNowZDT = PDTFactory.getCurrentZonedDateTime();
final LocalDateTime aNowLDT = aNowZDT.toLocalDateTime();
final String sDirectoryName = SMPWebAppConfiguration.getDirectoryName();
if (aWPEC.hasAction(ACTION_RELOAD_KEYSTORE)) {
SMPKeyManager.reloadFromConfiguration();
aWPEC.postRedirectGetInternal(info("The keystore was updated from the configuration at " + DateTimeFormatter.ISO_DATE_TIME.format(aNowZDT) + ". The changes are reflected below."));
} else if (aWPEC.hasAction(ACTION_RELOAD_TRUSTSTORE)) {
SMPTrustManager.reloadFromConfiguration();
aWPEC.postRedirectGetInternal(info("The truststore was updated from the configuration at " + DateTimeFormatter.ISO_DATE_TIME.format(aNowZDT) + ". The changes are reflected below."));
} else if (aWPEC.hasAction(ACTION_RELOAD_DIRECTORY_CONFIGURATION)) {
PDClientConfiguration.reloadConfiguration();
aWPEC.postRedirectGetInternal(info("The " + sDirectoryName + " configuration was reloaded at " + DateTimeFormatter.ISO_DATE_TIME.format(aNowZDT) + ". The changes are reflected below."));
}
{
final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
aToolbar.addChild(new BootstrapButton().addChild("Reload keystore").setIcon(EDefaultIcon.REFRESH).setOnClick(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_RELOAD_KEYSTORE)));
aToolbar.addChild(new BootstrapButton().addChild("Reload truststore").setIcon(EDefaultIcon.REFRESH).setOnClick(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_RELOAD_TRUSTSTORE)));
if (SMPMetaManager.getSettings().isDirectoryIntegrationEnabled()) {
aToolbar.addChild(new BootstrapButton().addChild("Reload " + sDirectoryName + " configuration").setIcon(EDefaultIcon.REFRESH).setOnClick(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_RELOAD_DIRECTORY_CONFIGURATION)));
}
aNodeList.addChild(aToolbar);
}
final BootstrapTabBox aTabBox = aNodeList.addAndReturnChild(new BootstrapTabBox());
// SMP Key store
{
final HCNodeList aTab = new HCNodeList();
if (!SMPKeyManager.isKeyStoreValid()) {
aTab.addChild(error(SMPKeyManager.getInitializationError()));
} else {
// Successfully loaded private key
final SMPKeyManager aKeyMgr = SMPKeyManager.getInstance();
final KeyStore aKeyStore = aKeyMgr.getKeyStore();
if (aKeyStore != null) {
try {
int nKeyEntries = 0;
for (final String sAlias : CollectionHelper.newList(aKeyStore.aliases())) {
if (aKeyStore.isKeyEntry(sAlias))
nKeyEntries++;
}
if (nKeyEntries == 0)
aTab.addChild(error("Found no private key entry in the configured key store."));
else if (nKeyEntries > 1)
aTab.addChild(warn("The configured key store contains " + nKeyEntries + " key entries. It is highly recommended to have only the SMP key in the key store to avoid issues with the SML communication."));
} catch (final GeneralSecurityException ex) {
aTab.addChild(error("Error iterating key store.").addChild(SMPCommonUI.getTechnicalDetailsUI(ex)));
}
}
final PrivateKeyEntry aKeyEntry = aKeyMgr.getPrivateKeyEntry();
if (aKeyEntry != null) {
final Certificate[] aChain = aKeyEntry.getCertificateChain();
// Key store path and password are fine
aTab.addChild(success(div("Keystore is located at '" + SMPServerConfiguration.getKeyStorePath() + "' and was successfully loaded.")).addChild(div("The private key with the alias '" + SMPServerConfiguration.getKeyStoreKeyAlias() + "' was successfully loaded.")));
if (aChain.length > 0 && aChain[0] instanceof X509Certificate) {
final X509Certificate aHead = (X509Certificate) aChain[0];
final String sIssuer = aHead.getIssuerX500Principal().getName();
final EPredefinedCert eCert = EPredefinedCert.getFromIssuerOrNull(sIssuer);
if (eCert != null) {
if (eCert.isDeprecated())
aTab.addChild(warn("You are currently using a ").addChild(strong("deprecated")).addChild(" " + eCert.getName() + " certificate!"));
else
aTab.addChild(info("You are currently using a " + eCert.getName() + " certificate!"));
if (aChain.length != eCert.getCertificateTreeLength())
aTab.addChild(error("The private key should be a chain of " + eCert.getCertificateTreeLength() + " certificates but it has " + aChain.length + " certificates. Please ensure that the respective root certificates are contained correctly!"));
}
// else: we don't care
}
final String sAlias = SMPServerConfiguration.getKeyStoreKeyAlias();
final HCOL aOL = new HCOL();
for (final Certificate aCert : aChain) {
if (aCert instanceof X509Certificate) {
final X509Certificate aX509Cert = (X509Certificate) aCert;
final BootstrapTable aCertDetails = SMPCommonUI.createCertificateDetailsTable(sAlias, aX509Cert, aNowLDT, aDisplayLocale);
aOL.addItem(aCertDetails);
} else
aOL.addItem("The certificate is not an X.509 certificate! It is internally a " + ClassHelper.getClassName(aCert));
}
aTab.addChild(aOL);
}
}
aTabBox.addTab("keystore", "Keystore", aTab);
}
// SMP Trust store
{
final HCNodeList aTab = new HCNodeList();
if (!SMPTrustManager.isTrustStoreValid()) {
aTab.addChild(warn(SMPTrustManager.getInitializationError()));
} else {
// Successfully loaded trust store
final SMPTrustManager aTrustMgr = SMPTrustManager.getInstance();
final KeyStore aTrustStore = aTrustMgr.getTrustStore();
// Trust store path and password are fine
aTab.addChild(success(div("Truststore is located at '" + SMPServerConfiguration.getTrustStorePath() + "' and was successfully loaded.")));
final HCOL aOL = new HCOL();
try {
for (final String sAlias : CollectionHelper.newList(aTrustStore.aliases())) {
final Certificate aCert = aTrustStore.getCertificate(sAlias);
if (aCert instanceof X509Certificate) {
final X509Certificate aX509Cert = (X509Certificate) aCert;
final BootstrapTable aCertDetails = SMPCommonUI.createCertificateDetailsTable(sAlias, aX509Cert, aNowLDT, aDisplayLocale);
aOL.addItem(aCertDetails);
} else
aOL.addItem("The certificate is not an X.509 certificate! It is internally a " + ClassHelper.getClassName(aCert));
}
} catch (final GeneralSecurityException ex) {
aOL.addItem(error("Error iterating trust store.").addChild(SMPCommonUI.getTechnicalDetailsUI(ex)));
}
aTab.addChild(aOL);
}
aTabBox.addTab("truststore", "Truststore", aTab);
}
// Peppol Directory client certificate
if (SMPMetaManager.getSettings().isDirectoryIntegrationEnabled()) {
// Directory client keystore
{
final HCNodeList aTab = new HCNodeList();
final LoadedKeyStore aKeyStoreLR = PDClientConfiguration.loadKeyStore();
if (aKeyStoreLR.isFailure()) {
aTab.addChild(error(PeppolKeyStoreHelper.getLoadError(aKeyStoreLR)));
} else {
final String sKeyStorePath = PDClientConfiguration.getKeyStorePath();
final LoadedKey<KeyStore.PrivateKeyEntry> aKeyLoading = PDClientConfiguration.loadPrivateKey(aKeyStoreLR.getKeyStore());
if (aKeyLoading.isFailure()) {
aTab.addChild(success(div("Keystore is located at '" + sKeyStorePath + "' and was successfully loaded.")));
aTab.addChild(error(PeppolKeyStoreHelper.getLoadError(aKeyLoading)));
} else {
// Successfully loaded private key
final String sAlias = PDClientConfiguration.getKeyStoreKeyAlias();
final PrivateKeyEntry aKeyEntry = aKeyLoading.getKeyEntry();
final Certificate[] aChain = aKeyEntry.getCertificateChain();
// Key store path and password are fine
aTab.addChild(success(div("Keystore is located at '" + sKeyStorePath + "' and was successfully loaded.")).addChild(div("The private key with the alias '" + sAlias + "' was successfully loaded.")));
if (aChain.length > 0 && aChain[0] instanceof X509Certificate) {
final X509Certificate aHead = (X509Certificate) aChain[0];
final String sIssuer = aHead.getIssuerX500Principal().getName();
final EPredefinedCert eCert = EPredefinedCert.getFromIssuerOrNull(sIssuer);
if (eCert != null) {
if (eCert.isDeprecated()) {
aTab.addChild(warn("You are currently using a ").addChild(strong("deprecated")).addChild(" " + eCert.getName() + " certificate!"));
} else
aTab.addChild(info("You are currently using a " + eCert.getName() + " certificate!"));
if (aChain.length != eCert.getCertificateTreeLength())
aTab.addChild(error("The private key should be a chain of " + eCert.getCertificateTreeLength() + " certificates but it has " + aChain.length + " certificates. Please ensure that the respective root certificates are contained!"));
}
// else: we don't care
}
final HCOL aUL = new HCOL();
for (final Certificate aCert : aChain) {
if (aCert instanceof X509Certificate) {
final X509Certificate aX509Cert = (X509Certificate) aCert;
final BootstrapTable aCertDetails = SMPCommonUI.createCertificateDetailsTable(sAlias, aX509Cert, aNowLDT, aDisplayLocale);
aUL.addItem(aCertDetails);
} else
aUL.addItem("The certificate is not an X.509 certificate! It is internally a " + ClassHelper.getClassName(aCert));
}
aTab.addChild(aUL);
}
}
aTabBox.addTab("pdkeystore", sDirectoryName + " Keystore", aTab);
}
// Directory client truststore
{
final HCNodeList aTab = new HCNodeList();
final LoadedKeyStore aTrustStoreLR = PDClientConfiguration.loadTrustStore();
if (aTrustStoreLR.isFailure()) {
aTab.addChild(error(PeppolKeyStoreHelper.getLoadError(aTrustStoreLR)));
} else {
// Successfully loaded trust store
final String sTrustStorePath = PDClientConfiguration.getTrustStorePath();
final KeyStore aTrustStore = aTrustStoreLR.getKeyStore();
// Trust store path and password are fine
aTab.addChild(success(div("Truststore is located at '" + sTrustStorePath + "' and was successfully loaded.")));
final HCOL aOL = new HCOL();
try {
for (final String sAlias : CollectionHelper.newList(aTrustStore.aliases())) {
final Certificate aCert = aTrustStore.getCertificate(sAlias);
if (aCert instanceof X509Certificate) {
final X509Certificate aX509Cert = (X509Certificate) aCert;
final BootstrapTable aCertDetails = SMPCommonUI.createCertificateDetailsTable(sAlias, aX509Cert, aNowLDT, aDisplayLocale);
aOL.addItem(aCertDetails);
} else
aOL.addItem("The certificate is not an X.509 certificate! It is internally a " + ClassHelper.getClassName(aCert));
}
} catch (final GeneralSecurityException ex) {
aOL.addItem(error("Error iterating trust store.").addChild(SMPCommonUI.getTechnicalDetailsUI(ex)));
}
aTab.addChild(aOL);
}
aTabBox.addTab("pdtruststore", sDirectoryName + " Truststore", aTab);
}
}
}
use of com.helger.photon.bootstrap4.nav.BootstrapTabBox 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"));
}
use of com.helger.photon.bootstrap4.nav.BootstrapTabBox 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));
}
}
use of com.helger.photon.bootstrap4.nav.BootstrapTabBox in project phoss-smp by phax.
the class PageSecureSMLRegistration method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
if (!_canShowPage(aWPEC))
return;
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final FormErrorList aFormErrors = new FormErrorList();
final boolean bShowInput = true;
final ISMLInfo aDefaultSML = SMPMetaManager.getSettings().getSMLInfo();
final String sSMPID = SMPServerConfiguration.getSMLSMPID();
if (aDefaultSML != null) {
// Check if this SMP is already registered
final String sPublisherDNSName = sSMPID + "." + aDefaultSML.getPublisherDNSZone();
try {
final InetAddress aIA = InetAddress.getByName(sPublisherDNSName);
aNodeList.addChild(success(div("An SMP is already registered at the configured SML using the DNS name '" + sPublisherDNSName + "'. The determined IP address is " + aIA.getHostAddress())).addChild(div("Note: this can be a different machine than this one, if another SMP uses the same ID as this one (" + sSMPID + ")")));
} catch (final UnknownHostException ex) {
// continue
}
}
if (aWPEC.hasAction(CPageParam.ACTION_PERFORM)) {
if (aWPEC.hasSubAction(SUBACTION_SMP_REGISTER))
_registerSMPtoSML(aWPEC, aFormErrors);
else if (aWPEC.hasSubAction(SUBACTION_SMP_UPDATE))
_updateSMPatSML(aWPEC, aFormErrors);
else if (aWPEC.hasSubAction(SUBACTION_SMP_DELETE))
_deleteSMPfromSML(aWPEC, aFormErrors);
}
if (bShowInput) {
// Get default from configuration
final String sPhysicalAddress = SMPServerConfiguration.getSMLSMPIP();
final String sLogicalAddress = SMPServerConfiguration.getSMLSMPHostname();
String sDefaultPhysicalAddress = "";
String sDefaultLogicalAddress = "";
try {
final InetAddress aLocalHost = InetAddress.getLocalHost();
sDefaultPhysicalAddress = aLocalHost.getHostAddress();
sDefaultLogicalAddress = "http://" + aLocalHost.getCanonicalHostName();
} catch (final UnknownHostException ex) {
LOGGER.error("Error determining localhost address", ex);
}
final BootstrapTabBox aTabBox = new BootstrapTabBox();
final Predicate<ISMLInfo> aSMLFilter = ISMLInfo::isClientCertificateRequired;
// Register SMP at SML
{
final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC).setLeft(3);
aForm.addChild(info("Register this SMP to the SML. This must only be done once per SMP!"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_ID, aDefaultSML != null ? aDefaultSML.getID() : null), aDisplayLocale, aSMLFilter)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP ID").setCtrl(em(sSMPID)).setHelpText(HELPTEXT_SMP_ID));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Physical address").setCtrl(new HCEdit(new RequestField(FIELD_PHYSICAL_ADDRESS, sPhysicalAddress)).setPlaceholder("The IPv4 address of your SMP. E.g. 1.2.3.4")).setHelpText(TextHelper.getFormattedText(HELPTEXT_PHYSICAL_ADDRESS, sDefaultPhysicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_PHYSICAL_ADDRESS)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Logical address").setCtrl(new HCEdit(new RequestField(FIELD_LOGICAL_ADDRESS, sLogicalAddress)).setPlaceholder("The domain name of your SMP server. E.g. http://smp.example.org")).setHelpText(TextHelper.getFormattedText(HELPTEXT_LOGICAL_ADDRESS, sDefaultLogicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_LOGICAL_ADDRESS)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_REGISTER);
aToolbar.addSubmitButton("Register SMP at SML");
aTabBox.addTab("register", "Register SMP to SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_REGISTER));
}
// Update SMP at SML
{
final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC).setLeft(3);
aForm.addChild(info("Update this SMP at the SML. This must only be done when either the IP address or the host name of the SMP changed!"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_ID, aDefaultSML == null ? null : aDefaultSML.getID()), aDisplayLocale, aSMLFilter)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP ID").setCtrl(em(sSMPID)).setHelpText(HELPTEXT_SMP_ID));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Physical address").setCtrl(new HCEdit(new RequestField(FIELD_PHYSICAL_ADDRESS, sPhysicalAddress)).setPlaceholder("The IPv4 address of your SMP. E.g. 1.2.3.4")).setHelpText(TextHelper.getFormattedText(HELPTEXT_PHYSICAL_ADDRESS, sDefaultPhysicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_PHYSICAL_ADDRESS)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Logical address").setCtrl(new HCEdit(new RequestField(FIELD_LOGICAL_ADDRESS, sLogicalAddress)).setPlaceholder("The domain name of your SMP server. E.g. http://smp.example.org")).setHelpText(TextHelper.getFormattedText(HELPTEXT_LOGICAL_ADDRESS, sDefaultLogicalAddress)).setErrorList(aFormErrors.getListOfField(FIELD_LOGICAL_ADDRESS)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_UPDATE);
aToolbar.addSubmitButton("Update SMP at SML");
aTabBox.addTab("update", "Update SMP at SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_UPDATE));
}
// Delete SMP from SML
{
final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC).setLeft(3);
aForm.addChild(info("Delete this SMP from the SML."));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_ID, aDefaultSML == null ? null : aDefaultSML.getID()), aDisplayLocale, aSMLFilter)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP ID").setCtrl(em(sSMPID)).setHelpText(HELPTEXT_SMP_ID));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_DELETE);
aToolbar.addSubmitButton("Delete SMP from SML");
aTabBox.addTab("delete", "Delete SMP from SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_DELETE));
}
aNodeList.addChild(aTabBox);
}
}
Aggregations