use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method initSpanningTable.
public TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical, String id) {
TableModel model = gen.new TableModel(id, true);
model.setDocoImg(prefix + "help16.png");
// todo: change to graph definition
model.setDocoRef(Utilities.pathURL(prefix, "formats.html#table"));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), "Property", "A profiled resource", null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), "Card.", "Minimum and Maximum # of times the the element can appear in the instance", null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), "Content", "What goes here", null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), "Description", "Description of the profile", null, 0));
return model;
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method generateTable.
public XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set<String> outputTracker, boolean active, boolean mustSupport, RenderingContext rc) throws IOException, FHIRException {
// check it's ok to get rid of one of these
assert (diff != snapshot);
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
gen.setTranslator(getTranslator());
TableModel model = gen.initNormalTable(corePath, false, true, profile.getId() + (diff ? "d" : "s"), active);
List<ElementDefinition> list = new ArrayList<>();
if (diff)
list.addAll(profile.getDifferential().getElement());
else
list.addAll(profile.getSnapshot().getElement());
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
profiles.add(profile);
if (list.isEmpty()) {
ElementDefinition root = new ElementDefinition().setPath(profile.getType());
root.setId(profile.getType());
list.add(root);
} else {
if (list.get(0).getPath().contains(".")) {
ElementDefinition root = new ElementDefinition().setPath(profile.getType());
root.setId(profile.getType());
list.add(0, root);
}
}
if (diff) {
insertMissingSparseElements(list);
}
genElement(defFile == null ? null : defFile + "#", gen, model.getRows(), list.get(0), list, profiles, diff, profileBaseFileName, null, snapshot, corePath, imagePath, true, logicalModel, profile.getDerivation() == TypeDerivationRule.CONSTRAINT && usesMustSupport(list), allInvariants, null, mustSupport, rc);
try {
return gen.generate(model, imagePath, 0, outputTracker);
} catch (org.hl7.fhir.exceptions.FHIRException e) {
throw new FHIRException(context.formatMessage(I18nConstants.ERROR_GENERATING_TABLE_FOR_PROFILE__, profile.getUrl(), e.getMessage()), e);
}
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method generateSpanningTable.
public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set<String> outputTracker) throws IOException, FHIRException {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false, true);
gen.setTranslator(getTranslator());
TableModel model = initSpanningTable(gen, "", false, profile.getId());
Set<String> processed = new HashSet<String>();
SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix);
genSpanEntry(gen, model.getRows(), span);
return gen.generate(model, "", 0, outputTracker);
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method generateGrid.
public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set<String> outputTracker) throws IOException, FHIRException {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
gen.setTranslator(getTranslator());
TableModel model = gen.initGridTable(corePath, profile.getId());
List<ElementDefinition> list = profile.getSnapshot().getElement();
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
profiles.add(profile);
genGridElement(defFile == null ? null : defFile + "#", gen, model.getRows(), list.get(0), list, profiles, true, profileBaseFileName, null, corePath, imagePath, true, profile.getDerivation() == TypeDerivationRule.CONSTRAINT && usesMustSupport(list));
try {
return gen.generate(model, imagePath, 1, outputTracker);
} catch (org.hl7.fhir.exceptions.FHIRException e) {
throw new FHIRException(e.getMessage(), e);
}
}
use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method generateSpanningTable.
public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set<String> outputTracker) throws IOException, FHIRException {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false);
gen.setTranslator(getTranslator());
TableModel model = initSpanningTable(gen, "", false, profile.getId());
Set<String> processed = new HashSet<String>();
SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix);
genSpanEntry(gen, model.getRows(), span);
return gen.generate(model, "", 0, outputTracker);
}
Aggregations