Java Code Examples for org.hl7.fhir.utilities.xhtml.XhtmlNode#td()

The following examples show how to use org.hl7.fhir.utilities.xhtml.XhtmlNode#td() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TerminologyRenderer.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
protected void addMapHeaders(XhtmlNode tr, List<UsedConceptMap> maps) throws FHIRFormatError, DefinitionException, IOException {
  for (UsedConceptMap m : maps) {
    XhtmlNode td = tr.td();
    XhtmlNode b = td.b();
    XhtmlNode a = b.ah(getContext().getSpecificationLink()+m.getLink());
    a.addText(m.getDetails().getName());
    if (m.getDetails().isDoDescription() && m.getMap().hasDescription())
      addMarkdown(td, m.getMap().getDescription());
  }
}
 
Example 2
Source File: DiagnosticReportRenderer.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void addObservationToTable(XhtmlNode tr, ResourceWrapper obs, int i) {
  // TODO Auto-generated method stub

  // code (+bodysite)
  XhtmlNode td = tr.td();
  PropertyWrapper pw = getProperty(obs, "code");
  if (valued(pw)) {
    render(td, pw.value());
  }
  pw = getProperty(obs, "bodySite");
  if (valued(pw)) {
    td.tx(" (");
    render(td, pw.value());
    td.tx(")");
  }

  // value / dataAbsentReason (in red)
  td = tr.td();
  pw = getProperty(obs, "value[x]");
  if (valued(pw)) {
    render(td, pw.value());
  }

  // units
  td = tr.td();
  td.tx("to do");

  // reference range
  td = tr.td();
  td.tx("to do");

  // flags (status other than F, interpretation, )
  td = tr.td();
  td.tx("to do");

  // issued if different to DR
  td = tr.td();
  td.tx("to do");
}
 
Example 3
Source File: ConceptMapRenderer.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public void renderCSDetailsLink(XhtmlNode tr, String url, boolean span2) {
  CodeSystem cs;
  XhtmlNode td;
  cs = getContext().getWorker().fetchCodeSystem(url);
  td = tr.td();
  if (span2) {
    td.colspan("2");
  }
  td.b().tx("Code");
  td.tx(" from ");
  if (cs == null)
    td.tx(url);
  else
    td.ah(context.fixReference(cs.getUserString("path"))).attribute("title", url).tx(cs.present());
}
 
Example 4
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public void renderCSDetailsLink(XhtmlNode tr, String url) {
  CodeSystem cs;
  XhtmlNode td;
  cs = context.fetchCodeSystem(url);
  td = tr.td();
  td.b().tx("Code");
  td.tx(" from ");
  if (cs == null)
    td.tx(url);
  else
    td.ah(cs.getUserString("path")).attribute("title", url).tx(cs.present());
}
 
Example 5
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void addMapHeaders(XhtmlNode tr, List<UsedConceptMap> maps) throws FHIRFormatError, DefinitionException, IOException {
 for (UsedConceptMap m : maps) {
 	XhtmlNode td = tr.td();
 	XhtmlNode b = td.b();
 	XhtmlNode a = b.ah(prefix+m.getLink());
    a.addText(m.getDetails().getName());
    if (m.getDetails().isDoDescription() && m.getMap().hasDescription())
      addMarkdown(td, m.getMap().getDescription());
 }
}
 
Example 6
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void addMapHeaders(XhtmlNode tr, Map<ConceptMap, String> mymaps) throws FHIRFormatError, DefinitionException, IOException {
 for (ConceptMap m : mymaps.keySet()) {
 	XhtmlNode td = tr.td();
 	XhtmlNode b = td.b();
 	XhtmlNode a = b.ah(prefix+mymaps.get(m));
    a.addText(m.getName());
    if (m.hasDescription())
      addMarkdown(td, m.getDescription());
 }
}
 
Example 7
Source File: NamingSystemRenderer.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private XhtmlNode row(XhtmlNode tbl, String name) {
  XhtmlNode tr = tbl.tr();
  XhtmlNode td = tr.td();
  td.tx(translate("ns.summary", name));
  return tr.td();
}
 
