fix sturcture definition rendering issues
This commit is contained in:
parent
6c4620996f
commit
3c8b3ec97c
|
@ -224,6 +224,7 @@ public class SearchParameter extends VersionConvertor_40_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode> tgt = new org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode>(new org.hl7.fhir.r5.model.SearchParameter.SearchModifierCodeEnumFactory());
|
||||
copyEnumeration(src, tgt);
|
||||
if (src.hasValue()) {
|
||||
switch (src.getValue()) {
|
||||
case MISSING: tgt.setValue(org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.MISSING); break;
|
||||
case EXACT: tgt.setValue(org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.EXACT); break;
|
||||
|
@ -239,6 +240,7 @@ public class SearchParameter extends VersionConvertor_40_50 {
|
|||
case OFTYPE: tgt.setValue(org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.OFTYPE); break;
|
||||
default: tgt.setValue(org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NULL); break;
|
||||
}
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -247,6 +249,7 @@ public class SearchParameter extends VersionConvertor_40_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode> tgt = new org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode>(new org.hl7.fhir.r4.model.SearchParameter.SearchModifierCodeEnumFactory());
|
||||
copyEnumeration(src, tgt);
|
||||
if (src.hasValue()) {
|
||||
switch (src.getValue()) {
|
||||
case MISSING: tgt.setValue( org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.MISSING); break;
|
||||
case EXACT: tgt.setValue( org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.EXACT); break;
|
||||
|
@ -262,6 +265,7 @@ public class SearchParameter extends VersionConvertor_40_50 {
|
|||
case OFTYPE: tgt.setValue( org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.OFTYPE); break;
|
||||
default: tgt.setValue( org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.NULL); break;
|
||||
}
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -1155,7 +1155,7 @@ public class ProfileUtilities {
|
|||
|
||||
public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
|
||||
TableModel model = gen.initNormalTable(corePath, false);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true);
|
||||
|
||||
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<String> 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);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true);
|
||||
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
|
||||
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
|
||||
profiles.add(profile);
|
||||
|
|
|
@ -1156,7 +1156,7 @@ public class ProfileUtilities {
|
|||
|
||||
public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
|
||||
TableModel model = gen.initNormalTable(corePath, false);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true);
|
||||
|
||||
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<String> 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);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true);
|
||||
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
|
||||
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
|
||||
profiles.add(profile);
|
||||
|
|
|
@ -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<String> outputTracker) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
|
||||
gen.setTranslator(getTranslator());
|
||||
TableModel model = gen.initNormalTable(corePath, false);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true);
|
||||
|
||||
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);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true);
|
||||
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
|
||||
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
|
||||
profiles.add(profile);
|
||||
|
|
|
@ -1862,7 +1862,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
|
||||
gen.setTranslator(getTranslator());
|
||||
TableModel model = gen.initNormalTable(corePath, false);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true);
|
||||
|
||||
boolean deep = false;
|
||||
String m = "";
|
||||
|
@ -2222,7 +2222,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);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true);
|
||||
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
|
||||
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
|
||||
profiles.add(profile);
|
||||
|
|
|
@ -59,6 +59,7 @@ import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent
|
|||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.SlicingRules;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||
import org.hl7.fhir.r5.model.Enumeration;
|
||||
|
@ -1920,7 +1921,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
|
||||
gen.setTranslator(getTranslator());
|
||||
TableModel model = gen.initNormalTable(corePath, false);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true);
|
||||
|
||||
boolean deep = false;
|
||||
String m = "";
|
||||
|
@ -2280,7 +2281,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);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true);
|
||||
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
|
||||
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
|
||||
profiles.add(profile);
|
||||
|
@ -2370,6 +2371,8 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
String ref = defPath == null ? null : defPath + element.getId();
|
||||
UnusedTracker used = new UnusedTracker();
|
||||
used.used = true;
|
||||
if (logicalModel && element.hasRepresentation(PropertyRepresentation.XMLATTR))
|
||||
s = "@"+s;
|
||||
Cell left = gen.new Cell(null, ref, s, (element.hasSliceName() ? translate("sd.table", "Slice")+" "+element.getSliceName() : "")+(hasDef && element.hasSliceName() ? ": " : "")+(!hasDef ? null : gt(element.getDefinitionElement())), null);
|
||||
row.getCells().add(left);
|
||||
Cell gc = gen.new Cell();
|
||||
|
|
|
@ -486,6 +486,17 @@ The type is the Canonical URL of Resource Definition that is the type this refer
|
|||
, display);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (hasReference())
|
||||
return "Reference["+getReference()+"]";
|
||||
if (hasIdentifier())
|
||||
return "Reference[id:"+getIdentifier()+"]";
|
||||
if (hasDisplay())
|
||||
return "Reference['"+getDisplay()+"']";
|
||||
return "Reference[??]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ public class IGHelper {
|
|||
|
||||
public static final String EXT_SPREADSHEET = ToolingExtensions.EXT_IGP_SPREADSHEET;
|
||||
public static final String EXT_BUNDLE = ToolingExtensions.EXT_IGP_BUNDLE;
|
||||
public static final String EXT_RESOURCE_INFO = ToolingExtensions.EXT_IGP_RESOURCE_INFO;
|
||||
|
||||
public static String readStringParameter(ImplementationGuideDefinitionComponent ig, String name) {
|
||||
for (ImplementationGuideDefinitionParameterComponent p : ig.getParameter()) {
|
||||
|
|
|
@ -149,6 +149,7 @@ public class ToolingExtensions {
|
|||
public static final String EXT_IGP_PAGES = "http://hl7.org/fhir/StructureDefinition/igpublisher-folder-pages";
|
||||
public static final String EXT_IGP_SPREADSHEET = "http://hl7.org/fhir/StructureDefinition/igpublisher-spreadsheet";
|
||||
public static final String EXT_IGP_BUNDLE = "http://hl7.org/fhir/StructureDefinition/igpublisher-bundle";
|
||||
public static final String EXT_IGP_RESOURCE_INFO = "http://tools.fhir.org/StructureDefinition/resource-information";
|
||||
public static final String EXT_IGP_LOADVERSION = "http://hl7.org/fhir/StructureDefinition/igpublisher-loadversion";
|
||||
public static final String EXT_MAX_VALUESET = "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet";
|
||||
public static final String EXT_MIN_VALUESET = "http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet";
|
||||
|
|
|
@ -41,6 +41,14 @@
|
|||
36. Deep recursion
|
||||
37. Test Bad Path
|
||||
38. Deep nesting
|
||||
39. Choice types: no constraint
|
||||
40. Choice Types: constrain minimum cardinality
|
||||
41. Choice Types: constrain list of choices to 2
|
||||
42. Choice Types: constrain list of choices to 1
|
||||
43. Choice Types: constrain list of choices to 1 and constrain the type (slicing)
|
||||
44. Choice Types: constrain list of choices to 1 and constrain the type (shortcut)
|
||||
43. Choice Types: constrain list of choices to 2 and constrain the types (slicing)
|
||||
44. Choice Types: constrain list of choices to 2 and constrain the types (shortcut)
|
||||
-->
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
|
@ -1934,6 +1942,305 @@
|
|||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
|
||||
|
||||
<!-- 39. Choice types: no constraint -->
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
<id value="t39"/>
|
||||
<url value="urn:uuid:"/>
|
||||
<name value="t39"/>
|
||||
<status value="draft"/>
|
||||
<description value="fixture for #39: Choice types: no constraint"/>
|
||||
<kind value="resource"/>
|
||||
<abstract value="false"/>
|
||||
<type value="Observation"/>
|
||||
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation"/>
|
||||
<derivation value="constraint"/>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="Observation"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<short value="some text"/>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
|
||||
<!-- 40. Choice Types: constrain minimum cardinality -->
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
<id value="t40"/>
|
||||
<url value="urn:uuid:"/>
|
||||
<name value="t40"/>
|
||||
<status value="draft"/>
|
||||
<description value="fixture for #40: Choice Types: constrain minimum cardinality"/>
|
||||
<kind value="resource"/>
|
||||
<abstract value="false"/>
|
||||
<type value="Observation"/>
|
||||
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation"/>
|
||||
<derivation value="constraint"/>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="Observation"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<short value="some text"/>
|
||||
<min value="1"/>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
|
||||
<!-- 41. Choice Types: constrain list of choices to 2 -->
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
<id value="t41"/>
|
||||
<url value="urn:uuid:"/>
|
||||
<name value="t41"/>
|
||||
<status value="draft"/>
|
||||
<description value="fixture for #41: Choice Types: constrain list of choices to 2"/>
|
||||
<kind value="resource"/>
|
||||
<abstract value="false"/>
|
||||
<type value="Observation"/>
|
||||
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation"/>
|
||||
<derivation value="constraint"/>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="Observation"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<short value="some text"/>
|
||||
<type>
|
||||
<code value="Quantity"/>
|
||||
</type>
|
||||
<type>
|
||||
<code value="CodeableConcept"/>
|
||||
</type>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
|
||||
<!-- 42. Choice Types: constrain list of choices to 1 -->
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
<id value="t42"/>
|
||||
<url value="urn:uuid:"/>
|
||||
<name value="t42"/>
|
||||
<status value="draft"/>
|
||||
<description value="fixture for #42: Choice Types: constrain list of choices to 1"/>
|
||||
<kind value="resource"/>
|
||||
<abstract value="false"/>
|
||||
<type value="Observation"/>
|
||||
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation"/>
|
||||
<derivation value="constraint"/>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="Observation"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<short value="some text"/>
|
||||
<type>
|
||||
<code value="Quantity"/>
|
||||
</type>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
|
||||
<!-- 43. Choice Types: constrain list of choices to 1 and constrain the type (slicing) -->
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
<id value="t43"/>
|
||||
<url value="urn:uuid:"/>
|
||||
<name value="t43"/>
|
||||
<status value="draft"/>
|
||||
<description value="fixture for #43: Choice Types: constrain list of choices to 1 and constrain the type (slicing)"/>
|
||||
<kind value="resource"/>
|
||||
<abstract value="false"/>
|
||||
<type value="Observation"/>
|
||||
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation"/>
|
||||
<derivation value="constraint"/>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="Observation"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<slicing>
|
||||
<discriminator>
|
||||
<type value="type"/>
|
||||
<path value="@this"/>
|
||||
</discriminator>
|
||||
</slicing>
|
||||
<short value="some text"/>
|
||||
<type>
|
||||
<code value="Quantity"/>
|
||||
</type>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<sliceName value="quantity"/>
|
||||
<short value="some text for quantity"/>
|
||||
<type>
|
||||
<code value="Quantity"/>
|
||||
</type>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x].value"/>
|
||||
<min value="1"/>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
|
||||
<!-- 44. Choice Types: constrain list of choices to 1 and constrain the type (shortcut) -->
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
<id value="t44"/>
|
||||
<url value="urn:uuid:"/>
|
||||
<name value="t44"/>
|
||||
<status value="draft"/>
|
||||
<description value="fixture for #44: Choice Types: constrain list of choices to 1 and constrain the type (shortcut)"/>
|
||||
<kind value="resource"/>
|
||||
<abstract value="false"/>
|
||||
<type value="Observation"/>
|
||||
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation"/>
|
||||
<derivation value="constraint"/>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="Observation"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<short value="some text"/>
|
||||
<type>
|
||||
<code value="Quantity"/>
|
||||
</type>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.valueQuantity"/>
|
||||
<short value="some text for quantity"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.valueQuantity.value"/>
|
||||
<min value="1"/>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
|
||||
<!-- 43. Choice Types: constrain list of choices to 2 and constrain the types (slicing) -->
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
<id value="t43"/>
|
||||
<url value="urn:uuid:"/>
|
||||
<name value="t43"/>
|
||||
<status value="draft"/>
|
||||
<description value="fixture for #43: Choice Types: constrain list of choices to 2 and constrain the types (slicing)"/>
|
||||
<kind value="resource"/>
|
||||
<abstract value="false"/>
|
||||
<type value="Observation"/>
|
||||
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation"/>
|
||||
<derivation value="constraint"/>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="Observation"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<slicing>
|
||||
<discriminator>
|
||||
<type value="type"/>
|
||||
<path value="@this"/>
|
||||
</discriminator>
|
||||
</slicing>
|
||||
<short value="some text"/>
|
||||
<type>
|
||||
<code value="Quantity"/>
|
||||
</type>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<sliceName value="quantity"/>
|
||||
<short value="some text for quantity"/>
|
||||
<type>
|
||||
<code value="Quantity"/>
|
||||
</type>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x].value"/>
|
||||
<min value="1"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<sliceName value="codeable"/>
|
||||
<short value="some text for CodeableConcept"/>
|
||||
<type>
|
||||
<code value="CodeableConcept"/>
|
||||
</type>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x].text"/>
|
||||
<max value="0"/>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
|
||||
<!-- 44. Choice Types: constrain list of choices to 2 and constrain the types (shortcut) -->
|
||||
<contained>
|
||||
<StructureDefinition>
|
||||
<id value="t44"/>
|
||||
<url value="urn:uuid:"/>
|
||||
<name value="t44"/>
|
||||
<status value="draft"/>
|
||||
<description value="fixture for #44: Choice Types: constrain list of choices to 2 and constrain the types (shortcut)"/>
|
||||
<kind value="resource"/>
|
||||
<abstract value="false"/>
|
||||
<type value="Observation"/>
|
||||
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation"/>
|
||||
<derivation value="constraint"/>
|
||||
<differential>
|
||||
<element>
|
||||
<path value="Observation"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.value[x]"/>
|
||||
<short value="some text"/>
|
||||
<type>
|
||||
<code value="Quantity"/>
|
||||
</type>
|
||||
<type>
|
||||
<code value="CodeableConcept"/>
|
||||
</type>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.valueQuantity"/>
|
||||
<short value="some text for quantity"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.valueQuantity.value"/>
|
||||
<min value="1"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.valueCodeableConcept"/>
|
||||
<short value="some text for CodeableConcept"/>
|
||||
</element>
|
||||
<element>
|
||||
<path value="Observation.valueCodeableConcept.text"/>
|
||||
<max value="0"/>
|
||||
</element>
|
||||
</differential>
|
||||
</StructureDefinition>
|
||||
</contained>
|
||||
|
||||
<url value="http://hl7.org/fhir/tests/snapshotgeneration"/>
|
||||
<name value="SnapshotGenerationTests"/>
|
||||
<title value="Snapshot generation test script"/>
|
||||
|
|
|
@ -95,9 +95,19 @@ 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 Map<String, String> files = new HashMap<String, String>();
|
||||
|
||||
private class Counter {
|
||||
private int count = -1;
|
||||
private void row() {
|
||||
count++;
|
||||
}
|
||||
private boolean isOdd() {
|
||||
return count % 2 == 1;
|
||||
}
|
||||
}
|
||||
public class Piece {
|
||||
private String tag;
|
||||
private String reference;
|
||||
|
@ -232,6 +242,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
|
||||
return myPieces;
|
||||
}
|
||||
|
||||
private List<Piece> htmlFormattingToPieces(String html) throws IOException, FHIRException {
|
||||
List<Piece> myPieces = new ArrayList<Piece>();
|
||||
if (html.contains(("<"))) {
|
||||
|
@ -243,6 +254,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
myPieces.add(new Piece(null, html, null));
|
||||
return myPieces;
|
||||
}
|
||||
|
||||
private void addNode(List<Piece> list, XhtmlNode c) {
|
||||
if (c.getNodeType() == NodeType.Text)
|
||||
list.add(new Piece(null, c.getContent(), null));
|
||||
|
@ -300,7 +312,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
p.addStyle("background-color: "+bgColor);
|
||||
} else {
|
||||
p.addStyle("color: black");
|
||||
p.addStyle("background-color: white");
|
||||
p.addStyle("background-color: "+bgColor != null ? bgColor : "white");
|
||||
}
|
||||
pieces.add(p);
|
||||
return p;
|
||||
|
@ -382,6 +394,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
private List<Row> rows = new ArrayList<HierarchicalTableGenerator.Row>();
|
||||
private String docoRef;
|
||||
private String docoImg;
|
||||
private boolean alternating;
|
||||
public List<Title> getTitles() {
|
||||
return titles;
|
||||
}
|
||||
|
@ -434,9 +447,10 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
this.makeTargets = makeTargets;
|
||||
}
|
||||
|
||||
public TableModel initNormalTable(String prefix, boolean isLogical) {
|
||||
public TableModel initNormalTable(String prefix, boolean isLogical, boolean alternating) {
|
||||
TableModel model = new TableModel();
|
||||
|
||||
model.alternating = alternating;
|
||||
model.setDocoImg(prefix+"help16.png");
|
||||
model.setDocoRef(prefix+"formats.html#table");
|
||||
model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0));
|
||||
|
@ -476,8 +490,9 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
if (tc != null && model.getDocoRef() != null)
|
||||
tc.addTag("span").setAttribute("style", "float: right").addTag("a").setAttribute("title", "Legend for this format").setAttribute("href", model.getDocoRef()).addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg());
|
||||
|
||||
Counter counter = new Counter();
|
||||
for (Row r : model.getRows()) {
|
||||
renderRow(table, r, 0, new ArrayList<Integer>(), imagePath, border, outputTracker);
|
||||
renderRow(table, r, 0, new ArrayList<Integer>(), imagePath, border, outputTracker, counter, model);
|
||||
}
|
||||
if (model.getDocoRef() != null) {
|
||||
tr = table.addTag("tr");
|
||||
|
@ -494,11 +509,15 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
}
|
||||
|
||||
|
||||
private void renderRow(XhtmlNode table, Row r, int indent, List<Integer> indents, String imagePath, int border, Set<String> outputTracker) throws IOException {
|
||||
private void renderRow(XhtmlNode table, Row r, int indent, List<Integer> indents, String imagePath, int border, Set<String> outputTracker, Counter counter, TableModel model) throws IOException {
|
||||
counter.row();
|
||||
XhtmlNode tr = table.addTag("tr");
|
||||
String color = "white";
|
||||
if (r.getColor() != null)
|
||||
color = r.getColor();
|
||||
else if (model.alternating && counter.isOdd())
|
||||
color = BACKGROUND_ALT_COLOR;
|
||||
|
||||
tr.setAttribute("style", "border: " + border + "px #F0F0F0 solid; padding:0px; vertical-align: top; background-color: "+color+";");
|
||||
boolean first = true;
|
||||
for (Cell t : r.getCells()) {
|
||||
|
@ -516,7 +535,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
} else {
|
||||
ind.add(r.getLineColor()*2+1);
|
||||
}
|
||||
renderRow(table, c, indent+1, ind, imagePath, border, outputTracker);
|
||||
renderRow(table, c, indent+1, ind, imagePath, border, outputTracker, counter, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue