public TableModel initNormalTable(String prefix, boolean isLogical) { TableModel model = new TableModel(); model.setDocoImg(prefix+"help16.png"); model.setDocoRef(prefix+"formats.html#table"); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Flags"), translate("sd.hint", "Information about the use of the element"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Card."), translate("sd.hint", "Minimum and Maximum # of times the the element can appear in the instance"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Type"), translate("sd.hint", "Reference to the type of the element"), null, 100)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Description & Constraints"), translate("sd.hint", "Additional information about the element"), null, 0)); if (isLogical) { model.getTitles().add(new Title(null, prefix+"structuredefinition.html#logical", "Implemented As", "How this logical data item is implemented in a concrete resource", null, 0)); } return model; }
model.getRows().add(r); String en; if (!full)
tr.setAttribute("style", "border: " + Integer.toString(1 + border) + "px #F0F0F0 solid; font-size: 11px; font-family: verdana; vertical-align: top;"); XhtmlNode tc = null; for (Title t : model.getTitles()) { tc = renderCell(tr, t, "th", null, null, null, false, null, "white", 0, imagePath, border, outputTracker); if (t.width != 0) tc.setAttribute("style", "width: "+Integer.toString(t.width)+"px"); if (tc != null && model.getDocoRef() != null) tc.addTag("span").setAttribute("style", "float: right").addTag("a").setAttribute("title", "Legend for this format").setAttribute("href", model.getDocoRef()).addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg()); for (Row r : model.getRows()) { renderRow(table, r, 0, new ArrayList<Integer>(), imagePath, border, outputTracker); if (model.getDocoRef() != null) { tr = table.addTag("tr"); tc = tr.addTag("td"); tc.setAttribute("class", "hierarchy"); tc.setAttribute("colspan", Integer.toString(model.getTitles().size())); tc.addTag("br"); XhtmlNode a = tc.addTag("a").setAttribute("title", translate("sd.doco", "Legend for this format")).setAttribute("href", model.getDocoRef()); if (model.getDocoImg() != null) a.addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg()); a.addText(" "+translate("sd.doco", "Documentation for this format"));
model.getRows().add(r); String en; if (!full)
model.getRows().add(r); r.getCells().add(gen.new Cell(null, defFile == null ? "" : defFile+"-definitions.html#extension."+ed.getName(), ed.getSnapshot().getElement().get(0).getIsModifier() ? "modifierExtension" : "extension", null, null)); r.getCells().add(gen.new Cell());
tr.setAttribute("style", "border: " + Integer.toString(1 + border) + "px #F0F0F0 solid; font-size: 11px; font-family: verdana; vertical-align: top;"); XhtmlNode tc = null; for (Title t : model.getTitles()) { tc = renderCell(tr, t, "th", null, null, null, false, null, "white", 0, imagePath, border, outputTracker); if (t.width != 0) tc.setAttribute("style", "width: "+Integer.toString(t.width)+"px"); if (tc != null && model.getDocoRef() != null) tc.addTag("span").setAttribute("style", "float: right").addTag("a").setAttribute("title", "Legend for this format").setAttribute("href", model.getDocoRef()).addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg()); for (Row r : model.getRows()) { renderRow(table, r, 0, new ArrayList<Integer>(), imagePath, border, outputTracker); if (model.getDocoRef() != null) { tr = table.addTag("tr"); tc = tr.addTag("td"); tc.setAttribute("class", "hierarchy"); tc.setAttribute("colspan", Integer.toString(model.getTitles().size())); tc.addTag("br"); XhtmlNode a = tc.addTag("a").setAttribute("title", translate("sd.doco", "Legend for this format")).setAttribute("href", model.getDocoRef()); if (model.getDocoImg() != null) a.addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg()); a.addText(" "+translate("sd.doco", "Documentation for this format"));
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) throws IOException, FHIRException { assert(diff != snapshot);// check it's ok to get rid of one of these HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); gen.setTranslator(getTranslator()); TableModel model = gen.initNormalTable(corePath, false); List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); List<StructureDefinition> profiles = new ArrayList<StructureDefinition>(); profiles.add(profile); if (list.isEmpty()) throw new FHIRException((diff ? "Differential" : "Snapshot") + " is empty generating hierarchical table for "+profile.getUrl()); 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); try { return gen.generate(model, imagePath, 0, outputTracker); } catch (org.hl7.fhir.exceptions.FHIRException e) { throw new FHIRException("Error generating table for profile " + profile.getUrl() + ": " + e.getMessage(), e); } }
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) throws IOException, FHIRException { assert(diff != snapshot);// check it's ok to get rid of one of these HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); gen.setTranslator(getTranslator()); TableModel model = gen.initNormalTable(corePath, false); List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); List<StructureDefinition> profiles = new ArrayList<StructureDefinition>(); profiles.add(profile); 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); try { return gen.generate(model, imagePath, 0, outputTracker); } catch (org.hl7.fhir.exceptions.FHIRException e) { throw new FHIRException(e.getMessage(), e); } }
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, true); gen.setTranslator(getTranslator()); TableModel model = gen.initGridTable(corePath); 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); } }
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); 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); } }
public TableModel initNormalTable(String prefix, boolean isLogical) { TableModel model = new TableModel(); model.setDocoImg(prefix+"help16.png"); model.setDocoRef(prefix+"formats.html#table"); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Flags"), translate("sd.hint", "Information about the use of the element"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Card."), translate("sd.hint", "Minimum and Maximum # of times the the element can appear in the instance"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Type"), translate("sd.hint", "Reference to the type of the element"), null, 100)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Description & Constraints"), translate("sd.hint", "Additional information about the element"), null, 0)); if (isLogical) { model.getTitles().add(new Title(null, prefix+"structuredefinition.html#logical", "Implemented As", "How this logical data item is implemented in a concrete resource", null, 0)); } return model; }
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); 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); }
private void checkModel(TableModel model) throws FHIRException { check(!model.getRows().isEmpty(), "Must have rows"); check(!model.getTitles().isEmpty(), "Must have titles"); for (Cell c : model.getTitles()) check(c); int i = 0; for (Row r : model.getRows()) { check(r, "rows", model.getTitles().size(), Integer.toString(i)); i++; } }
public TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical) { TableModel model = gen.new TableModel(); model.setDocoImg(prefix+"help16.png"); model.setDocoRef(prefix+"formats.html#table"); // todo: change to graph definition 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; }
public TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical) { TableModel model = gen.new TableModel(); model.setDocoImg(prefix+"help16.png"); model.setDocoRef(prefix+"formats.html#table"); // todo: change to graph definition 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; }
public TableModel initGridTable(String prefix) { TableModel model = new TableModel(); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The name of the element (Slice name in brackets). Mouse-over provides definition"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Card."), translate("sd.hint", "Minimum and Maximum # of times the the element can appear in the instance. Super-scripts indicate additional constraints on appearance"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Type"), translate("sd.hint", "Reference to the type of the element"), null, 100)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Constraints and Usage"), translate("sd.hint", "Fixed values, length limits, vocabulary bindings and other usage notes"), null, 0)); return model; }
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) throws IOException, FHIRException { assert(diff != snapshot);// check it's ok to get rid of one of these HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); gen.setTranslator(getTranslator()); TableModel model = gen.initNormalTable(corePath, false); List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); List<StructureDefinition> profiles = new ArrayList<StructureDefinition>(); profiles.add(profile); if (list.isEmpty()) throw new FHIRException((diff ? "Differential" : "Snapshot") + " is empty generating hierarchical table for "+profile.getUrl()); 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); try { return gen.generate(model, imagePath, 0, outputTracker); } catch (org.hl7.fhir.exceptions.FHIRException e) { throw new FHIRException("Error generating table for profile " + profile.getUrl() + ": " + e.getMessage(), e); } }
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, true); gen.setTranslator(getTranslator()); TableModel model = gen.initGridTable(corePath); 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); } }
private void checkModel(TableModel model) throws FHIRException { check(!model.getRows().isEmpty(), "Must have rows"); check(!model.getTitles().isEmpty(), "Must have titles"); for (Cell c : model.getTitles()) check(c); int i = 0; for (Row r : model.getRows()) { check(r, "rows", model.getTitles().size(), Integer.toString(i)); i++; } }
public TableModel initGridTable(String prefix) { TableModel model = new TableModel(); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The name of the element (Slice name in brackets). Mouse-over provides definition"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Card."), translate("sd.hint", "Minimum and Maximum # of times the the element can appear in the instance. Super-scripts indicate additional constraints on appearance"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Type"), translate("sd.hint", "Reference to the type of the element"), null, 100)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Constraints and Usage"), translate("sd.hint", "Fixed values, length limits, vocabulary bindings and other usage notes"), null, 0)); return model; }