Example 8
Source File: ValueSetRenderer.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void addExpansionRowToTable(XhtmlNode t, ValueSetExpansionContainsComponent c, int i, boolean doLevel, boolean doSystem, boolean doDefinition, List<UsedConceptMap> maps, CodeSystem allCS, List<String> langs) {
  XhtmlNode tr = t.tr();
  XhtmlNode td = tr.td();

  String tgt = makeAnchor(c.getSystem(), c.getCode());
  td.an(tgt);

  if (doLevel) {
    td.addText(Integer.toString(i));
    td = tr.td();
  }
  String s = Utilities.padLeft("", '\u00A0', i*2);
  td.attribute("style", "white-space:nowrap").addText(s);
  addCodeToTable(c.getAbstract(), c.getSystem(), c.getCode(), c.getDisplay(), td);
  if (doSystem) {
    td = tr.td();
    td.addText(c.getSystem());
  }
  td = tr.td();
  if (c.hasDisplayElement())
    td.addText(c.getDisplay());

  if (doDefinition) {
    CodeSystem cs = allCS;
    if (cs == null)
      cs = getContext().getWorker().fetchCodeSystem(c.getSystem());
    td = tr.td();
    if (cs != null)
      td.addText(CodeSystemUtilities.getCodeDefinition(cs, c.getCode()));
  }
  for (UsedConceptMap m : maps) {
    td = tr.td();
    List<TargetElementComponentWrapper> mappings = findMappingsForCode(c.getCode(), m.getMap());
    boolean first = true;
    for (TargetElementComponentWrapper mapping : mappings) {
      if (!first)
          td.br();
      first = false;
      XhtmlNode span = td.span(null, mapping.comp.getRelationship().toString());
      span.addText(getCharForRelationship(mapping.comp));
      addRefToCode(td, mapping.group.getTarget(), m.getLink(), mapping.comp.getCode()); 
      if (!Utilities.noString(mapping.comp.getComment()))
        td.i().tx("("+mapping.comp.getComment()+")");
    }
  }
  for (Extension ext : c.getExtension()) {
    if (ToolingExtensions.EXT_TRANSLATION.equals(ext.getUrl())) {
      String lang = ToolingExtensions.readStringExtension(ext,  "lang");
      if (!Utilities.noString(lang) && !langs.contains(lang))
        langs.add(lang);
    }
  }
  for (ValueSetExpansionContainsComponent cc : c.getContains()) {
    addExpansionRowToTable(t, cc, i+1, doLevel, doSystem, doDefinition, maps, allCS, langs);
  }
}
 
Example 9
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void addExpansionRowToTable(XhtmlNode t, ValueSetExpansionContainsComponent c, int i, boolean doLevel, boolean doSystem, boolean doDefinition, List<UsedConceptMap> maps, CodeSystem allCS, List<String> langs) {
  XhtmlNode tr = t.tr();
  XhtmlNode td = tr.td();

  String tgt = makeAnchor(c.getSystem(), c.getCode());
  td.an(tgt);

  if (doLevel) {
    td.addText(Integer.toString(i));
    td = tr.td();
  }
  String s = Utilities.padLeft("", '\u00A0', i*2);
  td.attribute("style", "white-space:nowrap").addText(s);
  addCodeToTable(c.getAbstract(), c.getSystem(), c.getCode(), c.getDisplay(), td);
  if (doSystem) {
    td = tr.td();
    td.addText(c.getSystem());
  }
  td = tr.td();
  if (c.hasDisplayElement())
    td.addText(c.getDisplay());

  if (doDefinition) {
    CodeSystem cs = allCS;
    if (cs == null)
      cs = context.fetchCodeSystem(c.getSystem());
    td = tr.td();
    if (cs != null)
      td.addText(CodeSystemUtilities.getCodeDefinition(cs, c.getCode()));
  }
  for (UsedConceptMap m : maps) {
    td = tr.td();
    List<TargetElementComponentWrapper> mappings = findMappingsForCode(c.getCode(), m.getMap());
    boolean first = true;
    for (TargetElementComponentWrapper mapping : mappings) {
      if (!first)
          td.br();
      first = false;
      XhtmlNode span = td.span(null, mapping.comp.getEquivalence().toString());
      span.addText(getCharForEquivalence(mapping.comp));
      addRefToCode(td, mapping.group.getTarget(), m.getLink(), mapping.comp.getCode()); 
      if (!Utilities.noString(mapping.comp.getComment()))
        td.i().tx("("+mapping.comp.getComment()+")");
    }
  }
  for (Extension ext : c.getExtension()) {
    if (ToolingExtensions.EXT_TRANSLATION.equals(ext.getUrl())) {
      String lang = ToolingExtensions.readStringExtension(ext,  "lang");
      if (!Utilities.noString(lang) && !langs.contains(lang))
        langs.add(lang);
    }
  }
  for (ValueSetExpansionContainsComponent cc : c.getContains()) {
    addExpansionRowToTable(t, cc, i+1, doLevel, doSystem, doDefinition, maps, allCS, langs);
  }
}
 
