improved rendering on constraints

This commit is contained in:
Grahame Grieve 2019-10-25 16:13:51 +11:00
parent 34c4faed8f
commit 0b67029100
1 changed files with 14 additions and 2 deletions

View File

@ -2063,7 +2063,7 @@ public class ProfileUtilities extends TranslatingUtilities {
for (ElementDefinitionConstraintComponent s : base.getConstraint()) { for (ElementDefinitionConstraintComponent s : base.getConstraint()) {
s.setUserData(IS_DERIVED, true); s.setUserData(IS_DERIVED, true);
if (!s.hasSource()) if (!s.hasSource())
s.setSource(base.getId()); s.setSource(srcSD.getUrl());
} }
if (derived.hasConstraint()) { if (derived.hasConstraint()) {
for (ElementDefinitionConstraintComponent s : derived.getConstraint()) { for (ElementDefinitionConstraintComponent s : derived.getConstraint()) {
@ -2707,7 +2707,7 @@ public class ProfileUtilities extends TranslatingUtilities {
if (element != null && element.getIsSummary()) if (element != null && element.getIsSummary())
checkForNoChange(element.getIsSummaryElement(), gc.addStyledText(translate("sd.table", "This element is included in summaries"), "\u03A3", null, null, null, false)); checkForNoChange(element.getIsSummaryElement(), gc.addStyledText(translate("sd.table", "This element is included in summaries"), "\u03A3", null, null, null, false));
if (element != null && (!element.getConstraint().isEmpty() || !element.getCondition().isEmpty())) if (element != null && (!element.getConstraint().isEmpty() || !element.getCondition().isEmpty()))
gc.addStyledText(translate("sd.table", "This element has or is affected by some invariants"), "I", null, null, null, false); gc.addStyledText(translate("sd.table", "This element has or is affected by some invariants ("+listConstraintsAndConditions(element)+")"), "I", null, null, null, false);
ExtensionContext extDefn = null; ExtensionContext extDefn = null;
if (ext) { if (ext) {
@ -2824,6 +2824,18 @@ public class ProfileUtilities extends TranslatingUtilities {
return slicingRow; return slicingRow;
} }
private String listConstraintsAndConditions(ElementDefinition element) {
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
for (ElementDefinitionConstraintComponent con : element.getConstraint()) {
b.append(con.getKey());
}
for (IdType id : element.getCondition()) {
b.append(id.asStringValue());
}
return b.toString();
}
private void makeChoiceRows(List<Row> subRows, ElementDefinition element, HierarchicalTableGenerator gen, String corePath, String profileBaseFileName) { private void makeChoiceRows(List<Row> subRows, ElementDefinition element, HierarchicalTableGenerator gen, String corePath, String profileBaseFileName) {
// create a child for each choice // create a child for each choice
for (TypeRefComponent tr : element.getType()) { for (TypeRefComponent tr : element.getType()) {