use of org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireRenderer method renderItemOptions.
public void renderItemOptions(XhtmlNode x, QuestionnaireItemComponent i) {
if (i.hasAnswerOption()) {
boolean useSelect = false;
for (QuestionnaireItemAnswerOptionComponent opt : i.getAnswerOption()) {
useSelect = useSelect || opt.getInitialSelected();
}
x.an("opt-item." + i.getLinkId());
x.para().b().tx("Answer options for " + i.getLinkId());
XhtmlNode ul = x.ul();
for (QuestionnaireItemAnswerOptionComponent opt : i.getAnswerOption()) {
XhtmlNode li = ul.li();
li.style("font-size: 11px");
if (useSelect) {
if (opt.getInitialSelected()) {
li.img("icon-selected.png");
} else {
li.img("icon-not-selected.png");
}
}
if (opt.getValue().isPrimitive()) {
li.tx(opt.getValue().primitiveValue());
} else if (opt.getValue() instanceof Coding) {
Coding c = (Coding) opt.getValue();
String link = c.hasSystem() ? context.getWorker().getLinkForUrl(context.getSpecificationLink(), c.getSystem()) : null;
if (link == null) {
li.tx(c.getSystem() + "#" + c.getCode());
} else {
li.ah(link).tx(describeSystem(c.getSystem()));
li.tx(": " + c.getCode());
}
if (c.hasDisplay()) {
li.tx(" (\"" + c.getDisplay() + "\")");
}
} else {
li.tx("??");
}
}
}
}
Aggregations