Search in sources :

Example 41 with TableModel

use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel in project org.hl7.fhir.core by hapifhir.

the class CodeSystemComparer method renderConcepts.

public XhtmlNode renderConcepts(CodeSystemComparison comparison, String id, String prefix) throws FHIRException, IOException {
    // columns: code, display (left|right), properties (left|right)
    HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false);
    TableModel model = gen.new TableModel(id, true);
    model.setAlternating(true);
    model.getTitles().add(gen.new Title(null, null, "Code", "The code for the concept", null, 100));
    model.getTitles().add(gen.new Title(null, null, "Display", "The display for the concept", null, 200, 2));
    for (PropertyComponent p : comparison.getUnion().getProperty()) {
        model.getTitles().add(gen.new Title(null, null, p.getCode(), p.getDescription(), null, 100, 2));
    }
    model.getTitles().add(gen.new Title(null, null, "Comments", "Additional information about the comparison", null, 200));
    for (StructuralMatch<ConceptDefinitionComponent> t : comparison.getCombined().getChildren()) {
        addRow(gen, model.getRows(), t, comparison);
    }
    return gen.generate(model, prefix, 0, null);
}
Also used : ConceptPropertyComponent(org.hl7.fhir.r4b.model.CodeSystem.ConceptPropertyComponent) PropertyComponent(org.hl7.fhir.r4b.model.CodeSystem.PropertyComponent) ConceptDefinitionComponent(org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent) HierarchicalTableGenerator(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator) TableModel(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel)

Example 42 with TableModel

use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel in project org.hl7.fhir.core by hapifhir.

the class ValueSetComparer method renderExpansion.

