private void check(Cell c) throws FHIRException { boolean hasText = false; for (Piece p : c.pieces) if (!Utilities.noString(p.getText())) hasText = true; check(hasText, "Title cells must have text"); }
private XhtmlNode renderCell( XhtmlNode tr, Cell c, String name, String icon, String hint, List<Boolean> indents, boolean hasChildren, String anchor, String color, String imagePath) throws IOException { XhtmlNode tc = tr.addTag(name); tc.setAttribute("class", "hierarchy"); if (indents != null) { tc.addTag("img") .setAttribute("src", srcFor(imagePath, "tbl_spacer.png")) .setAttribute("style", "background-color: inherit") .setAttribute("class", "hierarchy") .setAttribute("alt", "."); tc.setAttribute( "style", "vertical-align: top; text-align : left; background-color: " + color + "; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(" + imagePath + checkExists(indents, hasChildren) + ")"); for (int i = 0; i < indents.size() - 1; i++) { if (indents.get(i)) tc.addTag("img") .setAttribute("src", srcFor(imagePath, "tbl_blank.png")) .setAttribute("style", "background-color: inherit") .setAttribute("class", "hierarchy") .setAttribute("alt", "."); else tc.addTag("img") .setAttribute("src", srcFor(imagePath, "tbl_vline.png")) .setAttribute("style", "background-color: inherit") .setAttribute("class", "hierarchy") .setAttribute("alt", "."); } if (!indents.isEmpty()) if (indents.get(indents.size() - 1)) tc.addTag("img") .setAttribute("src", srcFor(imagePath, "tbl_vjoin_end.png")) .setAttribute("style", "background-color: inherit") .setAttribute("class", "hierarchy") .setAttribute("alt", "."); else tc.addTag("img") .setAttribute("src", srcFor(imagePath, "tbl_vjoin.png")) .setAttribute("style", "background-color: inherit") .setAttribute("class", "hierarchy") .setAttribute("alt", "."); } else tc.setAttribute( "style", "vertical-align: top; text-align : left; background-color: " + color + "; padding:0px 4px 0px 4px"); if (!Utilities.noString(icon)) { XhtmlNode img = tc.addTag("img") .setAttribute("src", srcFor(imagePath, icon)) .setAttribute("class", "hierarchy") .setAttribute("style", "background-color: " + color + "; background-color: inherit") .setAttribute("alt", "."); if (hint != null) img.setAttribute("title", hint); tc.addText(" "); } for (Piece p : c.pieces) { if (!Utilities.noString(p.getTag())) { XhtmlNode tag = tc.addTag(p.getTag()); if (p.attributes != null) for (String n : p.attributes.keySet()) tag.setAttribute(n, p.attributes.get(n)); if (p.getHint() != null) tag.setAttribute("title", p.getHint()); addStyle(tag, p); } else if (!Utilities.noString(p.getReference())) { XhtmlNode a = addStyle(tc.addTag("a"), p); a.setAttribute("href", p.getReference()); if (!Utilities.noString(p.getHint())) a.setAttribute("title", p.getHint()); a.addText(p.getText()); } else { if (!Utilities.noString(p.getHint())) { XhtmlNode s = addStyle(tc.addTag("span"), p); s.setAttribute("title", p.getHint()); s.addText(p.getText()); } else if (p.getStyle() != null) { XhtmlNode s = addStyle(tc.addTag("span"), p); s.addText(p.getText()); } else tc.addText(p.getText()); } } if (!Utilities.noString(anchor)) tc.addTag("a").setAttribute("name", nmTokenize(anchor)).addText(" "); return tc; }