Search in sources :

Example 1 with ContainerTag

use of j2html.tags.ContainerTag in project midpoint by Evolveum.

the class HtmlReportDataWriter method createTableBox.

protected String createTableBox(String aggregatedData, CommonHtmlSupport support, boolean parseData) {
    StringBuilder table = new StringBuilder();
    String style = support.getCssStyleOfTable();
    String classes = support.getCssClassOfTable();
    ContainerTag div = TagCreator.div().withClasses("box-body", "no-padding").with(TagCreator.h1(support.getTableName(localizationService))).with(TagCreator.p(GenericSupport.getMessage(localizationService, CommonHtmlSupport.REPORT_GENERATED_ON, support.getActualTime())));
    String tableBox = TagCreator.div().withClasses("box", "boxed-table", classes).withStyle(style).with(div).render();
    tableBox = tableBox.substring(0, tableBox.length() - 6);
    String parsedData;
    if (parseData) {
        parsedData = parseAgregatedData(aggregatedData);
    } else {
        parsedData = aggregatedData;
    }
    table.append(tableBox).append("<table class=\"table table-striped table-hover table-bordered\">").append(parsedData).append("</table>").append("</div>");
    return table.toString();
}
Also used : ContainerTag(j2html.tags.ContainerTag)

Example 2 with ContainerTag

use of j2html.tags.ContainerTag in project midpoint by Evolveum.

the class HtmlReportDataWriter method formatColumn.

private ContainerTag formatColumn(List<String> values) {
    ContainerTag div = TagCreator.div().withStyle("white-space: pre-wrap");
    values.forEach((value) -> {
        if (div.getNumChildren() != 0) {
            div.with(TagCreator.br());
        }
        div.withText(value);
    });
    return div;
}
Also used : ContainerTag(j2html.tags.ContainerTag)

Example 3 with ContainerTag

use of j2html.tags.ContainerTag in project miso-lims by miso-lims.

the class NotificationManager method makeLibraryAliquotTable.

private static ContainerTag makeLibraryAliquotTable(Collection<TransferLibraryAliquot> transferLibraryAliquots) {
    ContainerTag headerRow = tr(makeTh("Alias"), makeTh("Barcode"), makeTh("Location"), makeTh("Platform"), makeTh("Type"), makeTh("i7 Index Name"), makeTh("i7 Index"), makeTh("i5 Index Name"), makeTh("i5 Index"), makeTh("Targeted Sequencing"));
    List<ContainerTag> rows = new ArrayList<>();
    List<TransferLibraryAliquot> sorted = sortByAlias(transferLibraryAliquots);
    for (TransferLibraryAliquot transferLibraryAliquot : sorted) {
        LibraryAliquot libraryAliquot = transferLibraryAliquot.getItem();
        Library library = libraryAliquot.getLibrary();
        List<DomContent> cells = new ArrayList<>();
        cells.add(makeTd(libraryAliquot.getAlias()));
        cells.add(makeTd(libraryAliquot.getIdentificationBarcode()));
        cells.add(makeTd(makeLocationLabel(transferLibraryAliquot)));
        cells.add(makeTd(library.getPlatformType().getKey()));
        cells.add(makeTd(library.getLibraryType().getDescription()));
        cells.add(makeTd(library.getIndex1() == null ? null : library.getIndex1().getName()));
        cells.add(makeTd(library.getIndex1() == null ? null : library.getIndex1().getSequence()));
        cells.add(makeTd(library.getIndex2() == null ? null : library.getIndex2().getName()));
        cells.add(makeTd(library.getIndex2() == null ? null : library.getIndex2().getSequence()));
        rows.add(tr().with(cells));
    }
    return makeTable(headerRow, rows);
}
Also used : TransferLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot) ArrayList(java.util.ArrayList) DomContent(j2html.tags.DomContent) ContainerTag(j2html.tags.ContainerTag) LibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.LibraryAliquot) TransferLibraryAliquot(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibraryAliquot) Library(uk.ac.bbsrc.tgac.miso.core.data.Library) TransferLibrary(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibrary)

Example 4 with ContainerTag

