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

The following examples show how to use org.hl7.fhir.utilities.xhtml.XhtmlNode#table() . 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: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
private void generateProperties(XhtmlNode x, CodeSystem cs, String lang) {
  if (cs.hasProperty()) {
    x.para().b().tx(context.translator().translate("xhtml-gen-cs", "Properties", lang));
    XhtmlNode tbl = x.table("grid");
    XhtmlNode tr = tbl.tr();
    tr.td().b().tx(context.translator().translate("xhtml-gen-cs", "Code", lang));
    tr.td().b().tx(context.translator().translate("xhtml-gen-cs", "URL", lang));
    tr.td().b().tx(context.translator().translate("xhtml-gen-cs", "Description", lang));
    tr.td().b().tx(context.translator().translate("xhtml-gen-cs", "Type", lang));
    for (PropertyComponent p : cs.getProperty()) {
      tr = tbl.tr();
      tr.td().tx(p.getCode());
      tr.td().tx(p.getUri());
      tr.td().tx(p.getDescription());
      tr.td().tx(p.hasType() ? p.getType().toCode() : "");
    }
  }
}
 
Example 2
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
private void generateProperties(XhtmlNode x, CodeSystem cs) {
  if (cs.hasProperty()) {
    x.para().b().tx("Properties");
    XhtmlNode tbl = x.table("grid");
    XhtmlNode tr = tbl.tr();
    tr.td().b().tx("Code");
    tr.td().b().tx("URL");
    tr.td().b().tx("Description");
    tr.td().b().tx("Type");
    for (PropertyComponent p : cs.getProperty()) {
      tr = tbl.tr();
      tr.td().tx(p.getCode());
      tr.td().tx(p.getUri());
      tr.td().tx(p.getDescription());
      tr.td().tx(p.hasType() ? p.getType().toCode() : "");
    }
  }
}
 
Example 3
Source File: ResourceComparer.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public XhtmlNode renderErrors(ResourceComparison csc) {
  XhtmlNode div = new XhtmlNode(NodeType.Element, "div");
  XhtmlNode tbl = div.table("grid");
  for (ValidationMessage vm : csc.messages) {
    XhtmlNode tr = tbl.tr();
    tr.style("background-color: "+colorForLevel(vm.getLevel()));
    tr.td().tx(vm.getLocation());
    tr.td().tx(vm.getMessage());
    tr.td().tx(vm.getLevel().getDisplay());
  }
  return div;
}
 
Example 4
Source File: CapabilityStatementUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private XhtmlNode startTable(XhtmlNode x, CapabilityStatement self, CapabilityStatement other) {
  XhtmlNode tbl = x.table("grid");    
  XhtmlNode tr = tbl.tr();
  tr.td().b().nbsp();
  tr.td().b().addText(selfName);
  tr.td().b().addText(otherName);
  tr.td().b().addText("Comparison");
  return tbl;
}
 
Example 5
Source File: QuestionnaireRenderer.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private boolean renderDefns(XhtmlNode x, Questionnaire q) throws IOException {
  XhtmlNode tbl = x.table("dict");
  boolean ext = false;
  for (QuestionnaireItemComponent qi : q.getItem()) {
    ext = renderDefinition(tbl, q, qi, new ArrayList<>()) || ext;
  }
  return ext;
}
 
Example 6
Source File: OperationDefinitionRenderer.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public boolean render(XhtmlNode x, OperationDefinition opd) throws IOException, FHIRException, EOperationOutcome {
  x.h2().addText(opd.getName());
  x.para().addText(Utilities.capitalize(opd.getKind().toString())+": "+opd.getName());
  x.para().tx("The official URL for this operation definition is: ");
  x.pre().tx(opd.getUrl());
  addMarkdown(x, opd.getDescription());

  if (opd.getSystem())
    x.para().tx("URL: [base]/$"+opd.getCode());
  for (CodeType c : opd.getResource()) {
    if (opd.getType())
      x.para().tx("URL: [base]/"+c.getValue()+"/$"+opd.getCode());
    if (opd.getInstance())
      x.para().tx("URL: [base]/"+c.getValue()+"/[id]/$"+opd.getCode());
  }

  x.para().tx("Parameters");
  XhtmlNode tbl = x.table( "grid");
  XhtmlNode tr = tbl.tr();
  tr.td().b().tx("Use");
  tr.td().b().tx("Name");
  tr.td().b().tx("Cardinality");
  tr.td().b().tx("Type");
  tr.td().b().tx("Binding");
  tr.td().b().tx("Documentation");
  for (OperationDefinitionParameterComponent p : opd.getParameter()) {
    genOpParam(tbl, "", p);
  }
  addMarkdown(x, opd.getComment());
  return true;
}
 
