Search in sources :

Example 6 with DTCol

use of com.helger.photon.uictrls.datatables.column.DTCol in project phoss-smp by phax.

the class PageSecureServiceGroupMigrationInbound method _createTable.

@Nonnull
private IHCNode _createTable(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ICommonsIterable<ISMPParticipantMigration> aMigs, @Nonnull final EParticipantMigrationState eState) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCTable aTable = new HCTable(new DTCol("ID").setVisible(false), new DTCol("Participant ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Migration").setDisplayType(EDTColType.DATETIME, aDisplayLocale), new DTCol("Migration Key"), new BootstrapDTColAction(aDisplayLocale)).setID(getID() + eState.getID());
    for (final ISMPParticipantMigration aCurObject : aMigs) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final String sParticipantID = aCurObject.getParticipantIdentifier().getURIEncoded();
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(aCurObject.getID());
        aRow.addCell(a(aViewLink).addChild(sParticipantID));
        aRow.addCell(PDTToString.getAsString(aCurObject.getInitiationDateTime(), aDisplayLocale));
        aRow.addCell(code(aCurObject.getMigrationKey()));
        final IHCCell<?> aActionCell = aRow.addCell();
        aActionCell.addChild(createDeleteLink(aWPEC, aCurObject, "Delete Participant Migration of '" + sParticipantID + "'"));
    }
    final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
    return new HCNodeList().addChild(aTable).addChild(aDataTables);
}
Also used : Locale(java.util.Locale) HCTable(com.helger.html.hc.html.tabular.HCTable) ISMPParticipantMigration(com.helger.phoss.smp.domain.pmigration.ISMPParticipantMigration) HCNodeList(com.helger.html.hc.impl.HCNodeList) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) HCRow(com.helger.html.hc.html.tabular.HCRow) PDTToString(com.helger.commons.datetime.PDTToString) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) DataTables(com.helger.photon.uictrls.datatables.DataTables) Nonnull(javax.annotation.Nonnull)

Example 7 with DTCol

use of com.helger.photon.uictrls.datatables.column.DTCol in project phoss-smp 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 ISMLInfoManager aSMLInfoMgr = SMPMetaManager.getSMLInfoMgr();
    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("Name").setInitialSorting(ESortOrder.ASCENDING), new DTCol("DNS Zone"), new DTCol("Management Service URL"), new DTCol("Client Cert?"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final ISMLInfo aCurObject : aSMLInfoMgr.getAllSMLInfos()) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final HCRow aRow = aTable.addBodyRow();
        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(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) ISMLInfo(com.helger.peppol.sml.ISMLInfo) HCA(com.helger.html.hc.html.textlevel.HCA) 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) ISMLInfoManager(com.helger.phoss.smp.domain.sml.ISMLInfoManager) 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 8 with DTCol

use of com.helger.photon.uictrls.datatables.column.DTCol in project phoss-smp by phax.

the class PageSecureServiceGroupMigrationOutbound method _createTable.

@Nonnull
private IHCNode _createTable(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ICommonsIterable<ISMPParticipantMigration> aMigs, @Nonnull final EParticipantMigrationState eState) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCTable aTable = new HCTable(new DTCol("ID").setVisible(false), new DTCol("Participant ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Initiation").setDisplayType(EDTColType.DATETIME, aDisplayLocale), new DTCol("Migration Key"), new BootstrapDTColAction(aDisplayLocale)).setID(getID() + eState.getID());
    for (final ISMPParticipantMigration aCurObject : aMigs) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final String sParticipantID = aCurObject.getParticipantIdentifier().getURIEncoded();
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(aCurObject.getID());
        aRow.addCell(a(aViewLink).addChild(sParticipantID));
        aRow.addCell(PDTToString.getAsString(aCurObject.getInitiationDateTime(), aDisplayLocale));
        aRow.addCell(code(aCurObject.getMigrationKey()));
        final IHCCell<?> aActionCell = aRow.addCell();
        aActionCell.addChild(eState.isInProgress() ? new HCA(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_FINALIZE_MIGRATION).add(CPageParam.PARAM_OBJECT, aCurObject.getID())).setTitle("Finalize Participant Migration of '" + sParticipantID + "'").addChild(EDefaultIcon.YES.getAsNode()) : createEmptyAction());
        aActionCell.addChild(" ");
        aActionCell.addChild(eState.isInProgress() ? new HCA(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_CANCEL_MIGRATION).add(CPageParam.PARAM_OBJECT, aCurObject.getID())).setTitle("Cancel Participant Migration of '" + sParticipantID + "'").addChild(EDefaultIcon.NO.getAsNode()) : createEmptyAction());
        aActionCell.addChild(" ");
        aActionCell.addChild(createDeleteLink(aWPEC, aCurObject, "Delete Participant Migration of '" + sParticipantID + "'"));
    }
    final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
    return new HCNodeList().addChild(aTable).addChild(aDataTables);
}
Also used : Locale(java.util.Locale) HCTable(com.helger.html.hc.html.tabular.HCTable) ISMPParticipantMigration(com.helger.phoss.smp.domain.pmigration.ISMPParticipantMigration) HCNodeList(com.helger.html.hc.impl.HCNodeList) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISimpleURL(com.helger.commons.url.ISimpleURL) HCA(com.helger.html.hc.html.textlevel.HCA) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) HCRow(com.helger.html.hc.html.tabular.HCRow) PDTToString(com.helger.commons.datetime.PDTToString) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) DataTables(com.helger.photon.uictrls.datatables.DataTables) Nonnull(javax.annotation.Nonnull)

