Inline help6.png in resources
This commit is contained in:
parent
075bb46fa3
commit
5444c3a33a
|
@ -72,7 +72,11 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
|
||||
TableModel model = gen.new TableModel("qtree="+q.getId(), context.getRules() == GenerationRules.IG_PUBLISHER);
|
||||
model.setAlternating(true);
|
||||
model.setDocoImg(context.getLink(KnownLinkType.SPEC) +"help16.png");
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
model.setDocoImg(HierarchicalTableGenerator.help16AsData());
|
||||
} else {
|
||||
model.setDocoImg(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "help16.png"));
|
||||
}
|
||||
model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"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));
|
||||
|
@ -446,7 +450,11 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
|
||||
TableModel model = gen.new TableModel("qtree="+q.getId(), true);
|
||||
model.setAlternating(true);
|
||||
model.setDocoImg(context.getLink(KnownLinkType.SPEC) +"help16.png");
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
model.setDocoImg(HierarchicalTableGenerator.help16AsData());
|
||||
} else {
|
||||
model.setDocoImg(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "help16.png"));
|
||||
}
|
||||
model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"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));
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.hl7.fhir.r5.model.StructureDefinition;
|
|||
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper;
|
||||
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
|
||||
|
@ -63,7 +64,11 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
|
||||
TableModel model = gen.new TableModel("qtree="+qr.getId(), false);
|
||||
model.setAlternating(true);
|
||||
model.setDocoImg(context.getLink(KnownLinkType.SPEC) +"help16.png");
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
model.setDocoImg(HierarchicalTableGenerator.help16AsData());
|
||||
} else {
|
||||
model.setDocoImg(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "help16.png"));
|
||||
}
|
||||
model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"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));
|
||||
|
@ -86,7 +91,11 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer {
|
|||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
|
||||
TableModel model = gen.new TableModel("qtree="+q.getId(), true);
|
||||
model.setAlternating(true);
|
||||
model.setDocoImg(context.getLink(KnownLinkType.SPEC) +"help16.png");
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
model.setDocoImg(HierarchicalTableGenerator.help16AsData());
|
||||
} else {
|
||||
model.setDocoImg(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "help16.png"));
|
||||
}
|
||||
model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"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));
|
||||
|
|
|
@ -516,11 +516,15 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
public TableModel initCustomTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical, boolean alternating, String id, boolean isActive, List<Column> columns) {
|
||||
public TableModel initCustomTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical, boolean alternating, String id, boolean isActive, List<Column> columns) throws IOException {
|
||||
TableModel model = gen.new TableModel(id, isActive);
|
||||
|
||||
model.setAlternating(alternating);
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
model.setDocoImg(HierarchicalTableGenerator.help16AsData());
|
||||
} else {
|
||||
model.setDocoImg(Utilities.pathURL(prefix, "help16.png"));
|
||||
}
|
||||
model.setDocoRef(Utilities.pathURL("https://build.fhir.org/ig/FHIR/ig-guidance", "readingIgs.html#table-views"));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0));
|
||||
for (Column col : columns) {
|
||||
|
@ -2586,10 +2590,14 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
|
||||
private TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical, String id) {
|
||||
private TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical, String id) throws IOException {
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
|
||||
model.setDocoImg(prefix+"help16.png");
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
model.setDocoImg(HierarchicalTableGenerator.help16AsData());
|
||||
} else {
|
||||
model.setDocoImg(Utilities.pathURL(prefix, "help16.png"));
|
||||
}
|
||||
model.setDocoRef(Utilities.pathURL(prefix, "formats.html#table")); // todo: change to graph definition
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), "Property", "A profiled resource", null, 0));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), "Card.", "Minimum and Maximum # of times the the element can appear in the instance", null, 0));
|
||||
|
|
|
@ -66,6 +66,7 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -82,9 +83,9 @@ import org.commonmark.node.Node;
|
|||
import org.commonmark.parser.Parser;
|
||||
import org.commonmark.renderer.html.HtmlRenderer;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.TranslatingUtilities;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableGenerationMode;
|
||||
|
||||
|
||||
public class HierarchicalTableGenerator extends TranslatingUtilities {
|
||||
|
@ -634,13 +635,17 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
checkSetup();
|
||||
}
|
||||
|
||||
public TableModel initNormalTable(String prefix, boolean isLogical, boolean alternating, String id, boolean isActive, TableGenerationMode mode) {
|
||||
public TableModel initNormalTable(String prefix, boolean isLogical, boolean alternating, String id, boolean isActive, TableGenerationMode mode) throws IOException {
|
||||
this.mode = mode;
|
||||
|
||||
TableModel model = new TableModel(id, isActive);
|
||||
|
||||
model.setAlternating(alternating);
|
||||
if (mode == TableGenerationMode.XML) {
|
||||
model.setDocoImg(help16AsData());
|
||||
} else {
|
||||
model.setDocoImg(Utilities.pathURL(prefix, "help16.png"));
|
||||
}
|
||||
model.setDocoRef(Utilities.pathURL("https://build.fhir.org/ig/FHIR/ig-guidance", "readingIgs.html#table-views"));
|
||||
model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0));
|
||||
model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Flags"), translate("sd.hint", "Information about the use of the element"), null, 0));
|
||||
|
@ -653,11 +658,15 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
return model;
|
||||
}
|
||||
|
||||
public TableModel initComparisonTable(String prefix, String id) {
|
||||
public TableModel initComparisonTable(String prefix, String id) throws IOException {
|
||||
TableModel model = new TableModel(id, true);
|
||||
|
||||
model.setAlternating(true);
|
||||
if (mode == TableGenerationMode.XML) {
|
||||
model.setDocoImg(help16AsData()); // #FIXME
|
||||
} else {
|
||||
model.setDocoImg(Utilities.pathURL(prefix, "help16.png"));
|
||||
}
|
||||
model.setDocoRef(Utilities.pathURL(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));
|
||||
model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "L Flags"), translate("sd.hint", "Information about the use of the element - Left Structure"), null, 0).setStyle("border-left: 1px grey solid"));
|
||||
|
@ -913,6 +922,15 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
return corePrefix+filename;
|
||||
}
|
||||
|
||||
public static String help16AsData() throws IOException {
|
||||
ClassLoader classLoader = HierarchicalTableGenerator.class.getClassLoader();
|
||||
InputStream help = classLoader.getResourceAsStream("help16.PNG");
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append("data:image/png;base64,");
|
||||
byte[] bytes = TextFile.streamToBytes(help);
|
||||
b.append(new String(Base64.encodeBase64(bytes)));
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
private void checkModel(TableModel model) throws FHIRException {
|
||||
check(!model.getTitles().isEmpty(), "Must have titles");
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 714 B |
Loading…
Reference in New Issue