more xig related fixes

This commit is contained in:
Grahame Grieve 2023-09-08 13:03:51 +10:00
parent 493f2f51f2
commit 3a6e6fe39a
1 changed files with 9 additions and 3 deletions

View File

@ -2544,9 +2544,11 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
// create a child for each choice // create a child for each choice
for (TypeRefComponent tr : element.getType()) { for (TypeRefComponent tr : element.getType()) {
if (!mustSupportMode || allTypesMustSupport(element) || isMustSupport(tr)) { if (!mustSupportMode || allTypesMustSupport(element) || isMustSupport(tr)) {
boolean used = false;
Row choicerow = gen.new Row(); Row choicerow = gen.new Row();
String t = tr.getWorkingCode(); String t = tr.getWorkingCode();
if (isReference(t)) { if (isReference(t)) {
used = true;
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), null, null)); choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), null, null));
choicerow.getCells().add(gen.new Cell()); choicerow.getCells().add(gen.new Cell());
choicerow.getCells().add(gen.new Cell(null, null, "", null, null)); choicerow.getCells().add(gen.new Cell(null, null, "", null, null));
@ -2591,6 +2593,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
System.out.println("Unable to find "+t); System.out.println("Unable to find "+t);
sd = context.getWorker().fetchTypeDefinition(t); sd = context.getWorker().fetchTypeDefinition(t);
} else if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) { } else if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) {
used = true;
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null)); choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null));
choicerow.getCells().add(gen.new Cell()); choicerow.getCells().add(gen.new Cell());
choicerow.getCells().add(gen.new Cell(null, null, "", null, null)); choicerow.getCells().add(gen.new Cell(null, null, "", null, null));
@ -2602,6 +2605,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
c.addStyledText(translate("sd.table", "This type must be supported"), "S", "white", "red", null, false); c.addStyledText(translate("sd.table", "This type must be supported"), "S", "white", "red", null, false);
} }
} else { } else {
used = true;
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null)); choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null));
choicerow.getCells().add(gen.new Cell()); choicerow.getCells().add(gen.new Cell());
choicerow.getCells().add(gen.new Cell(null, null, "", null, null)); choicerow.getCells().add(gen.new Cell(null, null, "", null, null));
@ -2613,7 +2617,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
c.addStyledText(translate("sd.table", "This type must be supported"), "S", "white", "red", null, false); c.addStyledText(translate("sd.table", "This type must be supported"), "S", "white", "red", null, false);
} }
} }
if (tr.hasProfile() && choicerow.getCells().size() >= 4) { if (tr.hasProfile() && used) {
Cell typeCell = choicerow.getCells().get(3); Cell typeCell = choicerow.getCells().get(3);
typeCell.addPiece(gen.new Piece(null, "(", null)); typeCell.addPiece(gen.new Piece(null, "(", null));
boolean first = true; boolean first = true;
@ -2634,8 +2638,10 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
typeCell.addPiece(gen.new Piece(null, ")", null)); typeCell.addPiece(gen.new Piece(null, ")", null));
} }
} }
choicerow.getCells().add(gen.new Cell()); if (used) {
subRows.add(choicerow); choicerow.getCells().add(gen.new Cell());
subRows.add(choicerow);
}
} }
} }
} }