Example 9 with DTCol

use of com.helger.photon.uictrls.datatables.column.DTCol in project phoss-directory by phax.

the class PageSecureParticipantList 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 (aWPEC.hasAction(CPageParam.ACTION_DELETE)) {
        final String sParticipantID = aRequestScope.params().getAsString(FIELD_PARTICIPANT_ID);
        final IIdentifierFactory aIdentifierFactory = PDMetaManager.getIdentifierFactory();
        final IParticipantIdentifier aParticipantID = aIdentifierFactory.parseParticipantIdentifier(sParticipantID);
        if (aParticipantID != null) {
            boolean bSuccess = false;
            try {
                bSuccess = PDMetaManager.getStorageMgr().deleteEntry(aParticipantID, null, false) > 0;
            } catch (final IOException ex) {
            // ignore
            }
            if (bSuccess)
                aNodeList.addChild(info("The participant ID '" + aParticipantID.getURIEncoded() + "' was deleted"));
            else
                aNodeList.addChild(error("Error deleting participant ID '" + aParticipantID.getURIEncoded() + "'"));
        }
    }
    final ICommonsSortedMap<IParticipantIdentifier, MutableInt> aAllIDs = PDMetaManager.getStorageMgr().getAllContainedParticipantIDs(EQueryMode.NON_DELETED_ONLY);
    aNodeList.addChild(h3(aAllIDs.size() + " participants (=Business Cards) are contained"));
    int nMaxEntries;
    if (aWPEC.params().containsKey(PARAM_SHOW_ALL))
        nMaxEntries = Integer.MAX_VALUE;
    else {
        nMaxEntries = aWPEC.params().getAsInt(PARAM_MAX_ENTRIES, -1);
        if (nMaxEntries <= 0) {
            // Avoid negative entry count
            nMaxEntries = 500;
        }
        if (aAllIDs.size() > nMaxEntries) {
            aNodeList.addChild(info("Showing only the first " + nMaxEntries + " participant(s), to avoid too much load on the server. Use the parameter '" + PARAM_SHOW_ALL + "' to show all participants, or '" + PARAM_MAX_ENTRIES + "' to specify a maximum number of entries."));
        }
    }
    final HCTable aTable = new HCTable(new DTCol("ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Entities").setDisplayType(EDTColType.INT, aDisplayLocale), new BootstrapDTColAction()).setID(getID());
    for (final Map.Entry<IParticipantIdentifier, MutableInt> aEntry : aAllIDs.entrySet()) {
        final String sParticipantID = aEntry.getKey().getURIEncoded();
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(sParticipantID);
        aRow.addCell(Integer.toString(aEntry.getValue().intValue()));
        final IHCCell<?> aActionCell = aRow.addCell();
        final ISimpleURL aShowDetails = aWPEC.getLinkToMenuItem(CApplicationID.APP_ID_PUBLIC, CMenuPublic.MENU_SEARCH_SIMPLE).add(PagePublicSearchSimple.FIELD_QUERY, sParticipantID).add(CPageParam.PARAM_ACTION, CPageParam.ACTION_VIEW).add(PagePublicSearchSimple.FIELD_PARTICIPANT_ID, sParticipantID);
        aActionCell.addChild(new HCA(aShowDetails).addChild("Search"));
        aActionCell.addChild(" ");
        final ISimpleURL aReIndex = aWPEC.getLinkToMenuItem(CMenuSecure.MENU_INDEX_MANUALLY).add(PageSecureIndexManually.FIELD_PARTICIPANT_ID, sParticipantID).add(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
        aActionCell.addChild(new HCA(aReIndex).addChild("Reindex"));
        aActionCell.addChild(" ");
        final ISimpleURL aDelete = aWPEC.getSelfHref().add(FIELD_PARTICIPANT_ID, sParticipantID).add(CPageParam.PARAM_ACTION, CPageParam.ACTION_DELETE);
        aActionCell.addChild(new HCA(aDelete).addChild("Delete"));
        if (aTable.getBodyRowCount() >= nMaxEntries) {
            LOGGER.info("Stopping rendering after " + nMaxEntries + " entries");
            break;
        }
    }
    aNodeList.addChild(aTable).addChild(BootstrapDataTables.createDefaultDataTables(aWPEC, aTable));
}
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) IOException(java.io.IOException) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) HCTable(com.helger.html.hc.html.tabular.HCTable) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) MutableInt(com.helger.commons.mutable.MutableInt) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) IIdentifierFactory(com.helger.peppolid.factory.IIdentifierFactory) Map(java.util.Map) ICommonsSortedMap(com.helger.commons.collection.impl.ICommonsSortedMap) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 10 with DTCol

