private void renderRow( XhtmlNode table, Row r, int indent, List<Boolean> indents, String imagePath) throws IOException { XhtmlNode tr = table.addTag("tr"); String color = "white"; if (r.getColor() != null) color = r.getColor(); tr.setAttribute( "style", "border: 0px; padding:0px; vertical-align: top; background-color: " + color + ";"); boolean first = true; for (Cell t : r.getCells()) { renderCell( tr, t, "td", first ? r.getIcon() : null, first ? r.getHint() : null, first ? indents : null, !r.getSubRows().isEmpty(), first ? r.getAnchor() : null, color, imagePath); first = false; } table.addText("\r\n"); for (int i = 0; i < r.getSubRows().size(); i++) { Row c = r.getSubRows().get(i); List<Boolean> ind = new ArrayList<Boolean>(); ind.addAll(indents); if (i == r.getSubRows().size() - 1) ind.add(true); else ind.add(false); renderRow(table, c, indent + 1, ind, imagePath); } }
private void check(Row r, String string, int size, String path) throws FHIRException { check( r.getCells().size() == size, "All rows must have the same number of columns (" + Integer.toString(size) + ") as the titles but row " + path + " doesn't (" + r.getCells().get(0).text() + ")"); int i = 0; for (Row c : r.getSubRows()) { check(c, "rows", size, path + "." + Integer.toString(i)); i++; } }