Search in sources :

Example 6 with HCTable

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

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

the class PageSecureCRMGroup method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final CRMGroupManager aCRMGroupMgr = PPMetaManager.getCRMGroupMgr();
    // Toolbar on top
    final BootstrapButtonToolbar aToolbar = aNodeList.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
    aToolbar.addButtonNew("Create new CRM group", createCreateURL(aWPEC));
    // List existing
    final HCTable aTable = new HCTable(new DTCol("Name").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Sender email address"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final ICRMGroup aCurObject : aCRMGroupMgr.getAll()) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(new HCA(aViewLink).addChild(aCurObject.getDisplayName()));
        aRow.addCell(aCurObject.getSenderEmailAddress());
        aRow.addCell(createEditLink(aWPEC, aCurObject), new HCTextNode(" "), createCopyLink(aWPEC, aCurObject));
    }
    aNodeList.addChild(aTable);
    final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
    aNodeList.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) CRMGroupManager(com.helger.peppol.crm.CRMGroupManager) 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) ICRMGroup(com.helger.peppol.crm.ICRMGroup) DataTables(com.helger.photon.uictrls.datatables.DataTables) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)

Example 8 with HCTable

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

the class PageSecureCRMSubscriber method _getList.

@Nonnull
private IHCNode _getList(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final Collection<? extends ICRMSubscriber> aCRMSubscribers, @Nonnull final String sIDSuffix) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    // List existing
    final HCTable aTable = new HCTable(new DTCol("Name").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Email address"), new DTCol("Last Mod").setDisplayType(EDTColType.DATETIME, aDisplayLocale), new DTCol("Groups"), new BootstrapDTColAction(aDisplayLocale)).setID(getID() + sIDSuffix);
    for (final ICRMSubscriber aCurObject : aCRMSubscribers) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(new HCA(aViewLink).addChild(StringHelper.getConcatenatedOnDemand(aCurObject.getSalutationDisplayName(aDisplayLocale), " ", aCurObject.getName())));
        aRow.addCell(aCurObject.getEmailAddress());
        aRow.addCell(PDTToString.getAsString(aCurObject.hasLastModificationDateTime() ? aCurObject.getLastModificationDateTime() : aCurObject.getCreationDateTime(), aDisplayLocale));
        aRow.addCell(HCExtHelper.nl2divList(aCurObject.getAllAssignedGroups().stream().map(ICRMGroup::getDisplayName).collect(Collectors.joining("\n"))));
        final IHCCell<?> aActionCell = aRow.addCell();
        aActionCell.addChildren(createEditLink(aWPEC, aCurObject), new HCTextNode(" "), createCopyLink(aWPEC, aCurObject), new HCTextNode(" "));
        aActionCell.addChild(isActionAllowed(aWPEC, EWebPageFormAction.DELETE, aCurObject) ? createDeleteLink(aWPEC, aCurObject) : createEmptyAction());
    }
    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) 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) ICRMSubscriber(com.helger.peppol.crm.ICRMSubscriber) HCTextNode(com.helger.html.hc.impl.HCTextNode) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) DataTables(com.helger.photon.uictrls.datatables.DataTables) Nonnull(javax.annotation.Nonnull)

Example 9 with HCTable

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

the class PageSecureCommentAdmin method fillContent.

