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
for (TypeRefComponent tr : element.getType()) {
if (!mustSupportMode || allTypesMustSupport(element) || isMustSupport(tr)) {
boolean used = false;
Row choicerow = gen.new Row();
String t = tr.getWorkingCode();
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());
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);
sd = context.getWorker().fetchTypeDefinition(t);
} 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());
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);
}
} 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());
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);
}
}
if (tr.hasProfile() && choicerow.getCells().size() >= 4) {
if (tr.hasProfile() && used) {
Cell typeCell = choicerow.getCells().get(3);
typeCell.addPiece(gen.new Piece(null, "(", null));
boolean first = true;
@ -2634,11 +2638,13 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
typeCell.addPiece(gen.new Piece(null, ")", null));
}
}
if (used) {
choicerow.getCells().add(gen.new Cell());
subRows.add(choicerow);
}
}
}
}
private boolean isReference(String t) {
return t.equals("Reference") || t.equals("canonical");