Example 7
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public boolean generate(ResourceContext rcontext, OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException {
   XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
   x.h2().addText(opd.getName());
   x.para().addText(Utilities.capitalize(opd.getKind().toString())+": "+opd.getName());
   x.para().tx("The official URL for this operation definition is: ");
   x.pre().tx(opd.getUrl());
   addMarkdown(x, opd.getDescription());

   if (opd.getSystem())
     x.para().tx("URL: [base]/$"+opd.getCode());
   for (CodeType c : opd.getResource()) {
     if (opd.getType())
       x.para().tx("URL: [base]/"+c.getValue()+"/$"+opd.getCode());
     if (opd.getInstance())
       x.para().tx("URL: [base]/"+c.getValue()+"/[id]/$"+opd.getCode());
   }

   x.para().tx("Parameters");
   XhtmlNode tbl = x.table( "grid");
   XhtmlNode tr = tbl.tr();
   tr.td().b().tx("Use");
   tr.td().b().tx("Name");
   tr.td().b().tx("Cardinality");
   tr.td().b().tx("Type");
   tr.td().b().tx("Binding");
   tr.td().b().tx("Documentation");
   for (OperationDefinitionParameterComponent p : opd.getParameter()) {
     genOpParam(rcontext, tbl, "", p);
   }
   addMarkdown(x, opd.getComment());
   inject(opd, x, NarrativeStatus.GENERATED);
   return true;
}
 
Example 8
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public boolean generate(ResourceContext rcontext, OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException {
   XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
   x.h2().addText(opd.getName());
   x.para().addText(Utilities.capitalize(opd.getKind().toString())+": "+opd.getName());
   x.para().tx("The official URL for this operation definition is: ");
   x.pre().tx(opd.getUrl());
   addMarkdown(x, opd.getDescription());

   if (opd.getSystem())
     x.para().tx("URL: [base]/$"+opd.getCode());
   for (CodeType c : opd.getResource()) {
     if (opd.getType())
       x.para().tx("URL: [base]/"+c.getValue()+"/$"+opd.getCode());
     if (opd.getInstance())
       x.para().tx("URL: [base]/"+c.getValue()+"/[id]/$"+opd.getCode());
   }

   x.para().tx("Parameters");
   XhtmlNode tbl = x.table( "grid");
   XhtmlNode tr = tbl.tr();
   tr.td().b().tx("Use");
   tr.td().b().tx("Name");
   tr.td().b().tx("Cardinality");
   tr.td().b().tx("Type");
   tr.td().b().tx("Binding");
   tr.td().b().tx("Documentation");
   for (OperationDefinitionParameterComponent p : opd.getParameter()) {
     genOpParam(rcontext, tbl, "", p);
   }
   addMarkdown(x, opd.getComment());
   inject(opd, x, NarrativeStatus.GENERATED);
   return true;
}
 
Example 9
Source File: DiagnosticReportRenderer.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void buildObservationsTable(XhtmlNode root, List<ObservationNode> observations) {
  XhtmlNode tbl = root.table( "none");
  for (ObservationNode o : observations) {
    addObservationToTable(tbl, o, 0);
  }
}
 
Example 10
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private boolean generateComposition(ResourceContext rcontext, XhtmlNode x, ValueSet vs, boolean header, List<UsedConceptMap> maps) throws FHIRException, IOException {
 boolean hasExtensions = false;
  List<String> langs = new ArrayList<String>();

  if (header) {
    XhtmlNode h = x.h2();
    h.addText(vs.present());
    addMarkdown(x, vs.getDescription());
    if (vs.hasCopyrightElement())
      generateCopyright(x, vs);
  }
  XhtmlNode p = x.para();
  p.tx("This value set includes codes from the following code systems:");

  XhtmlNode ul = x.ul();
  XhtmlNode li;
  for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
    hasExtensions = genInclude(rcontext, ul, inc, "Include", langs, maps) || hasExtensions;
  }
  for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
    hasExtensions = genInclude(rcontext, ul, exc, "Exclude", langs, maps) || hasExtensions;
  }

  // now, build observed languages

  if (langs.size() > 0) {
    Collections.sort(langs);
    x.para().b().tx("Additional Language Displays");
    XhtmlNode t = x.table( "codes");
    XhtmlNode tr = t.tr();
    tr.td().b().tx("Code");
    for (String lang : langs)
      tr.td().b().addText(describeLang(lang));
    for (ConceptSetComponent c : vs.getCompose().getInclude()) {
      for (ConceptReferenceComponent cc : c.getConcept()) {
        addLanguageRow(cc, t, langs);
      }
    }
  }

  return hasExtensions;
}
 