public XhtmlNode renderExpansion(ValueSetComparison csc, String id, String prefix) throws IOException {
    if (csc.getExpansion() == null) {
        XhtmlNode p = new XhtmlNode(NodeType.Element, "p");
        p.tx("Unable to generate expansion - see errors");
        return p;
    }
    if (csc.getExpansion().getChildren().isEmpty()) {
        XhtmlNode p = new XhtmlNode(NodeType.Element, "p");
        p.tx("Expansion is empty");
        return p;
    }
    // columns: code(+system), version, display , abstract, inactive,
    boolean hasSystem = csc.getExpansion().getChildren().isEmpty() ? false : getSystemVaries(csc.getExpansion(), csc.getExpansion().getChildren().get(0).either().getSystem());
    boolean hasVersion = findVersion(csc.getExpansion());
    boolean hasAbstract = findAbstract(csc.getExpansion());
    boolean hasInactive = findInactive(csc.getExpansion());
    HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "comparison"), false);
    TableModel model = gen.new TableModel(id, true);
    model.setAlternating(true);
    if (hasSystem) {
        model.getTitles().add(gen.new Title(null, null, "System", "The code for the concept", null, 100));
    }
    model.getTitles().add(gen.new Title(null, null, "Code", "The system for the concept", null, 100));
    model.getTitles().add(gen.new Title(null, null, "Display", "The display for the concept", null, 200, 2));
    // if (hasVersion) {
    // model.getTitles().add(gen.new Title(null, null, "Version", "The version for the concept", null, 200, 2));
    // }
    // if (hasAbstract) {
    // model.getTitles().add(gen.new Title(null, null, "Abstract", "The abstract flag for the concept", null, 200, 2));
    // }
    // if (hasInactive) {
    // model.getTitles().add(gen.new Title(null, null, "Inactive", "The inactive flag for the concept", null, 200, 2));
    // }
    model.getTitles().add(gen.new Title(null, null, "Comments", "Additional information about the comparison", null, 200));
    for (StructuralMatch<ValueSetExpansionContainsComponent> t : csc.getExpansion().getChildren()) {
        addExpansionRow(gen, model.getRows(), t, hasSystem, hasVersion, hasAbstract, hasInactive);
    }
    return gen.generate(model, prefix, 0, null);
}
Also used : ValueSetExpansionContainsComponent(org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionContainsComponent) HierarchicalTableGenerator(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator) TableModel(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 43 with TableModel

use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireRenderer method renderLogic.

private boolean renderLogic(XhtmlNode x, Questionnaire q) throws FHIRException, IOException {
    HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
    TableModel model = gen.new TableModel("qtree=" + q.getId(), true);
    model.setAlternating(true);
    model.setDocoImg(context.getSpecificationLink() + "help16.png");
    model.setDocoRef(context.getSpecificationLink() + "formats.html#table");
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Description & Constraints"), translate("sd.hint", "Additional information about the item"), null, 0));
    boolean hasExt = false;
    if (!q.hasItem()) {
        gen.emptyRow(model, 2);
    } else {
        for (QuestionnaireItemComponent i : q.getItem()) {
            hasExt = renderLogicItem(gen, model.getRows(), q, i) || hasExt;
        }
    }
    XhtmlNode xn = gen.generate(model, context.getLocalPrefix(), 1, null);
    x.getChildNodes().add(xn);
    return hasExt;
}
Also used : QuestionnaireItemComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent) HierarchicalTableGenerator(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator) TableModel(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 44 with TableModel

use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireRenderer method renderTree.

public boolean renderTree(XhtmlNode x, Questionnaire q) throws UnsupportedEncodingException, IOException {
    boolean hasFlags = checkForFlags(q.getItem());
    boolean doOpts = context.getDefinitionsTarget() == null && hasAnyOptions(q.getItem());
    if (doOpts) {
        x.b().tx("Structure");
    }
    HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
    TableModel model = gen.new TableModel("qtree=" + q.getId(), !forResource);
    model.setAlternating(true);
    model.setDocoImg(context.getSpecificationLink() + "help16.png");
    model.setDocoRef(context.getSpecificationLink() + "formats.html#table");
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0));
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Cardinality"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0));
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Type"), translate("sd.hint", "The type of the item"), null, 0));
    if (hasFlags) {
        model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Flags"), translate("sd.hint", "Other attributes of the item"), null, 0));
    }
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Description & Constraints"), translate("sd.hint", "Additional information about the item"), null, 0));
    boolean hasExt = false;
    // first we add a root for the questionaire itself
    Row row = addTreeRoot(gen, model.getRows(), q, hasFlags);
    for (QuestionnaireItemComponent i : q.getItem()) {
        hasExt = renderTreeItem(gen, row.getSubRows(), q, i, hasFlags) || hasExt;
    }
    XhtmlNode xn = gen.generate(model, context.getLocalPrefix(), 1, null);
    x.getChildNodes().add(xn);
    if (doOpts) {
        renderOptions(q, x);
    }
    return hasExt;
}
Also used : QuestionnaireItemComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent) HierarchicalTableGenerator(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator) Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) TableModel(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 45 with TableModel

use of org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireResponseRenderer method renderTree.

public boolean renderTree(XhtmlNode x, ResourceWrapper qr) throws UnsupportedEncodingException, IOException {
    HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
    TableModel model = gen.new TableModel("qtree=" + qr.getId(), false);
    model.setAlternating(true);
    model.setDocoImg(context.getSpecificationLink() + "help16.png");
    model.setDocoRef(context.getSpecificationLink() + "formats.html#table");
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0));
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Definition"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0));
    model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Answer"), translate("sd.hint", "The type of the item"), null, 0));
    boolean hasExt = false;
    // first we add a root for the questionaire itself
    Row row = addTreeRoot(gen, model.getRows(), qr);
    List<BaseWrapper> items = qr.children("item");
    for (BaseWrapper i : items) {
        hasExt = renderTreeItem(gen, row.getSubRows(), qr, i) || hasExt;
    }
    XhtmlNode xn = gen.generate(model, context.getLocalPrefix(), 1, null);
    x.getChildNodes().add(xn);
    return hasExt;
}
Also used : BaseWrapper(org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper) HierarchicalTableGenerator(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator) Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) TableModel(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Aggregations

TableModel (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel)51 HierarchicalTableGenerator (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator)45 ArrayList (java.util.ArrayList)17 FHIRException (org.hl7.fhir.exceptions.FHIRException)14 Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)14 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)11 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)7 List (java.util.List)6 Piece (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece)6 HashSet (java.util.HashSet)5 ElementDefinition (org.hl7.fhir.dstu3.model.ElementDefinition)3 ElementDefinition (org.hl7.fhir.r4.model.ElementDefinition)3 ElementDefinition (org.hl7.fhir.r4b.model.ElementDefinition)3 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)3 ElementDefinition (org.hl7.fhir.dstu2.model.ElementDefinition)2 ElementDefinition (org.hl7.fhir.dstu2016may.model.ElementDefinition)2 StructureDefinition (org.hl7.fhir.dstu3.model.StructureDefinition)2 StructureDefinition (org.hl7.fhir.r4.model.StructureDefinition)2 Element (org.hl7.fhir.r4b.model.Element)2 QuestionnaireItemComponent (org.hl7.fhir.r4b.model.Questionnaire.QuestionnaireItemComponent)2