use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class ValueSetRenderer method renderExpandGroup.
private void renderExpandGroup(HierarchicalTableGenerator gen, TableModel model, Extension ext, ConceptSetComponent inc, Map<String, ConceptDefinitionComponent> definitions) {
Row row = gen.new Row();
model.getRows().add(row);
row.setIcon("icon_entry_blue.png", "entry");
String code = ext.getExtensionString("code");
if (code != null) {
row.getCells().add(gen.new Cell(null, null, code, null, null));
row.getCells().add(gen.new Cell(null, null, getDisplayForCode(inc, code, definitions), null, null));
} else if (ext.hasId()) {
row.getCells().add(gen.new Cell(null, null, "(#" + ext.getId() + ")", null, null));
row.getCells().add(gen.new Cell(null, null, ext.getExtensionString("display"), null, null));
} else {
row.getCells().add(gen.new Cell(null, null, null, null, null));
row.getCells().add(gen.new Cell(null, null, ext.getExtensionString("display"), null, null));
}
for (Extension member : ext.getExtensionsByUrl("member")) {
Row subRow = gen.new Row();
row.getSubRows().add(subRow);
subRow.setIcon("icon_entry_blue.png", "entry");
String mc = member.getValue().primitiveValue();
// mc might be a reference to another expansion group - we check that first, or to a code in the compose
if (mc.startsWith("#")) {
// it's a reference by id
subRow.getCells().add(gen.new Cell(null, null, "(" + mc + ")", null, null));
subRow.getCells().add(gen.new Cell(null, null, "group reference by id", null, null));
} else {
Extension tgt = findTargetByCode(inc, mc);
if (tgt != null) {
subRow.getCells().add(gen.new Cell(null, null, mc, null, null));
subRow.getCells().add(gen.new Cell(null, null, "group reference by code", null, null));
} else {
subRow.getCells().add(gen.new Cell(null, null, mc, null, null));
subRow.getCells().add(gen.new Cell(null, null, getDisplayForCode(inc, mc, definitions), null, null));
}
}
}
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireResponseRenderer method renderAnswer.
public void renderAnswer(HierarchicalTableGenerator gen, ResourceWrapper q, Row r, BaseWrapper ans) throws UnsupportedEncodingException, IOException {
List<BaseWrapper> items;
Base b = ans.get("value[x]");
if (b == null) {
r.getCells().add(gen.new Cell(null, null, "null!", null, null));
} else if (b.isPrimitive()) {
r.getCells().add(gen.new Cell(null, null, b.primitiveValue(), null, null));
} else {
XhtmlNode x = new XhtmlNode(NodeType.Element, "span");
Cell cell = gen.new Cell(null, null, null, null, null);
Piece p = gen.new Piece("span");
p.getChildren().add(x);
cell.addPiece(p);
render(x, (DataType) b);
r.getCells().add(cell);
}
items = ans.children("item");
for (BaseWrapper si : items) {
renderTreeItem(gen, r.getSubRows(), q, si);
}
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireResponseRenderer method renderTree.
public boolean renderTree(XhtmlNode x, QuestionnaireResponse q) throws UnsupportedEncodingException, IOException {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
TableModel model = gen.new TableModel("qtree=" + q.getId(), true);
model.setAlternating(true);
model.setDocoImg(context.getSpecificationLink() + "help16.png");
model.setDocoRef(context.getSpecificationLink() + "formats.html#table");
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Definition"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Answer"), translate("sd.hint", "The type of the item"), null, 0));
boolean hasExt = false;
// first we add a root for the questionaire itself
Row row = addTreeRoot(gen, model.getRows(), q);
for (QuestionnaireResponseItemComponent i : q.getItem()) {
hasExt = renderTreeItem(gen, row.getSubRows(), q, i) || hasExt;
}
XhtmlNode xn = gen.generate(model, context.getLocalPrefix(), 1, null);
x.getChildNodes().add(xn);
return hasExt;
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireResponseRenderer method addTreeRoot.
private Row addTreeRoot(HierarchicalTableGenerator gen, List<Row> rows, ResourceWrapper q) throws IOException {
Row r = gen.new Row();
rows.add(r);
r.setIcon("icon_q_root.gif", "QuestionnaireResponseRoot");
r.getCells().add(gen.new Cell(null, null, q.getId(), null, null));
r.getCells().add(gen.new Cell(null, null, "", null, null));
r.getCells().add(gen.new Cell(null, null, "QuestionnaireResponse", null, null));
r.getCells().add(gen.new Cell(null, null, "", null, null));
return r;
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireResponseRenderer method addTreeRoot.
private Row addTreeRoot(HierarchicalTableGenerator gen, List<Row> rows, QuestionnaireResponse q) throws IOException {
Row r = gen.new Row();
rows.add(r);
r.setIcon("icon_q_root.gif", "QuestionnaireResponseRoot");
r.getCells().add(gen.new Cell(null, null, q.getId(), null, null));
r.getCells().add(gen.new Cell(null, null, "", null, null));
r.getCells().add(gen.new Cell(null, null, "QuestionnaireResponse", null, null));
r.getCells().add(gen.new Cell(null, null, "", null, null));
return r;
}
Aggregations