public XhtmlNode colspan(String n) { return setAttribute("colspan", n); }
public XhtmlNode table(String clss) { XhtmlNode res = addTag("table"); if (!Utilities.noString(clss)) res.setAttribute("class", clss); return res; }
private XhtmlNode addStyle(XhtmlNode node, Piece p) { if (p.getStyle() != null) node.setAttribute("style", p.getStyle()); return node; }
public XhtmlNode generate(TableModel model, String imagePath, int border, Set<String> outputTracker) throws IOException, FHIRException { checkModel(model); XhtmlNode table = new XhtmlNode(NodeType.Element, "table").setAttribute("border", Integer.toString(border)).setAttribute("cellspacing", "0").setAttribute("cellpadding", "0"); table.setAttribute("style", "border: " + border + "px #F0F0F0 solid; font-size: 11px; font-family: verdana; vertical-align: top;"); XhtmlNode tr = table.addTag("tr"); tr.setAttribute("style", "border: " + Integer.toString(1 + border) + "px #F0F0F0 solid; font-size: 11px; font-family: verdana; vertical-align: top;"); XhtmlNode tc = null; for (Title t : model.getTitles()) { tc = renderCell(tr, t, "th", null, null, null, false, null, "white", 0, imagePath, border, outputTracker); if (t.width != 0) tc.setAttribute("style", "width: "+Integer.toString(t.width)+"px"); tc.addTag("span").setAttribute("style", "float: right").addTag("a").setAttribute("title", "Legend for this format").setAttribute("href", model.getDocoRef()).addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg()); tr = table.addTag("tr"); tc = tr.addTag("td"); tc.setAttribute("class", "hierarchy"); tc.setAttribute("colspan", Integer.toString(model.getTitles().size())); tc.addTag("br"); XhtmlNode a = tc.addTag("a").setAttribute("title", translate("sd.doco", "Legend for this format")).setAttribute("href", model.getDocoRef()); if (model.getDocoImg() != null) a.addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg()); a.addText(" "+translate("sd.doco", "Documentation for this format"));
private XhtmlNode renderCell(XhtmlNode tr, Cell c, String name, String icon, String hint, List<Integer> indents, boolean hasChildren, String anchor, String color, int lineColor, String imagePath, int border, Set<String> outputTracker) 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+"; border: "+ border +"px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url("+imagePath+checkExists(indents, hasChildren, lineColor, outputTracker)+")"); for (int i = 0; i < indents.size()-1; i++) { switch (indents.get(i)) { case NEW_SLICER: case NEW_SLICE: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_blank.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case CONTINUE_REGULAR: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vline.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case CONTINUE_SLICER: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vline_slicer.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case CONTINUE_SLICE: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vline_slice.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; default: switch (indents.get(indents.size()-1)) { case NEW_REGULAR: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_end.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case NEW_SLICER: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_end_slicer.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", ".");
private void renderRow(XhtmlNode table, Row r, int indent, List<Integer> indents, String imagePath, int border, Set<String> outputTracker) throws IOException { XhtmlNode tr = table.addTag("tr"); String color = "white"; if (r.getColor() != null) color = r.getColor(); tr.setAttribute("style", "border: " + border + "px #F0F0F0 solid; 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, r.getLineColor(), imagePath, border, outputTracker); first = false; } table.addText("\r\n"); for (int i = 0; i < r.getSubRows().size(); i++) { Row c = r.getSubRows().get(i); List<Integer> ind = new ArrayList<Integer>(); ind.addAll(indents); if (i == r.getSubRows().size() - 1) { ind.add(r.getLineColor()*2); } else { ind.add(r.getLineColor()*2+1); } renderRow(table, c, indent+1, ind, imagePath, border, outputTracker); } }
public XhtmlNode colspan(String n) { return setAttribute("colspan", n); }
public XhtmlNode table(String clss) { XhtmlNode res = addTag("table"); if (!Utilities.noString(clss)) res.setAttribute("class", clss); return res; }
private XhtmlNode addStyle(XhtmlNode node, Piece p) { if (p.getStyle() != null) node.setAttribute("style", p.getStyle()); return node; }
public XhtmlNode generate(TableModel model, String imagePath, int border, Set<String> outputTracker) throws IOException, FHIRException { checkModel(model); XhtmlNode table = new XhtmlNode(NodeType.Element, "table").setAttribute("border", Integer.toString(border)).setAttribute("cellspacing", "0").setAttribute("cellpadding", "0"); table.setAttribute("style", "border: " + border + "px #F0F0F0 solid; font-size: 11px; font-family: verdana; vertical-align: top;"); XhtmlNode tr = table.addTag("tr"); tr.setAttribute("style", "border: " + Integer.toString(1 + border) + "px #F0F0F0 solid; font-size: 11px; font-family: verdana; vertical-align: top;"); XhtmlNode tc = null; for (Title t : model.getTitles()) { tc = renderCell(tr, t, "th", null, null, null, false, null, "white", 0, imagePath, border, outputTracker); if (t.width != 0) tc.setAttribute("style", "width: "+Integer.toString(t.width)+"px"); tc.addTag("span").setAttribute("style", "float: right").addTag("a").setAttribute("title", "Legend for this format").setAttribute("href", model.getDocoRef()).addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg()); tr = table.addTag("tr"); tc = tr.addTag("td"); tc.setAttribute("class", "hierarchy"); tc.setAttribute("colspan", Integer.toString(model.getTitles().size())); tc.addTag("br"); XhtmlNode a = tc.addTag("a").setAttribute("title", translate("sd.doco", "Legend for this format")).setAttribute("href", model.getDocoRef()); if (model.getDocoImg() != null) a.addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg()); a.addText(" "+translate("sd.doco", "Documentation for this format"));
private XhtmlNode renderCell(XhtmlNode tr, Cell c, String name, String icon, String hint, List<Integer> indents, boolean hasChildren, String anchor, String color, int lineColor, String imagePath, int border, Set<String> outputTracker) 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+"; border: "+ border +"px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url("+imagePath+checkExists(indents, hasChildren, lineColor, outputTracker)+")"); for (int i = 0; i < indents.size()-1; i++) { switch (indents.get(i)) { case NEW_SLICER: case NEW_SLICE: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_blank.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case CONTINUE_REGULAR: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vline.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case CONTINUE_SLICER: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vline_slicer.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case CONTINUE_SLICE: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vline_slice.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; default: switch (indents.get(indents.size()-1)) { case NEW_REGULAR: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_end.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case NEW_SLICER: tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_end_slicer.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", ".");
private void renderRow(XhtmlNode table, Row r, int indent, List<Integer> indents, String imagePath, int border, Set<String> outputTracker) throws IOException { XhtmlNode tr = table.addTag("tr"); String color = "white"; if (r.getColor() != null) color = r.getColor(); tr.setAttribute("style", "border: " + border + "px #F0F0F0 solid; 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, r.getLineColor(), imagePath, border, outputTracker); first = false; } table.addText("\r\n"); for (int i = 0; i < r.getSubRows().size(); i++) { Row c = r.getSubRows().get(i); List<Integer> ind = new ArrayList<Integer>(); ind.addAll(indents); if (i == r.getSubRows().size() - 1) { ind.add(r.getLineColor()*2); } else { ind.add(r.getLineColor()*2+1); } renderRow(table, c, indent+1, ind, imagePath, border, outputTracker); } }
private void analyseGroup(String indent, TransformContext context, StructureMap map, VariablesForProfiling vars, StructureMapGroupComponent group, StructureMapAnalysis result) throws Exception { log(indent+"Analyse Group : "+group.getName()); // todo: extends // todo: check inputs XhtmlNode tr = result.summary.addTag("tr").setAttribute("class", "diff-title"); XhtmlNode xs = tr.addTag("td"); XhtmlNode xt = tr.addTag("td"); for (StructureMapGroupInputComponent inp : group.getInput()) { if (inp.getMode() == StructureMapInputMode.SOURCE) noteInput(vars, inp, VariableMode.INPUT, xs); if (inp.getMode() == StructureMapInputMode.TARGET) noteInput(vars, inp, VariableMode.OUTPUT, xt); } for (StructureMapGroupRuleComponent r : group.getRule()) { analyseRule(indent+" ", context, map, vars, group, r, result); } }
result.summary = new XhtmlNode(NodeType.Element, "table").setAttribute("class", "grid"); XhtmlNode tr = result.summary.addTag("tr"); tr.addTag("td").addTag("b").addText("Source");