rendering fixes for IGs

This commit is contained in:
Grahame Grieve 2023-08-17 18:29:59 +10:00
parent 0d1072616e
commit f7c606e88b
4 changed files with 45 additions and 45 deletions

View File

@ -392,7 +392,6 @@ public class StructureDefinitionComparer extends CanonicalResourceComparer imple
boolean def = false;
boolean ch = false;
System.out.println(left.getId());
// not allowed to be different:
// ruleEqual(comp, res, left.current().getDefaultValue(), right.current().getDefaultValue(), "defaultValue", path);

View File

@ -124,4 +124,17 @@ public class VersionComparisonAnnotation {
return result.isEmpty() ? null : result.get(0);
}
public static CanonicalResourceComparison<? extends CanonicalResource> artifactComparison(Base base) {
if (base.hasUserData(USER_DATA_NAME)) {
VersionComparisonAnnotation self = (VersionComparisonAnnotation) base.getUserData(USER_DATA_NAME);
return self.comp;
} else {
return null;
}
}
}

View File

@ -194,48 +194,37 @@ public class Renderer extends TranslatingUtilities {
}
}
//
//
//public static CanonicalResourceComparison<? extends CanonicalResource> artifactComparison(Base base) {
// if (base.hasUserData(USER_DATA_NAME)) {
// VersionComparisonAnnotation self = (VersionComparisonAnnotation) base.getUserData(USER_DATA_NAME);
// return self.comp;
// } else {
// return null;
// }
//}
//
//public static void renderSummary(Base base, XhtmlNode x, String version, String... metadataFields) {
// if (base.hasUserData(USER_DATA_NAME)) {
// VersionComparisonAnnotation self = (VersionComparisonAnnotation) base.getUserData(USER_DATA_NAME);
// switch (self.type) {
// case Added:
// XhtmlNode spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+version);
// spanInner.img("icon-change-add.png", "icon");
// spanInner.tx(" Added");
// return;
// case Changed:
// if (self.comp.noChangeOtherThanMetadata(metadataFields)) {
// x.span("color: #eeeeee").tx("n/c");
// return;
// } else {
// spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been changed since "+version+(self.original != null ? " (was '"+(self.original.primitiveValue())+"')" : ""));
// spanInner.img("icon-change-edit.png", "icon");
// spanInner.tx(" Changed");
// }
// return;
// case Deleted:
// spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+version);
// spanInner.img("icon-change-remove.png", "icon");
// spanInner.tx(" Removed");
// return;
// default:
// x.span("color: #eeeeee").tx("n/c");
// return;
// }
// } else {
// x.span("color: #eeeeee").tx("--");
// }
//}
public static void renderStatusSummary(Base base, XhtmlNode x, String version, String... metadataFields) {
if (base.hasUserData(VersionComparisonAnnotation.USER_DATA_NAME)) {
VersionComparisonAnnotation self = (VersionComparisonAnnotation) base.getUserData(VersionComparisonAnnotation.USER_DATA_NAME);
switch (self.getType()) {
case Added:
XhtmlNode spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+version);
spanInner.img("icon-change-add.png", "icon");
spanInner.tx(" Added");
return;
case Changed:
if (self.getComp().noChangeOtherThanMetadata(metadataFields)) {
x.span("color: #eeeeee").tx("n/c");
return;
} else {
spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been changed since "+version+(self.getOriginal() != null ? " (was '"+(self.getOriginal())+"')" : ""));
spanInner.img("icon-change-edit.png", "icon");
spanInner.tx(" Changed");
}
return;
case Deleted:
spanInner = x.span("background-color: #fff2ff; border-left: solid 3px #ffa0ff; margin: 2px; padding: 2px", "This content has been added since "+version);
spanInner.img("icon-change-remove.png", "icon");
spanInner.tx(" Removed");
return;
default:
x.span("color: #eeeeee").tx("n/c");
return;
}
} else {
x.span("color: #eeeeee").tx("--");
}
}
}

View File

@ -3476,7 +3476,6 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
}
private void generateElementInner(XhtmlNode tbl, StructureDefinition sd, ElementDefinition d, int mode, ElementDefinition value, ElementDefinition compare, ElementDefinition compareValue, boolean strikethrough) throws FHIRException, IOException {
System.out.println(d.getPath());
boolean root = !d.getPath().contains(".");
boolean slicedExtension = d.hasSliceName() && (d.getPath().endsWith(".extension") || d.getPath().endsWith(".modifierExtension"));
// int slicedExtensionMode = (mode == GEN_MODE_KEY) && slicedExtension ? GEN_MODE_SNAP : mode; // see ProfileUtilities.checkExtensionDoco / Task 3970