use of com.helger.photon.uictrls.datatables.DataTables 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);
}
use of com.helger.photon.uictrls.datatables.DataTables 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);
}
use of com.helger.photon.uictrls.datatables.DataTables 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);
}
use of com.helger.photon.uictrls.datatables.DataTables 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);
}
}
use of com.helger.photon.uictrls.datatables.DataTables 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);
}
Aggregations