allow rendering additional information in a comparison

This commit is contained in:
Grahame Grieve 2022-09-20 04:47:59 -04:00
parent e044bf6607
commit 7f74b4521a
1 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,7 @@ public class ComparisonRenderer implements IEvaluationContext {
private ComparisonSession session; private ComparisonSession session;
private Map<String, String> templates = new HashMap<>(); private Map<String, String> templates = new HashMap<>();
private String folder; private String folder;
private String preamble;
public ComparisonRenderer(IWorkerContext contextLeft, IWorkerContext contextRight, String folder, ComparisonSession session) { public ComparisonRenderer(IWorkerContext contextLeft, IWorkerContext contextRight, String folder, ComparisonSession session) {
super(); super();
@ -53,6 +54,14 @@ public class ComparisonRenderer implements IEvaluationContext {
this.folder = folder; this.folder = folder;
this.session = session; this.session = session;
} }
public String getPreamble() {
return preamble;
}
public void setPreamble(String preamble) {
this.preamble = preamble;
}
public Map<String, String> getTemplates() { public Map<String, String> getTemplates() {
return templates; return templates;
@ -61,6 +70,9 @@ public class ComparisonRenderer implements IEvaluationContext {
public File render(String leftName, String rightName) throws IOException { public File render(String leftName, String rightName) throws IOException {
dumpBinaries(); dumpBinaries();
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
if (preamble != null) {
b.append(preamble);
}
b.append("<table class=\"grid\">\r\n"); b.append("<table class=\"grid\">\r\n");
b.append(" <tr>\r\n"); b.append(" <tr>\r\n");
b.append(" <td width=\"260\"><b>"+Utilities.escapeXml(leftName)+"</b></td>\r\n"); b.append(" <td width=\"260\"><b>"+Utilities.escapeXml(leftName)+"</b></td>\r\n");