use of j2html.tags.ContainerTag in project miso-lims by miso-lims.

the class NotificationManager method sendFailedNotification.

private void sendFailedNotification(TransferNotification notification) throws EmailException {
    HtmlEmail email = new HtmlEmail();
    email.addTo(notification.getCreator().getEmail(), notification.getCreator().getFullName());
    email.setSubject("Transfer Notification Failed");
    ContainerTag error = p("Failed to send the following transfer notification to ").withText(notification.getRecipientName()).withText(" <").with(a(notification.getRecipientEmail()).withHref("mailto:" + notification.getRecipientEmail())).withText(">:");
    email.setHtmlMsg(makeTransferNotificationHtmlMessage(notification, error));
    sendMail(email);
}
Also used : HtmlEmail(org.apache.commons.mail.HtmlEmail) ContainerTag(j2html.tags.ContainerTag)

Example 5 with ContainerTag

use of j2html.tags.ContainerTag in project mapton by trixon.

the class BookmarkReport method getContent.

@Override
public ContainerTag getContent() {
    final TreeMap<String, ArrayList<MBookmark>> bookmarkCategories = new TreeMap<>();
    for (MBookmark bookmark : mManager.dbLoad("*", false)) {
        bookmarkCategories.computeIfAbsent(bookmark.getCategory(), k -> new ArrayList<>()).add(bookmark);
    }
    ContainerTag html = html(head(title(mName)), body(h1(mName), hr(), div(each(bookmarkCategories.keySet(), category -> div(h2(category), table(tr(th(Dict.NAME.toString()), th(Dict.DESCRIPTION.toString()), th("URL"), th(Dict.LATITUDE.toString()), th(Dict.LONGITUDE.toString())), tbody(each(filter(mManager.dbLoad(), bookmark -> bookmark.getCategory().equals(category)), bookmark -> tr(td(bookmark.getName()), td(StringUtils.defaultString(bookmark.getDescription())), td(StringUtils.defaultString(bookmark.getUrl())), td(String.format("%.6f", bookmark.getLatitude())), td(String.format("%.6f", bookmark.getLongitude())))))))))));
    return html;
}
Also used : MReportSystem(org.mapton.api.report.MReportSystem) Dict(se.trixon.almond.util.Dict) TreeMap(java.util.TreeMap) MBookmark(org.mapton.api.MBookmark) MBookmarkManager(org.mapton.api.MBookmarkManager) MReport(org.mapton.api.report.MReport) ServiceProvider(org.openide.util.lookup.ServiceProvider) TagCreator(j2html.TagCreator) StringUtils(org.apache.commons.lang3.StringUtils) ContainerTag(j2html.tags.ContainerTag) ArrayList(java.util.ArrayList) MBookmark(org.mapton.api.MBookmark) ArrayList(java.util.ArrayList) ContainerTag(j2html.tags.ContainerTag) TreeMap(java.util.TreeMap)

Aggregations

ContainerTag (j2html.tags.ContainerTag)125 Tag (j2html.tags.Tag)22 TagCreator.div (j2html.TagCreator.div)17 Inject (javax.inject.Inject)17 HtmlBundle (views.HtmlBundle)14 DomContent (j2html.tags.DomContent)12 List (java.util.List)12 Mav (io.datarouter.web.handler.mav.Mav)11 J2HtmlTable (io.datarouter.web.html.j2html.J2HtmlTable)10 DatarouterWebRequireJsV2 (io.datarouter.web.requirejs.DatarouterWebRequireJsV2)10 TagCreator (j2html.TagCreator)10 TagCreator.a (j2html.TagCreator.a)10 BaseHandler (io.datarouter.web.handler.BaseHandler)9 Bootstrap4PageFactory (io.datarouter.web.html.j2html.bootstrap4.Bootstrap4PageFactory)8 TagCreator.td (j2html.TagCreator.td)8 ArrayList (java.util.ArrayList)8 Scanner (io.datarouter.scanner.Scanner)7 LinkElement (views.components.LinkElement)7 Collectors (java.util.stream.Collectors)6 ClientId (io.datarouter.storage.client.ClientId)5