Example 10
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void addObservationToTable(XhtmlNode tr, ResourceWrapper obs, int i) {
  // TODO Auto-generated method stub

  // code (+bodysite)
  XhtmlNode td = tr.td();
  PropertyWrapper pw = getProperty(obs, "result");
  if (valued(pw)) {
    displayCodeableConcept(td, pw.value());
  }
  pw = getProperty(obs, "bodySite");
  if (valued(pw)) {
    td.tx(" (");
    displayCodeableConcept(td, pw.value());
    td.tx(")");
  }

  // value / dataAbsentReason (in red)
  td = tr.td();
  pw = getProperty(obs, "value[x]");
  if (valued(pw)) {
    if (pw.getTypeCode().equals("CodeableConcept"))
      displayCodeableConcept(td, pw.value());
    else if (pw.getTypeCode().equals("string"))
      displayText(td, pw.value());
    else
      td.addText(pw.getTypeCode()+" not rendered yet");
  }

  // units
  td = tr.td();
  td.tx("to do");

  // reference range
  td = tr.td();
  td.tx("to do");

  // flags (status other than F, interpretation, )
  td = tr.td();
  td.tx("to do");

  // issued if different to DR
  td = tr.td();
  td.tx("to do");
}
 
Example 11
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void addExpansionRowToTable(XhtmlNode t, ValueSetExpansionContainsComponent c, int i, boolean doSystem, boolean doDefinition, Map<ConceptMap, String> mymaps, CodeSystem allCS, List<String> langs) {
  XhtmlNode tr = t.tr();
  XhtmlNode td = tr.td();

  String tgt = makeAnchor(c.getSystem(), c.getCode());
  td.an(tgt);

  String s = Utilities.padLeft("", '\u00A0', i*2);

  td.addText(s);
  addCodeToTable(c.getAbstract(), c.getSystem(), c.getCode(), c.getDisplay(), td);
  if (doSystem) {
    td = tr.td();
    td.addText(c.getSystem());
  }
  td = tr.td();
  if (c.hasDisplayElement())
    td.addText(c.getDisplay());

  if (doDefinition) {
    CodeSystem cs = allCS;
    if (cs == null)
      cs = context.fetchCodeSystem(c.getSystem());
    td = tr.td();
    if (cs != null)
      td.addText(CodeSystemUtilities.getCodeDefinition(cs, c.getCode()));
  }
  for (ConceptMap m : mymaps.keySet()) {
    td = tr.td();
    List<TargetElementComponentWrapper> mappings = findMappingsForCode(c.getCode(), m);
    boolean first = true;
    for (TargetElementComponentWrapper mapping : mappings) {
      if (!first)
          td.br();
      first = false;
      XhtmlNode span = td.span(null, mapping.comp.getEquivalence().toString());
      span.addText(getCharForEquivalence(mapping.comp));
      XhtmlNode a = td.ah(prefix+mymaps.get(m)+"#"+mapping.comp.getCode());
      a.addText(mapping.comp.getCode());
      if (!Utilities.noString(mapping.comp.getComment()))
        td.i().tx("("+mapping.comp.getComment()+")");
    }
  }
  for (Extension ext : c.getExtension()) {
    if (ToolingExtensions.EXT_TRANSLATION.equals(ext.getUrl())) {
      String lang = ToolingExtensions.readStringExtension(ext,  "lang");
      if (!Utilities.noString(lang) && !langs.contains(lang))
        langs.add(lang);
    }
  }
  for (ValueSetExpansionContainsComponent cc : c.getContains()) {
    addExpansionRowToTable(t, cc, i+1, doSystem, doDefinition, mymaps, allCS, langs);
  }
}
 
Example 12
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void addObservationToTable(XhtmlNode tr, ResourceWrapper obs, int i) {
  // TODO Auto-generated method stub

  // code (+bodysite)
  XhtmlNode td = tr.td();
  PropertyWrapper pw = getProperty(obs, "result");
  if (valued(pw)) {
    displayCodeableConcept(td, pw.value());
  }
  pw = getProperty(obs, "bodySite");
  if (valued(pw)) {
    td.tx(" (");
    displayCodeableConcept(td, pw.value());
    td.tx(")");
  }

  // value / dataAbsentReason (in red)
  td = tr.td();
  pw = getProperty(obs, "value[x]");
  if (valued(pw)) {
    if (pw.getTypeCode().equals("CodeableConcept"))
      displayCodeableConcept(td, pw.value());
    else if (pw.getTypeCode().equals("string"))
      displayText(td, pw.value());
    else
      td.addText(pw.getTypeCode()+" not rendered yet");
  }

  // units
  td = tr.td();
  td.tx("to do");

  // reference range
  td = tr.td();
  td.tx("to do");

  // flags (status other than F, interpretation, )
  td = tr.td();
  td.tx("to do");

  // issued if different to DR
  td = tr.td();
  td.tx("to do");
}