From 415193a792b6d38953e2a7d12c91b791443b8900 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sat, 14 Dec 2019 07:54:48 +1100 Subject: [PATCH] Start working on active tables, fix testing bug --- .../fhir/dstu2/utils/ProfileUtilities.java | 4 +- .../dstu2016may/utils/ProfileUtilities.java | 4 +- .../dstu3/conformance/ProfileUtilities.java | 12 ++-- .../fhir/r4/conformance/ProfileUtilities.java | 12 ++-- .../fhir/r5/conformance/ProfileUtilities.java | 14 ++--- .../fhir/r5/test/SnapShotGenerationTests.java | 4 +- .../xhtml/HierarchicalTableGenerator.java | 59 +++++++++++++------ 7 files changed, 67 insertions(+), 42 deletions(-) diff --git a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/utils/ProfileUtilities.java b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/utils/ProfileUtilities.java index cce79d0d3..b520a9c3b 100644 --- a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/utils/ProfileUtilities.java +++ b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/utils/ProfileUtilities.java @@ -1155,7 +1155,7 @@ public class ProfileUtilities { public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); - TableModel model = gen.initNormalTable(corePath, false, true); + TableModel model = gen.initNormalTable(corePath, false, true, ed.getId()); boolean deep = false; boolean vdeep = false; @@ -1419,7 +1419,7 @@ public class ProfileUtilities { public XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, Set outputTracker) throws IOException, FHIRException { assert(diff != snapshot);// check it's ok to get rid of one of these HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); - TableModel model = gen.initNormalTable(corePath, false, true); + TableModel model = gen.initNormalTable(corePath, false, true, profile.getId()+(diff ? "d" : "s")); List list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); List profiles = new ArrayList(); profiles.add(profile); diff --git a/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/ProfileUtilities.java b/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/ProfileUtilities.java index 45e4c9930..6242f9488 100644 --- a/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/ProfileUtilities.java +++ b/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/ProfileUtilities.java @@ -1156,7 +1156,7 @@ public class ProfileUtilities { public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); - TableModel model = gen.initNormalTable(corePath, false, true); + TableModel model = gen.initNormalTable(corePath, false, true, ed.getId()); boolean deep = false; boolean vdeep = false; @@ -1418,7 +1418,7 @@ public class ProfileUtilities { public XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, boolean logicalModel, Set outputTracker) throws IOException, FHIRException { assert(diff != snapshot);// check it's ok to get rid of one of these HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); - TableModel model = gen.initNormalTable(corePath, false, true); + TableModel model = gen.initNormalTable(corePath, false, true, profile.getId()+(diff ? "d" : "s")); List list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); List profiles = new ArrayList(); profiles.add(profile); diff --git a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java index a710f21ef..e9ea2d7b1 100644 --- a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java @@ -1593,7 +1593,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); gen.setTranslator(getTranslator()); - TableModel model = gen.initNormalTable(corePath, false, true); + TableModel model = gen.initNormalTable(corePath, false, true, ed.getId()); boolean deep = false; String m = ""; @@ -1962,7 +1962,7 @@ public class ProfileUtilities extends TranslatingUtilities { 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, true); + TableModel model = gen.initNormalTable(corePath, false, true, profile.getId()+(diff ? "d" : "s")); List list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); List profiles = new ArrayList(); profiles.add(profile); @@ -1978,7 +1978,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); gen.setTranslator(getTranslator()); - TableModel model = gen.initGridTable(corePath); + TableModel model = gen.initGridTable(corePath, profile.getId()); List list = profile.getSnapshot().getElement(); List profiles = new ArrayList(); profiles.add(profile); @@ -3455,7 +3455,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false); gen.setTranslator(getTranslator()); - TableModel model = initSpanningTable(gen, "", false); + TableModel model = initSpanningTable(gen, "", false, profile.getId()); Set processed = new HashSet(); SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix); @@ -3607,8 +3607,8 @@ public class ProfileUtilities extends TranslatingUtilities { } - public TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical) { - TableModel model = gen.new TableModel(); + public TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical, String id) { + TableModel model = gen.new TableModel(id); model.setDocoImg(prefix+"help16.png"); model.setDocoRef(prefix+"formats.html#table"); // todo: change to graph definition diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java index 5a819711a..7dfc077c6 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java @@ -2120,7 +2120,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); gen.setTranslator(getTranslator()); - TableModel model = gen.initNormalTable(corePath, false, true); + TableModel model = gen.initNormalTable(corePath, false, true, ed.getId()); boolean deep = false; String m = ""; @@ -2490,7 +2490,7 @@ public class ProfileUtilities extends TranslatingUtilities { 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, true); + TableModel model = gen.initNormalTable(corePath, false, true, profile.getId()+(diff ? "d" : "s")); List list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); List profiles = new ArrayList(); profiles.add(profile); @@ -2511,7 +2511,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); gen.setTranslator(getTranslator()); - TableModel model = gen.initGridTable(corePath); + TableModel model = gen.initGridTable(corePath, profile.getId()); List list = profile.getSnapshot().getElement(); List profiles = new ArrayList(); profiles.add(profile); @@ -4441,7 +4441,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false, true); gen.setTranslator(getTranslator()); - TableModel model = initSpanningTable(gen, "", false); + TableModel model = initSpanningTable(gen, "", false, profile.getId()); Set processed = new HashSet(); SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix); @@ -4594,8 +4594,8 @@ public class ProfileUtilities extends TranslatingUtilities { } - public TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical) { - TableModel model = gen.new TableModel(); + public TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical, String id) { + TableModel model = gen.new TableModel(id); model.setDocoImg(prefix+"help16.png"); model.setDocoRef(prefix+"formats.html#table"); // todo: change to graph definition diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java index 8f2398c35..b34f03f94 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java @@ -2467,7 +2467,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); gen.setTranslator(getTranslator()); - TableModel model = gen.initNormalTable(corePath, false, true); + TableModel model = gen.initNormalTable(corePath, false, true, ed.getId()); boolean deep = false; String m = ""; @@ -2597,7 +2597,7 @@ public class ProfileUtilities extends TranslatingUtilities { StructureDefinition bsd = context.fetchResource(StructureDefinition.class, profile.getBaseDefinition()); if (bsd != null) { if (bsd.hasUserData("path")) { - c.getPieces().add(gen.new Piece(bsd.getUserString("path"), bsd.getName(), null)); + c.getPieces().add(gen.new Piece(Utilities.isAbsoluteUrl(bsd.getUserString("path")) ? bsd.getUserString("path") : corePath +bsd.getUserString("path"), bsd.getName(), null)); } else { c.getPieces().add(gen.new Piece(null, bsd.getName(), null)); } @@ -2848,7 +2848,7 @@ public class ProfileUtilities extends TranslatingUtilities { 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, true); + TableModel model = gen.initNormalTable(corePath, false, true, profile.getId()+(diff ? "d" : "s")); List list = new ArrayList<>(); if (diff) list.addAll(profile.getDifferential().getElement()); @@ -2921,7 +2921,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); gen.setTranslator(getTranslator()); - TableModel model = gen.initGridTable(corePath); + TableModel model = gen.initGridTable(corePath, profile.getId()); List list = profile.getSnapshot().getElement(); List profiles = new ArrayList(); profiles.add(profile); @@ -4925,7 +4925,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set outputTracker) throws IOException, FHIRException { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false, true); gen.setTranslator(getTranslator()); - TableModel model = initSpanningTable(gen, "", false); + TableModel model = initSpanningTable(gen, "", false, profile.getId()); Set processed = new HashSet(); SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix); @@ -5078,8 +5078,8 @@ public class ProfileUtilities extends TranslatingUtilities { } - public TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical) { - TableModel model = gen.new TableModel(); + public TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical, String id) { + TableModel model = gen.new TableModel(id); model.setDocoImg(prefix+"help16.png"); model.setDocoRef(prefix+"formats.html#table"); // todo: change to graph definition diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnapShotGenerationTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnapShotGenerationTests.java index e1d89c3e2..cc1565d62 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnapShotGenerationTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnapShotGenerationTests.java @@ -175,9 +175,9 @@ public class SnapShotGenerationTests { if (!Utilities.noString(include)) included = (StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", include+".xml")); if (!Utilities.noString(register)) { - try { + if (TestingUtilities.findTestResource("r5", "snapshot-generation", register+".xml")) { included = (StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", register+".xml")); - } catch (Exception e) { + } else { included = (StructureDefinition) new JsonParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", register+".json")); } } diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java index 8f320c390..2c2f918a6 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java @@ -97,7 +97,8 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { public static final int CONTINUE_SLICER = 3; public static final int NEW_SLICE = 4; public static final int CONTINUE_SLICE = 5; - private static final String BACKGROUND_ALT_COLOR = "#F7F7F7"; + private static final String BACKGROUND_ALT_COLOR = "#F7F7F7"; + private static final boolean ACTIVE_TABLE = false; private static Map files = new HashMap(); @@ -377,6 +378,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { private String hint; private String color; private int lineColor; + private String id; public List getSubRows() { return subRows; @@ -414,16 +416,26 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { assert lineColor <= 2; this.lineColor = lineColor; } - - + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } } public class TableModel { + private String id; private List titles = new ArrayList<HierarchicalTableGenerator.Title>(); private List<Row> rows = new ArrayList<HierarchicalTableGenerator.Row>(); private String docoRef; private String docoImg; private boolean alternating; + + public TableModel(String id) { + super(); + this.id = id; + } public List<Title> getTitles() { return titles; } @@ -442,6 +454,9 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { public void setDocoImg(String docoImg) { this.docoImg = docoImg; } + public String getId() { + return id; + } } @@ -476,8 +491,8 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { this.makeTargets = makeTargets; } - public TableModel initNormalTable(String prefix, boolean isLogical, boolean alternating) { - TableModel model = new TableModel(); + public TableModel initNormalTable(String prefix, boolean isLogical, boolean alternating, String id) { + TableModel model = new TableModel(id); model.alternating = alternating; model.setDocoImg(prefix+"help16.png"); @@ -494,8 +509,8 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { } - public TableModel initGridTable(String prefix) { - TableModel model = new TableModel(); + public TableModel initGridTable(String prefix, String id) { + TableModel model = new TableModel(id); 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)); @@ -548,6 +563,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { color = BACKGROUND_ALT_COLOR; tr.setAttribute("style", "border: " + border + "px #F0F0F0 solid; padding:0px; vertical-align: top; background-color: "+color+";"); + tr.setAttribute("id", model.getId()+r.getId()); boolean first = true; for (Cell t : r.getCells()) { renderCell(tr, t, "td", first ? r.getIcon() : null, first ? r.getHint() : null, first ? indents : null, !r.getSubRows().isEmpty(), first ? r.getAnchor() : null, color, r.getLineColor(), imagePath, border, outputTracker); @@ -595,29 +611,31 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { throw new Error("Unrecognized indent level: " + indents.get(i)); } } - if (!indents.isEmpty()) + if (!indents.isEmpty()) { + String sfx = ACTIVE_TABLE && hasChildren ? "-open" : ""; switch (indents.get(indents.size()-1)) { case NEW_REGULAR: - tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_end.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); + tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_end"+sfx+".png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case NEW_SLICER: - tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_end_slicer.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); + tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_end_slicer"+sfx+".png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case NEW_SLICE: - tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_end_slice.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); + tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_end_slice"+sfx+".png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case CONTINUE_REGULAR: - tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); + tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin"+sfx+".png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case CONTINUE_SLICER: - tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_slicer.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); + tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_slicer"+sfx+".png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; case CONTINUE_SLICE: - tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_slice.png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); + tc.addTag("img").setAttribute("src", srcFor(imagePath, "tbl_vjoin_slice"+sfx+".png")).setAttribute("style", "background-color: inherit").setAttribute("class", "hierarchy").setAttribute("alt", "."); break; default: throw new Error("Unrecognized indent level: " + indents.get(indents.size()-1)); } + } } else tc.setAttribute("style", "vertical-align: top; text-align : left; background-color: "+color+"; border: "+ border +"px #F0F0F0 solid; padding:0px 4px 0px 4px"); @@ -700,7 +718,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { check(c); int i = 0; for (Row r : model.getRows()) { - check(r, "rows", model.getTitles().size(), Integer.toString(i)); + check(r, "rows", model.getTitles().size(), "", i, model.getRows().size()); i++; } } @@ -715,11 +733,18 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { } - private void check(Row r, String string, int size, String path) throws FHIRException { + private void check(Row r, String string, int size, String path, int index, int total) throws FHIRException { + String id = Integer.toString(index)+"."; + if (total <= 26) { + char c = (char) ('a'+index); + id = Character.toString(c); + } + path = path + id; + r.setId(path); check(r.getCells().size() == size, "All rows must have the same number of columns ("+Integer.toString(size)+") as the titles but row "+path+" doesn't ("+r.getCells().get(0).text()+"): "+r.getCells()); int i = 0; for (Row c : r.getSubRows()) { - check(c, "rows", size, path+"."+Integer.toString(i)); + check(c, "rows", size, path, i, r.getSubRows().size()); i++; } }