use of com.helger.photon.uictrls.datatables.column.DTCol in project phoss-directory by phax.

the class AbstractPageSecureReIndex method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    // Add toolbar
    {
        final BootstrapButtonToolbar aToolbar = aNodeList.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
        aToolbar.addChild(new BootstrapButton().addChild("Refresh").setIcon(EDefaultIcon.REFRESH).setOnClick(aWPEC.getSelfHref()));
        aToolbar.addChild(new BootstrapButton().addChild("Delete all entries").setIcon(EDefaultIcon.DELETE).setOnClick(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_DELETE_ALL)));
        aToolbar.addChild(span("Current server time: " + PDTToString.getAsString(PDTFactory.getCurrentLocalTime(), aDisplayLocale)).addClass(PDCommonUI.CSS_CLASS_VERTICAL_PADDED_TEXT));
    }
    final HCTable aTable = new HCTable(new DTCol("Reg date").setDisplayType(EDTColType.DATETIME, aDisplayLocale).setInitialSorting(ESortOrder.DESCENDING), new DTCol("Participant"), new DTCol("Action"), new DTCol("Retries").setDisplayType(EDTColType.INT, aDisplayLocale), m_bDeadIndex ? null : new DTCol("Next retry").setDisplayType(EDTColType.DATETIME, aDisplayLocale), new DTCol("Last retry").setDisplayType(EDTColType.DATETIME, aDisplayLocale), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final IReIndexWorkItem aItem : getReIndexWorkItemList().getAllItems()) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aItem);
        final IIndexerWorkItem aWorkItem = aItem.getWorkItem();
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(new HCA(aViewLink).addChild(PDTToString.getAsString(aWorkItem.getCreationDateTime(), aDisplayLocale)));
        aRow.addCell(aWorkItem.getParticipantID().getURIEncoded());
        aRow.addCell(aWorkItem.getType().getDisplayName());
        aRow.addCell(Integer.toString(aItem.getRetryCount()));
        if (!m_bDeadIndex)
            aRow.addCell(PDTToString.getAsString(aItem.getNextRetryDT(), aDisplayLocale));
        aRow.addCell(PDTToString.getAsString(aItem.getMaxRetryDT(), aDisplayLocale));
        final IHCCell<?> aActionCell = aRow.addCell();
        if (m_bDeadIndex) {
            aActionCell.addChild(new HCA(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_REINDEX_NOW).add(CPageParam.PARAM_OBJECT, aItem.getID())).setTitle("Re-index the entry now").addChild(EDefaultIcon.NEXT.getAsNode()));
            aActionCell.addChild(" ");
        }
        aActionCell.addChild(createDeleteLink(aWPEC, aItem));
    }
    aNodeList.addChild(aTable);
    aNodeList.addChild(BootstrapDataTables.createDefaultDataTables(aWPEC, aTable));
}
Also used : Locale(java.util.Locale) HCNodeList(com.helger.html.hc.impl.HCNodeList) IReIndexWorkItem(com.helger.pd.indexer.reindex.IReIndexWorkItem) HCA(com.helger.html.hc.html.textlevel.HCA) HCRow(com.helger.html.hc.html.tabular.HCRow) HCTable(com.helger.html.hc.html.tabular.HCTable) IIndexerWorkItem(com.helger.pd.indexer.index.IIndexerWorkItem) 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)

Aggregations

HCRow (com.helger.html.hc.html.tabular.HCRow)16 HCNodeList (com.helger.html.hc.impl.HCNodeList)16 DTCol (com.helger.photon.uictrls.datatables.column.DTCol)16 Locale (java.util.Locale)16 HCTable (com.helger.html.hc.html.tabular.HCTable)15 BootstrapDTColAction (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction)14 ISimpleURL (com.helger.commons.url.ISimpleURL)13 HCA (com.helger.html.hc.html.textlevel.HCA)13 BootstrapDataTables (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)12 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)11 DataTables (com.helger.photon.uictrls.datatables.DataTables)11 HCTextNode (com.helger.html.hc.impl.HCTextNode)6 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)5 PDTToString (com.helger.commons.datetime.PDTToString)4 Nonnull (javax.annotation.Nonnull)4 ICommonsList (com.helger.commons.collection.impl.ICommonsList)3 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)3 ISMPServiceInformation (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformation)3 ISMPServiceInformationManager (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformationManager)3 BootstrapButton (com.helger.photon.bootstrap4.button.BootstrapButton)3