@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final CommentThreadManager aCommentThreadMgr = CommentThreadManager.getInstance();
    boolean bShowList = true;
    final String sSelectedObjectType = aWPEC.params().getAsString(PARAM_TYPE);
    final String sSelectedOwningObjectID = aWPEC.params().getAsString(CPageParam.PARAM_OBJECT);
    if (aWPEC.hasAction(CPageParam.ACTION_VIEW) && StringHelper.hasText(sSelectedObjectType) && StringHelper.hasText(sSelectedOwningObjectID)) {
        final TypedObject<String> aTO = TypedObject.create(new ObjectType(sSelectedObjectType), sSelectedOwningObjectID);
        final List<ICommentThread> aCommentThreads = aCommentThreadMgr.getAllCommentThreadsOfObject(aTO);
        if (!aCommentThreads.isEmpty()) {
            // Don't allow comment creation
            aNodeList.addChild(CommentUI.getCommentList(aWPEC, aTO, CommentAction.createGeneric(ECommentAction.NONE), null, null, false));
            // Toolbar
            final IButtonToolbar<?> aToolbar = new BootstrapButtonToolbar(aWPEC);
            aToolbar.addButton(EPhotonCoreText.BACK_TO_OVERVIEW.getDisplayText(aDisplayLocale), aWPEC.getSelfHref(), EDefaultIcon.BACK_TO_LIST);
            aNodeList.addChild(aToolbar);
            bShowList = false;
        }
    }
    if (bShowList) {
        // Refresh button
        final IButtonToolbar<?> aToolbar = new BootstrapButtonToolbar(aWPEC);
        aToolbar.addButton(EPhotonCoreText.BUTTON_REFRESH.getDisplayText(aDisplayLocale), aWPEC.getSelfHref(), EDefaultIcon.REFRESH);
        aNodeList.addChild(aToolbar);
        final ITabBox<?> aTabBox = new BootstrapTabBox();
        for (final ObjectType aOT : CollectionHelper.getSorted(aCommentThreadMgr.getAllRegisteredObjectTypes())) {
            final HCNodeList aTab = new HCNodeList();
            final HCTable aTable = new HCTable(new DTCol(EText.HEADER_OBJECT_ID.getDisplayText(aDisplayLocale)), new DTCol(EText.HEADER_THREADS.getDisplayText(aDisplayLocale)).addClass(CSS_CLASS_RIGHT).setDisplayType(EDTColType.INT, aDisplayLocale), new DTCol(EText.HEADER_COMMENTS.getDisplayText(aDisplayLocale)).addClass(CSS_CLASS_RIGHT).setDisplayType(EDTColType.INT, aDisplayLocale), new DTCol(EText.HEADER_ACTIVE_COMMENTS.getDisplayText(aDisplayLocale)).addClass(CSS_CLASS_RIGHT).setDisplayType(EDTColType.INT, aDisplayLocale), new DTCol(EText.HEADER_LAST_CHANGE.getDisplayText(aDisplayLocale)).addClass(CSS_CLASS_RIGHT).setDisplayType(EDTColType.DATETIME, aDisplayLocale).setInitialSorting(ESortOrder.DESCENDING)).setID(getID() + aOT.getName());
            final CommentThreadObjectTypeManager aCTOTMgr = aCommentThreadMgr.getManagerOfObjectType(aOT);
            for (final Map.Entry<String, ICommonsList<ICommentThread>> aEntry : aCTOTMgr.getAllCommentThreads().entrySet()) {
                final String sOwningObjectID = aEntry.getKey();
                final ISimpleURL aViewURL = AbstractWebPageForm.createViewURL(aWPEC, sOwningObjectID).add(PARAM_TYPE, aOT.getName());
                final HCRow aRow = aTable.addBodyRow();
                aRow.addCell(new HCA(aViewURL).addChild(sOwningObjectID));
                aRow.addCell(Integer.toString(aEntry.getValue().size()));
                int nActiveComments = 0;
                final ICommonsList<IComment> aAllComments = new CommonsArrayList<>();
                for (final ICommentThread aCommentThread : aEntry.getValue()) {
                    aAllComments.addAll(aCommentThread.getAllComments());
                    nActiveComments += aCommentThread.getTotalActiveCommentCount();
                }
                Collections.sort(aAllComments, Comparator.comparing(IComment::getLastChangeDateTime).reversed());
                aRow.addCell(Integer.toString(aAllComments.size()));
                aRow.addCell(Integer.toString(nActiveComments));
                if (aAllComments.isEmpty())
                    aRow.addCell();
                else
                    aRow.addCell(PDTToString.getAsString(aAllComments.get(0).getLastChangeDateTime(), aDisplayLocale));
            }
            aTab.addChild(aTable);
            final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
            aTab.addChild(aDataTables);
            aTabBox.addTab(aOT.getName(), aOT.getName(), aTab, aOT.getName().equals(sSelectedObjectType));
        }
        aNodeList.addChild(aTabBox);
    }
}
Also used : Locale(java.util.Locale) ICommonsList(com.helger.commons.collection.impl.ICommonsList) IComment(com.helger.peppol.comment.domain.IComment) HCNodeList(com.helger.html.hc.impl.HCNodeList) HCRow(com.helger.html.hc.html.tabular.HCRow) PDTToString(com.helger.commons.datetime.PDTToString) BootstrapTabBox(com.helger.photon.bootstrap4.nav.BootstrapTabBox) ICommentThread(com.helger.peppol.comment.domain.ICommentThread) ObjectType(com.helger.commons.type.ObjectType) CommentThreadObjectTypeManager(com.helger.peppol.comment.domain.CommentThreadObjectTypeManager) ISimpleURL(com.helger.commons.url.ISimpleURL) CommentThreadManager(com.helger.peppol.comment.domain.CommentThreadManager) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) DataTables(com.helger.photon.uictrls.datatables.DataTables) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables) HCA(com.helger.html.hc.html.textlevel.HCA) HCTable(com.helger.html.hc.html.tabular.HCTable) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) Map(java.util.Map) CommonsArrayList(com.helger.commons.collection.impl.CommonsArrayList)

Example 10 with HCTable

use of com.helger.html.hc.html.tabular.HCTable in project phoss-directory by phax.

the class PageSecureAdminSMLConfiguration method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMLInfoManager aSMLInfoMgr = PDPMetaManager.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.getAll()) {
        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.pd.publisher.app.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)

Aggregations

HCRow (com.helger.html.hc.html.tabular.HCRow)20 HCTable (com.helger.html.hc.html.tabular.HCTable)20 HCNodeList (com.helger.html.hc.impl.HCNodeList)20 DTCol (com.helger.photon.uictrls.datatables.column.DTCol)20 Locale (java.util.Locale)20 ISimpleURL (com.helger.commons.url.ISimpleURL)18 HCA (com.helger.html.hc.html.textlevel.HCA)18 BootstrapDTColAction (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction)18 BootstrapDataTables (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)17 DataTables (com.helger.photon.uictrls.datatables.DataTables)16 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)14 HCTextNode (com.helger.html.hc.impl.HCTextNode)10 PDTToString (com.helger.commons.datetime.PDTToString)5 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)5 Nonnull (javax.annotation.Nonnull)5 ICommonsList (com.helger.commons.collection.impl.ICommonsList)4 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 StringMap (com.helger.commons.collection.attr.StringMap)2