Search in sources :

Example 16 with ContainerTag

use of j2html.tags.ContainerTag in project nivio by dedica-team.

the class SVGBackgroundFactory method getHex.

public static ContainerTag getHex() {
    ContainerTag fullHex = (ContainerTag) new SVGHex(new Hex(0, 0), "none", "#cccccc").render();
    fullHex.attr("id", "hex");
    return fullHex;
}
Also used : Hex(de.bonndan.nivio.output.map.hex.Hex) ContainerTag(j2html.tags.ContainerTag)

Example 17 with ContainerTag

use of j2html.tags.ContainerTag in project nivio by dedica-team.

the class SVGBackgroundFactory method getBackgroundTiles.

/**
 * @param dimension svg dimesion, containing bounding boxes
 * @return a set of "use" references to a background hex
 */
public static List<ContainerTag> getBackgroundTiles(SVGDimension dimension) {
    // render background hexes
    List<ContainerTag> background = new ArrayList<>();
    var i = 0;
    // add extra space for relations being drawn outside of group areas (which define the outer borders)
    int horMin = dimension.hex.horMin - 1;
    int horMax = dimension.hex.horMax + 1;
    // why? without this bg hexes are displaced
    final int yOffset = Hex.HEX_SIZE / 4;
    for (int q = horMin; q <= horMax; q++) {
        // the correction "+verticalmax -q" is because q and r are not orthogonal like x and y
        for (int r = dimension.hex.vertMin - i; r < (horMax + dimension.hex.vertMax - q); r++) {
            Point2D.Double hex = new Hex(q, r).toPixel();
            int x = (int) hex.x - 2 * Hex.HEX_SIZE;
            float y = (float) round((hex.y - yOffset) * 10f) / 10f;
            if (y < dimension.cartesian.vertMin) {
                continue;
            }
            if (y > dimension.cartesian.vertMax) {
                continue;
            }
            ContainerTag use = SvgTagCreator.use("#" + HEX).attr("x", x).attr("y", y);
            background.add(use);
        }
        i++;
    }
    return background;
}
Also used : Point2D(java.awt.geom.Point2D) ArrayList(java.util.ArrayList) Hex(de.bonndan.nivio.output.map.hex.Hex) ContainerTag(j2html.tags.ContainerTag)

Example 18 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 19 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 20 with ContainerTag

use of j2html.tags.ContainerTag in project civiform by seattle-uat.

the class AwsFileUploadViewStrategy method renderFileUploadBottomNavButtons.

Tag renderFileUploadBottomNavButtons(Params params) {
    Optional<Tag> maybeContinueButton = maybeRenderContinueButton(params);
    Optional<ContainerTag> maybeSkipOrDeleteButton = maybeRenderSkipOrDeleteButton(params);
    ContainerTag ret = div().withClasses(ApplicantStyles.APPLICATION_NAV_BAR).with(div().withClasses(Styles.FLEX_GROW)).with(renderReviewButton(params));
    if (maybeSkipOrDeleteButton.isPresent()) {
        ret.with(maybeSkipOrDeleteButton.get());
    }
    ret.with(renderUploadButton(params));
    if (maybeContinueButton.isPresent()) {
        ret.with(maybeContinueButton.get());
    }
    return ret;
}
Also used : ContainerTag(j2html.tags.ContainerTag) Tag(j2html.tags.Tag) ContainerTag(j2html.tags.ContainerTag)

Aggregations

ContainerTag (j2html.tags.ContainerTag)150 Tag (j2html.tags.Tag)30 TagCreator.div (j2html.TagCreator.div)20 HtmlBundle (views.HtmlBundle)20 Inject (javax.inject.Inject)17 List (java.util.List)13 TagCreator (j2html.TagCreator)12 DomContent (j2html.tags.DomContent)12 Mav (io.datarouter.web.handler.mav.Mav)11 LinkElement (views.components.LinkElement)11 J2HtmlTable (io.datarouter.web.html.j2html.J2HtmlTable)10 DatarouterWebRequireJsV2 (io.datarouter.web.requirejs.DatarouterWebRequireJsV2)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 Optional (java.util.Optional)8 TagCreator.each (j2html.TagCreator.each)7 ZoneId (java.time.ZoneId)7