Example 11
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void buildObservationsTable(XhtmlNode root, List<ObservationNode> observations) {
  XhtmlNode tbl = root.table( "none");
  for (ObservationNode o : observations) {
    addObservationToTable(tbl, o, 0);
  }
}
 
Example 12
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private boolean generateComposition(ResourceContext rcontext, XhtmlNode x, ValueSet vs, boolean header) throws FHIRException, IOException {
 boolean hasExtensions = false;
  List<String> langs = new ArrayList<String>();

  if (header) {
    XhtmlNode h = x.h2();
    h.addText(vs.getName());
    addMarkdown(x, vs.getDescription());
    if (vs.hasCopyrightElement())
      generateCopyright(x, vs);
  }
  XhtmlNode p = x.para();
  p.tx("This value set includes codes from the following code systems:");

  XhtmlNode ul = x.ul();
  XhtmlNode li;
  for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
    hasExtensions = genInclude(rcontext, ul, inc, "Include", langs) || hasExtensions;
  }
  for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
    hasExtensions = genInclude(rcontext, ul, exc, "Exclude", langs) || hasExtensions;
  }

  // now, build observed languages

  if (langs.size() > 0) {
    Collections.sort(langs);
    x.para().b().tx("Additional Language Displays");
    XhtmlNode t = x.table( "codes");
    XhtmlNode tr = t.tr();
    tr.td().b().tx("Code");
    for (String lang : langs)
      tr.td().b().addText(describeLang(lang));
    for (ConceptSetComponent c : vs.getCompose().getInclude()) {
      for (ConceptReferenceComponent cc : c.getConcept()) {
        addLanguageRow(cc, t, langs);
      }
    }
  }

  return hasExtensions;
}
 
Example 13
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
public boolean generate(ResourceContext rcontext, CapabilityStatement conf) throws FHIRFormatError, DefinitionException, IOException {
  XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
  x.h2().addText(conf.getName());
  addMarkdown(x, conf.getDescription());
  if (conf.getRest().size() > 0) {
    CapabilityStatementRestComponent rest = conf.getRest().get(0);
    XhtmlNode t = x.table(null);
    addTableRow(t, "Mode", rest.getMode().toString());
    addTableRow(t, "Description", rest.getDocumentation());

    addTableRow(t, "Transaction", showOp(rest, SystemRestfulInteraction.TRANSACTION));
    addTableRow(t, "System History", showOp(rest, SystemRestfulInteraction.HISTORYSYSTEM));
    addTableRow(t, "System Search", showOp(rest, SystemRestfulInteraction.SEARCHSYSTEM));

    t = x.table(null);
    XhtmlNode tr = t.tr();
    tr.th().b().tx("Resource Type");
    tr.th().b().tx("Profile");
    tr.th().b().tx("Read");
    tr.th().b().tx("V-Read");
    tr.th().b().tx("Search");
    tr.th().b().tx("Update");
    tr.th().b().tx("Updates");
    tr.th().b().tx("Create");
    tr.th().b().tx("Delete");
    tr.th().b().tx("History");

    for (CapabilityStatementRestResourceComponent r : rest.getResource()) {
      tr = t.tr();
      tr.td().addText(r.getType());
      if (r.hasProfile()) {
        tr.td().ah(prefix+r.getProfile().getReference()).addText(r.getProfile().getReference());
      }
      tr.td().addText(showOp(r, TypeRestfulInteraction.READ));
      tr.td().addText(showOp(r, TypeRestfulInteraction.VREAD));
      tr.td().addText(showOp(r, TypeRestfulInteraction.SEARCHTYPE));
      tr.td().addText(showOp(r, TypeRestfulInteraction.UPDATE));
      tr.td().addText(showOp(r, TypeRestfulInteraction.HISTORYINSTANCE));
      tr.td().addText(showOp(r, TypeRestfulInteraction.CREATE));
      tr.td().addText(showOp(r, TypeRestfulInteraction.DELETE));
      tr.td().addText(showOp(r, TypeRestfulInteraction.HISTORYTYPE));
    }
  }

  inject(conf, x, NarrativeStatus.GENERATED);
  return true;
}
 
Example 14
Source File: NarrativeGenerator.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void buildObservationsTable(XhtmlNode root, List<ObservationNode> observations) {
  XhtmlNode tbl = root.table( "none");
  for (ObservationNode o : observations) {
    addObservationToTable(tbl, o, 0);
  }
}