ref 17249: Save produced charts as report
https://support.d4science.org/issues/17249 Added PDF support for SynopticTable
This commit is contained in:
parent
6d9089fb12
commit
441c06203f
|
@ -559,25 +559,23 @@ public class BoxPlotAnnualPanelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < outputIteration) {
|
if (i < outputIteration) {
|
||||||
//var numberOfPages=pdoc.internal.getNumberOfPages();
|
|
||||||
//console.log('NumberOfPages: '+numberOfPages);
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
|
||||||
console.log('CurrentPage: ' + currentPage);
|
|
||||||
var footner = 'Page ' + currentPage;
|
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
|
||||||
pdoc.addPage();
|
pdoc.addPage();
|
||||||
|
|
||||||
yPos = tMargin; // Restart position
|
yPos = tMargin; // Restart position
|
||||||
} else {
|
} else {
|
||||||
if (i = outputIteration) {
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
|
||||||
console.log('CurrentPage: ' + currentPage);
|
|
||||||
var footner = 'Page ' + currentPage;
|
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var numberOfPages=pdoc.internal.getNumberOfPages()
|
||||||
|
console.log('NumberOfPages: ' + numberOfPages);
|
||||||
|
for (var k = 1; k <= numberOfPages; k++) {
|
||||||
|
pdoc.setPage(k);
|
||||||
|
console.log('CurrentPage: ' + k);
|
||||||
|
var footner = 'Page ' + k + "/"+numberOfPages;
|
||||||
|
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Done');
|
console.log('Done');
|
||||||
|
|
|
@ -519,25 +519,23 @@ public class ScatterAnnualPanelResult {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (pdfHeightInMM - yPos < pdfHeightInMM / 4) {
|
if (pdfHeightInMM - yPos < pdfHeightInMM / 4) {
|
||||||
//var numberOfPages=pdoc.internal.getNumberOfPages();
|
|
||||||
//console.log('NumberOfPages: '+numberOfPages);
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
|
||||||
console.log('CurrentPage: ' + currentPage);
|
|
||||||
var footner = 'Page ' + currentPage;
|
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
|
||||||
pdoc.addPage();
|
pdoc.addPage();
|
||||||
|
|
||||||
yPos = tMargin; // Restart position
|
yPos = tMargin; // Restart position
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
var numberOfPages=pdoc.internal.getNumberOfPages()
|
||||||
console.log('CurrentPage: ' + currentPage);
|
console.log('NumberOfPages: ' + numberOfPages);
|
||||||
var footner = 'Page ' + currentPage;
|
for (var k = 1; k <= numberOfPages; k++) {
|
||||||
|
pdoc.setPage(k);
|
||||||
|
console.log('CurrentPage: ' + k);
|
||||||
|
var footner = 'Page ' + k + "/"+numberOfPages;
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Done');
|
console.log('Done');
|
||||||
|
|
||||||
pdoc.save(filename);
|
pdoc.save(filename);
|
||||||
|
|
|
@ -547,25 +547,23 @@ public class SpeedometerAnnualPanelResult {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (pdfHeightInMM - yPos < pdfHeightInMM / 4) {
|
if (pdfHeightInMM - yPos < pdfHeightInMM / 4) {
|
||||||
//var numberOfPages=pdoc.internal.getNumberOfPages();
|
|
||||||
//console.log('NumberOfPages: '+numberOfPages);
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
|
||||||
console.log('CurrentPage: ' + currentPage);
|
|
||||||
var footner = 'Page ' + currentPage;
|
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
|
||||||
pdoc.addPage();
|
pdoc.addPage();
|
||||||
|
|
||||||
yPos = tMargin; // Restart position
|
yPos = tMargin; // Restart position
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
var numberOfPages=pdoc.internal.getNumberOfPages()
|
||||||
console.log('CurrentPage: ' + currentPage);
|
console.log('NumberOfPages: ' + numberOfPages);
|
||||||
var footner = 'Page ' + currentPage;
|
for (var k = 1; k <= numberOfPages; k++) {
|
||||||
|
pdoc.setPage(k);
|
||||||
|
console.log('CurrentPage: ' + k);
|
||||||
|
var footner = 'Page ' + k + "/"+numberOfPages;
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Done');
|
console.log('Done');
|
||||||
|
|
||||||
pdoc.save(filename);
|
pdoc.save(filename);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class SynopticTableAnnualPanelResult {
|
||||||
|
|
||||||
private PerformFishAnnualAnalyticsViewController viewAnnualController;
|
private PerformFishAnnualAnalyticsViewController viewAnnualController;
|
||||||
private int requestId;
|
private int requestId;
|
||||||
private int outputIteration = 0;
|
private int outputIteration = 1;
|
||||||
private int outputNumber = 0;
|
private int outputNumber = 0;
|
||||||
|
|
||||||
public SynopticTableAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController,
|
public SynopticTableAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController,
|
||||||
|
@ -77,7 +77,6 @@ public class SynopticTableAnnualPanelResult {
|
||||||
|
|
||||||
res.add(savePDFButton);
|
res.add(savePDFButton);
|
||||||
submitRequestPanel.addWidget(res);
|
submitRequestPanel.addWidget(res);
|
||||||
outputIteration = 1;
|
|
||||||
|
|
||||||
StringBuilder dataInputsFormatter = new StringBuilder();
|
StringBuilder dataInputsFormatter = new StringBuilder();
|
||||||
Map<String, String> performFishResponseMap = performFishResponse.getMapParameters();
|
Map<String, String> performFishResponseMap = performFishResponse.getMapParameters();
|
||||||
|
@ -126,14 +125,15 @@ public class SynopticTableAnnualPanelResult {
|
||||||
// field_unary_algorithm.setVisible(true);
|
// field_unary_algorithm.setVisible(true);
|
||||||
GWT.log("I'm displaying: " + dmResponse);
|
GWT.log("I'm displaying: " + dmResponse);
|
||||||
displayOutputFilesAsStaticEntities(dmResponse, algorithm, null, null, null, panelContainer,
|
displayOutputFilesAsStaticEntities(dmResponse, algorithm, null, null, null, panelContainer,
|
||||||
false, 1);
|
false, outputIteration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
loaderIcon.setVisible(false);
|
loaderIcon.setVisible(false);
|
||||||
checkTabSpinner(submitRequestPanel, tab);
|
checkTabSpinner(submitRequestPanel, tab);
|
||||||
displayOutputFilesAsStaticEntities(null, algorithm, null, null, null, panelContainer, true, 1);
|
displayOutputFilesAsStaticEntities(null, algorithm, null, null, null, panelContainer, true,
|
||||||
|
outputIteration);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -184,9 +184,20 @@ public class SynopticTableAnnualPanelResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getOutputId(int oIteration, boolean isLegend) {
|
||||||
|
String outputId;
|
||||||
|
if (isLegend) {
|
||||||
|
outputId = "OutputId_" + requestId + "_" + oIteration + "_" + 1;
|
||||||
|
} else {
|
||||||
|
outputNumber++;
|
||||||
|
outputId = "OutputId_" + requestId + "_" + oIteration + "_" + outputNumber;
|
||||||
|
}
|
||||||
|
return outputId;
|
||||||
|
}
|
||||||
|
|
||||||
private void displayOutputFilesAsStaticEntities(final DataMinerResponse dmResponse,
|
private void displayOutputFilesAsStaticEntities(final DataMinerResponse dmResponse,
|
||||||
final DataMinerAlgorithms chartType, List<KPI> inputKPIs, List<KPI> outputKPIs, final String focusID,
|
final DataMinerAlgorithms chartType, List<KPI> inputKPIs, List<KPI> outputKPIs, final String focusID,
|
||||||
final Panel container, boolean displayError, int oIteration) {
|
final Panel container, boolean displayError, final int oIteration) {
|
||||||
|
|
||||||
String title = displayError ? "No results " : "";
|
String title = displayError ? "No results " : "";
|
||||||
|
|
||||||
|
@ -201,13 +212,9 @@ public class SynopticTableAnnualPanelResult {
|
||||||
|
|
||||||
final String toTitle = title;
|
final String toTitle = title;
|
||||||
|
|
||||||
|
outputNumber = 1;
|
||||||
|
|
||||||
int oNumber = 0;
|
|
||||||
|
|
||||||
for (OutputFile outputFile : dmResponse.getListOutput()) {
|
for (OutputFile outputFile : dmResponse.getListOutput()) {
|
||||||
oNumber++;
|
|
||||||
final String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + oNumber;
|
|
||||||
final FileContentType fileContentType = outputFile.getDataType();
|
final FileContentType fileContentType = outputFile.getDataType();
|
||||||
|
|
||||||
switch (outputFile.getDataType()) {
|
switch (outputFile.getDataType()) {
|
||||||
|
@ -229,6 +236,7 @@ public class SynopticTableAnnualPanelResult {
|
||||||
|
|
||||||
String title = toTitle;
|
String title = toTitle;
|
||||||
|
|
||||||
|
String outputId = getOutputId(oIteration, false);
|
||||||
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
|
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
|
||||||
showResult.showImage(base64Content);
|
showResult.showImage(base64Content);
|
||||||
container.add(showResult);
|
container.add(showResult);
|
||||||
|
@ -257,13 +265,16 @@ public class SynopticTableAnnualPanelResult {
|
||||||
String title = toTitle;
|
String title = toTitle;
|
||||||
switch (chartType) {
|
switch (chartType) {
|
||||||
case PERFORMFISH_SYNOPTIC_TABLE_FARM:
|
case PERFORMFISH_SYNOPTIC_TABLE_FARM:
|
||||||
|
String outputId;
|
||||||
if (!result.getFileName().contains("legend")) {
|
if (!result.getFileName().contains("legend")) {
|
||||||
cssTableStyle = "synoptictable-farm";
|
cssTableStyle = "synoptictable-farm";
|
||||||
|
outputId = getOutputId(oIteration, false);
|
||||||
} else {
|
} else {
|
||||||
cssTableStyle = "simpletable-synoptic";
|
cssTableStyle = "simpletable-synoptic";
|
||||||
|
outputId = getOutputId(oIteration, true);
|
||||||
}
|
}
|
||||||
ShowResult showResultSin = new ShowResult(outputId, title,
|
|
||||||
fileContentType);
|
ShowResult showResultSin = new ShowResult(outputId, title, fileContentType);
|
||||||
showResultSin.showCSVFile(result, cssTableStyle);
|
showResultSin.showCSVFile(result, cssTableStyle);
|
||||||
displayingOrderedSynopticTable(dmResponse, result.getFileName(), container,
|
displayingOrderedSynopticTable(dmResponse, result.getFileName(), container,
|
||||||
showResultSin);
|
showResultSin);
|
||||||
|
@ -278,6 +289,7 @@ public class SynopticTableAnnualPanelResult {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String outputId = getOutputId(oIteration, false);
|
||||||
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
|
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
|
||||||
showResult.showCSVFile(result, cssTableStyle);
|
showResult.showCSVFile(result, cssTableStyle);
|
||||||
container.add(showResult);
|
container.add(showResult);
|
||||||
|
@ -291,12 +303,8 @@ public class SynopticTableAnnualPanelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
outputNumber=oNumber;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void displayingOrderedSynopticTable(final DataMinerResponse dmResponse, String fileName,
|
private void displayingOrderedSynopticTable(final DataMinerResponse dmResponse, String fileName,
|
||||||
final Panel container, ShowResult showResult) {
|
final Panel container, ShowResult showResult) {
|
||||||
int hashcode = dmResponse.hashCode();
|
int hashcode = dmResponse.hashCode();
|
||||||
|
@ -389,11 +397,85 @@ public class SynopticTableAnnualPanelResult {
|
||||||
// foo could get resolved and it's defined
|
// foo could get resolved and it's defined
|
||||||
|
|
||||||
var childrenTable = resultOutputNumber.children;
|
var childrenTable = resultOutputNumber.children;
|
||||||
|
var titleCurrentTable = childrenTable[0].rows[0].cells[0];
|
||||||
|
console.log('Title current table: '
|
||||||
|
+ titleCurrentTable.textContent);
|
||||||
|
yPos += 2;
|
||||||
|
pdoc.setFontSize(10);
|
||||||
|
pdoc.setFontType("bold");
|
||||||
|
pdoc.text(titleCurrentTable.textContent, xPos, yPos,
|
||||||
|
'left');
|
||||||
|
yPos += 6;
|
||||||
|
|
||||||
|
pdoc.setFontSize(10);
|
||||||
|
pdoc.setFontType("normal");
|
||||||
|
|
||||||
var secondDiv = childrenTable[0].rows[1].cells[0];
|
var secondDiv = childrenTable[0].rows[1].cells[0];
|
||||||
var secondTable = secondDiv.children[0].children[0];
|
var secondTable = secondDiv.children[0].children[0];
|
||||||
|
|
||||||
console.log('CSV SecondTable: ' + secondTable);
|
console.log('CSV SecondTable: ' + secondTable);
|
||||||
|
|
||||||
|
var checkColor = function(data) {
|
||||||
|
if (data.section === 'body') {
|
||||||
|
console.log(data);
|
||||||
|
var good = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: limegreen; border: 1px solid limegreen;"></span></div>';
|
||||||
|
var normal = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: yellow; border: 1px solid yellow;"></span></div>';
|
||||||
|
var bad = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: red;border: 1px solid red;"></span></div>';
|
||||||
|
|
||||||
|
if (typeof data.cell !== 'undefined'
|
||||||
|
&& data.cell !== null) {
|
||||||
|
if (typeof data.cell.raw !== 'undefined'
|
||||||
|
&& data.cell.raw !== null) {
|
||||||
|
|
||||||
|
console.log(data.cell.raw.innerHTML);
|
||||||
|
if (data.cell.raw.innerHTML === good) {
|
||||||
|
console.log('good');
|
||||||
|
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||||
|
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||||
|
var greenImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAbSM8+wB/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABBQIf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPwEf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPwEf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQAGPwIf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPyEf/9oADAMBAAIAAwAAABAAD//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8QH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8QH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8QH//Z'
|
||||||
|
pdoc.addImage(greenImg, 'JPEG', posIW, posIH, 4, 4);
|
||||||
|
//pdoc.setFontSize(10);
|
||||||
|
//pdoc.setFontType("normal");
|
||||||
|
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||||
|
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||||
|
//pdoc.text('G', posW, posH,'center');
|
||||||
|
} else {
|
||||||
|
if (data.cell.raw.innerHTML === normal) {
|
||||||
|
console.log('normal');
|
||||||
|
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||||
|
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||||
|
var yellowImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAn/xAAWAQEBAQAAAAAAAAAAAAAAAAAABwr/2gAMAwEAAhADEAAAAbEZ/wCqAD//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAEFAh//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/AR//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/AR//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAY/Ah//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/IR//2gAMAwEAAgADAAAAEAAP/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPxAf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPxAf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPxAf/9k='
|
||||||
|
pdoc.addImage(yellowImg, 'JPEG', posIW, posIH, 4, 4);
|
||||||
|
//pdoc.setFontSize(10);
|
||||||
|
//pdoc.setFontType("normal");
|
||||||
|
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||||
|
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||||
|
//pdoc.text('N', posW, posH,'center');
|
||||||
|
} else {
|
||||||
|
if (data.cell.raw.innerHTML === bad) {
|
||||||
|
console.log('bad');
|
||||||
|
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||||
|
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||||
|
var redImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAj/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAYvlPfwAf//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAQUCH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8BH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8BH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEABj8CH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8hH//aAAwDAQACAAMAAAAQAA//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/EB//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/EB//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/EB//2Q=='
|
||||||
|
pdoc.addImage(redImg, 'JPEG', posIW, posIH, 4, 4);
|
||||||
|
//pdoc.setFontSize(10);
|
||||||
|
//pdoc.setFontType("normal");
|
||||||
|
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||||
|
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||||
|
//pdoc.text('B', posW, posH,'center');
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
pdoc.autoTable({
|
pdoc.autoTable({
|
||||||
theme : 'grid',
|
theme : 'grid',
|
||||||
startY : yPos,
|
startY : yPos,
|
||||||
|
@ -401,6 +483,7 @@ public class SynopticTableAnnualPanelResult {
|
||||||
bodyStyles : {
|
bodyStyles : {
|
||||||
fontSize : 9
|
fontSize : 9
|
||||||
},
|
},
|
||||||
|
didDrawCell : checkColor,
|
||||||
html : secondTable
|
html : secondTable
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -409,6 +492,20 @@ public class SynopticTableAnnualPanelResult {
|
||||||
if (resultType == 'image') {
|
if (resultType == 'image') {
|
||||||
console.log('Result Type image: ' + i);
|
console.log('Result Type image: ' + i);
|
||||||
var childrenTable = resultOutputNumber.children;
|
var childrenTable = resultOutputNumber.children;
|
||||||
|
|
||||||
|
var titleCurrentImage = childrenTable[0].rows[0].cells[0];
|
||||||
|
console.log('Title current image: '
|
||||||
|
+ titleCurrentImage.textContent);
|
||||||
|
yPos += 2;
|
||||||
|
pdoc.setFontSize(10);
|
||||||
|
pdoc.setFontType("bold");
|
||||||
|
pdoc.text(titleCurrentImage.textContent, xPos,
|
||||||
|
yPos, 'left');
|
||||||
|
yPos += 6;
|
||||||
|
|
||||||
|
pdoc.setFontSize(10);
|
||||||
|
pdoc.setFontType("normal");
|
||||||
|
|
||||||
var secondDiv = childrenTable[0].rows[1].cells[0];
|
var secondDiv = childrenTable[0].rows[1].cells[0];
|
||||||
var imageElement = secondDiv.getElementsByTagName(
|
var imageElement = secondDiv.getElementsByTagName(
|
||||||
'img').item(0);
|
'img').item(0);
|
||||||
|
@ -427,6 +524,26 @@ public class SynopticTableAnnualPanelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i == outputNumber) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (pdfHeightInMM - yPos < pdfHeightInMM / 7) {
|
||||||
|
pdoc.addPage();
|
||||||
|
yPos = tMargin; // Restart position
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var numberOfPages = pdoc.internal.getNumberOfPages();
|
||||||
|
console.log('NumberOfPages: ' + numberOfPages);
|
||||||
|
for (var k = 1; k <= numberOfPages; k++) {
|
||||||
|
pdoc.setPage(k);
|
||||||
|
console.log('CurrentPage: ' + k);
|
||||||
|
var footner = 'Page ' + k + "/" + numberOfPages;
|
||||||
|
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Done');
|
console.log('Done');
|
||||||
|
|
|
@ -510,25 +510,22 @@ public class BoxPlotPanelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < outputIteration) {
|
if (i < outputIteration) {
|
||||||
//var numberOfPages=pdoc.internal.getNumberOfPages();
|
|
||||||
//console.log('NumberOfPages: '+numberOfPages);
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
|
||||||
console.log('CurrentPage: ' + currentPage);
|
|
||||||
var footner = 'Page ' + currentPage;
|
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
|
||||||
pdoc.addPage();
|
pdoc.addPage();
|
||||||
|
|
||||||
yPos = tMargin; // Restart position
|
yPos = tMargin; // Restart position
|
||||||
} else {
|
} else {
|
||||||
if (i = outputIteration) {
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
|
||||||
console.log('CurrentPage: ' + currentPage);
|
|
||||||
var footner = 'Page ' + currentPage;
|
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var numberOfPages=pdoc.internal.getNumberOfPages()
|
||||||
|
console.log('NumberOfPages: ' + numberOfPages);
|
||||||
|
for (var k = 1; k <= numberOfPages; k++) {
|
||||||
|
pdoc.setPage(k);
|
||||||
|
console.log('CurrentPage: ' + k);
|
||||||
|
var footner = 'Page ' + k + "/"+numberOfPages;
|
||||||
|
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Done');
|
console.log('Done');
|
||||||
|
|
|
@ -468,25 +468,23 @@ public class ScatterPanelResult {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (pdfHeightInMM - yPos < pdfHeightInMM / 4) {
|
if (pdfHeightInMM - yPos < pdfHeightInMM / 4) {
|
||||||
//var numberOfPages=pdoc.internal.getNumberOfPages();
|
|
||||||
//console.log('NumberOfPages: '+numberOfPages);
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
|
||||||
console.log('CurrentPage: ' + currentPage);
|
|
||||||
var footner = 'Page ' + currentPage;
|
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
|
||||||
pdoc.addPage();
|
pdoc.addPage();
|
||||||
|
|
||||||
yPos = tMargin; // Restart position
|
yPos = tMargin; // Restart position
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
var numberOfPages=pdoc.internal.getNumberOfPages()
|
||||||
console.log('CurrentPage: ' + currentPage);
|
console.log('NumberOfPages: ' + numberOfPages);
|
||||||
var footner = 'Page ' + currentPage;
|
for (var k = 1; k <= numberOfPages; k++) {
|
||||||
|
pdoc.setPage(k);
|
||||||
|
console.log('CurrentPage: ' + k);
|
||||||
|
var footner = 'Page ' + k + "/"+numberOfPages;
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Done');
|
console.log('Done');
|
||||||
|
|
||||||
pdoc.save(filename);
|
pdoc.save(filename);
|
||||||
|
|
|
@ -469,25 +469,23 @@ public class SpeedometerPanelResult {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (pdfHeightInMM - yPos < pdfHeightInMM / 4) {
|
if (pdfHeightInMM - yPos < pdfHeightInMM / 4) {
|
||||||
//var numberOfPages=pdoc.internal.getNumberOfPages();
|
|
||||||
//console.log('NumberOfPages: '+numberOfPages);
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
|
||||||
console.log('CurrentPage: ' + currentPage);
|
|
||||||
var footner = 'Page ' + currentPage;
|
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
|
||||||
pdoc.addPage();
|
pdoc.addPage();
|
||||||
|
|
||||||
yPos = tMargin; // Restart position
|
yPos = tMargin; // Restart position
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
var numberOfPages=pdoc.internal.getNumberOfPages()
|
||||||
console.log('CurrentPage: ' + currentPage);
|
console.log('NumberOfPages: ' + numberOfPages);
|
||||||
var footner = 'Page ' + currentPage;
|
for (var k = 1; k <= numberOfPages; k++) {
|
||||||
|
pdoc.setPage(k);
|
||||||
|
console.log('CurrentPage: ' + k);
|
||||||
|
var footner = 'Page ' + k + "/"+numberOfPages;
|
||||||
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Done');
|
console.log('Done');
|
||||||
|
|
||||||
pdoc.save(filename);
|
pdoc.save(filename);
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class SynopticTablePanelResult {
|
||||||
|
|
||||||
private PerformFishAnalyticsViewController viewController;
|
private PerformFishAnalyticsViewController viewController;
|
||||||
private int requestId;
|
private int requestId;
|
||||||
private int outputIteration = 0;
|
private int outputIteration = 1;
|
||||||
private int outputNumber = 0;
|
private int outputNumber = 0;
|
||||||
|
|
||||||
public SynopticTablePanelResult(int reqId, PerformFishAnalyticsViewController viewController,
|
public SynopticTablePanelResult(int reqId, PerformFishAnalyticsViewController viewController,
|
||||||
|
@ -119,7 +119,6 @@ public class SynopticTablePanelResult {
|
||||||
|
|
||||||
res.add(savePDFButton);
|
res.add(savePDFButton);
|
||||||
submitRequestPanel.addWidget(res);
|
submitRequestPanel.addWidget(res);
|
||||||
outputIteration=1;
|
|
||||||
|
|
||||||
final HTMLPanel panelContainer = submitRequestPanel.getContainerPanel();
|
final HTMLPanel panelContainer = submitRequestPanel.getContainerPanel();
|
||||||
|
|
||||||
|
@ -146,7 +145,7 @@ public class SynopticTablePanelResult {
|
||||||
// field_unary_algorithm.setVisible(true);
|
// field_unary_algorithm.setVisible(true);
|
||||||
GWT.log("I'm displaying: " + dmResponse);
|
GWT.log("I'm displaying: " + dmResponse);
|
||||||
displayOutputFilesAsStaticEntities(dmResponse, toFinalChartType, null, null, null,
|
displayOutputFilesAsStaticEntities(dmResponse, toFinalChartType, null, null, null,
|
||||||
panelContainer, false, 1);
|
panelContainer, false, outputIteration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -154,7 +153,7 @@ public class SynopticTablePanelResult {
|
||||||
loaderIcon.setVisible(false);
|
loaderIcon.setVisible(false);
|
||||||
checkTabSpinner(submitRequestPanel, tab);
|
checkTabSpinner(submitRequestPanel, tab);
|
||||||
displayOutputFilesAsStaticEntities(null, toFinalChartType, null, null, null, panelContainer,
|
displayOutputFilesAsStaticEntities(null, toFinalChartType, null, null, null, panelContainer,
|
||||||
true, 1);
|
true, outputIteration);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -179,9 +178,20 @@ public class SynopticTablePanelResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getOutputId(int oIteration, boolean isLegend) {
|
||||||
|
String outputId;
|
||||||
|
if (isLegend) {
|
||||||
|
outputId = "OutputId_" + requestId + "_" + oIteration + "_" + 1;
|
||||||
|
} else {
|
||||||
|
outputNumber++;
|
||||||
|
outputId = "OutputId_" + requestId + "_" + oIteration + "_" + outputNumber;
|
||||||
|
}
|
||||||
|
return outputId;
|
||||||
|
}
|
||||||
|
|
||||||
private void displayOutputFilesAsStaticEntities(final DataMinerResponse dmResponse,
|
private void displayOutputFilesAsStaticEntities(final DataMinerResponse dmResponse,
|
||||||
final DataMinerAlgorithms chartType, List<KPI> inputKPIs, List<KPI> outputKPIs, final String focusID,
|
final DataMinerAlgorithms chartType, List<KPI> inputKPIs, List<KPI> outputKPIs, final String focusID,
|
||||||
final Panel container, boolean displayError, int oIteration) {
|
final Panel container, boolean displayError, final int oIteration) {
|
||||||
|
|
||||||
String title = displayError ? "No results " : "";
|
String title = displayError ? "No results " : "";
|
||||||
|
|
||||||
|
@ -195,12 +205,10 @@ public class SynopticTablePanelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
final String toTitle = title;
|
final String toTitle = title;
|
||||||
|
outputNumber = 1;
|
||||||
int oNumber = 0;
|
|
||||||
|
|
||||||
for (OutputFile outputFile : dmResponse.getListOutput()) {
|
for (OutputFile outputFile : dmResponse.getListOutput()) {
|
||||||
oNumber++;
|
|
||||||
final String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + oNumber;
|
|
||||||
final FileContentType fileContentType = outputFile.getDataType();
|
final FileContentType fileContentType = outputFile.getDataType();
|
||||||
|
|
||||||
switch (outputFile.getDataType()) {
|
switch (outputFile.getDataType()) {
|
||||||
|
@ -222,6 +230,7 @@ public class SynopticTablePanelResult {
|
||||||
|
|
||||||
String title = toTitle;
|
String title = toTitle;
|
||||||
|
|
||||||
|
String outputId = getOutputId(oIteration, false);
|
||||||
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
|
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
|
||||||
showResult.showImage(base64Content);
|
showResult.showImage(base64Content);
|
||||||
container.add(showResult);
|
container.add(showResult);
|
||||||
|
@ -253,14 +262,16 @@ public class SynopticTablePanelResult {
|
||||||
case PERFORMFISH_SYNOPTICTABLE_BATCH_HATCHERY:
|
case PERFORMFISH_SYNOPTICTABLE_BATCH_HATCHERY:
|
||||||
case PERFORMFISH_SYNOPTICTABLE_BATCH_PREGROW:
|
case PERFORMFISH_SYNOPTICTABLE_BATCH_PREGROW:
|
||||||
|
|
||||||
|
String outputId;
|
||||||
if (!result.getFileName().contains("legend")) {
|
if (!result.getFileName().contains("legend")) {
|
||||||
cssTableStyle = "synoptictable-batch";
|
cssTableStyle = "synoptictable-farm";
|
||||||
|
outputId = getOutputId(oIteration, false);
|
||||||
} else {
|
} else {
|
||||||
cssTableStyle = "simpletable-synoptic";
|
cssTableStyle = "simpletable-synoptic";
|
||||||
|
outputId = getOutputId(oIteration, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowResult showResultSin = new ShowResult(outputId, title,
|
ShowResult showResultSin = new ShowResult(outputId, title, fileContentType);
|
||||||
fileContentType);
|
|
||||||
showResultSin.showCSVFile(result, cssTableStyle);
|
showResultSin.showCSVFile(result, cssTableStyle);
|
||||||
displayingOrderedSynopticTable(dmResponse, result.getFileName(), container,
|
displayingOrderedSynopticTable(dmResponse, result.getFileName(), container,
|
||||||
showResultSin);
|
showResultSin);
|
||||||
|
@ -272,6 +283,8 @@ public class SynopticTablePanelResult {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// ALL OTHER CASES
|
// ALL OTHER CASES
|
||||||
|
|
||||||
|
String outputId = getOutputId(oIteration, false);
|
||||||
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
|
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
|
||||||
showResult.showCSVFile(result, cssTableStyle);
|
showResult.showCSVFile(result, cssTableStyle);
|
||||||
container.add(showResult);
|
container.add(showResult);
|
||||||
|
@ -285,8 +298,6 @@ public class SynopticTablePanelResult {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outputNumber = oNumber;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayingOrderedSynopticTable(final DataMinerResponse dmResponse, String fileName,
|
private void displayingOrderedSynopticTable(final DataMinerResponse dmResponse, String fileName,
|
||||||
|
@ -381,11 +392,85 @@ public class SynopticTablePanelResult {
|
||||||
// foo could get resolved and it's defined
|
// foo could get resolved and it's defined
|
||||||
|
|
||||||
var childrenTable = resultOutputNumber.children;
|
var childrenTable = resultOutputNumber.children;
|
||||||
|
var titleCurrentTable = childrenTable[0].rows[0].cells[0];
|
||||||
|
console.log('Title current table: '
|
||||||
|
+ titleCurrentTable.textContent);
|
||||||
|
yPos += 2;
|
||||||
|
pdoc.setFontSize(10);
|
||||||
|
pdoc.setFontType("bold");
|
||||||
|
pdoc.text(titleCurrentTable.textContent, xPos, yPos,
|
||||||
|
'left');
|
||||||
|
yPos += 6;
|
||||||
|
|
||||||
|
pdoc.setFontSize(10);
|
||||||
|
pdoc.setFontType("normal");
|
||||||
|
|
||||||
var secondDiv = childrenTable[0].rows[1].cells[0];
|
var secondDiv = childrenTable[0].rows[1].cells[0];
|
||||||
var secondTable = secondDiv.children[0].children[0];
|
var secondTable = secondDiv.children[0].children[0];
|
||||||
|
|
||||||
console.log('CSV SecondTable: ' + secondTable);
|
console.log('CSV SecondTable: ' + secondTable);
|
||||||
|
|
||||||
|
var checkColor = function(data) {
|
||||||
|
if (data.section === 'body') {
|
||||||
|
console.log(data);
|
||||||
|
var good = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: limegreen; border: 1px solid limegreen;"></span></div>';
|
||||||
|
var normal = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: yellow; border: 1px solid yellow;"></span></div>';
|
||||||
|
var bad = '<div class="gwt-HTML"><span style="padding-left: 10px; padding-right: 10px; background-color: red;border: 1px solid red;"></span></div>';
|
||||||
|
|
||||||
|
if (typeof data.cell !== 'undefined'
|
||||||
|
&& data.cell !== null) {
|
||||||
|
if (typeof data.cell.raw !== 'undefined'
|
||||||
|
&& data.cell.raw !== null) {
|
||||||
|
|
||||||
|
console.log(data.cell.raw.innerHTML);
|
||||||
|
if (data.cell.raw.innerHTML === good) {
|
||||||
|
console.log('good');
|
||||||
|
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||||
|
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||||
|
var greenImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAbSM8+wB/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABBQIf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPwEf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPwEf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQAGPwIf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPyEf/9oADAMBAAIAAwAAABAAD//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8QH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8QH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8QH//Z'
|
||||||
|
pdoc.addImage(greenImg, 'JPEG', posIW, posIH, 4, 4);
|
||||||
|
//pdoc.setFontSize(10);
|
||||||
|
//pdoc.setFontType("normal");
|
||||||
|
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||||
|
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||||
|
//pdoc.text('G', posW, posH,'center');
|
||||||
|
} else {
|
||||||
|
if (data.cell.raw.innerHTML === normal) {
|
||||||
|
console.log('normal');
|
||||||
|
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||||
|
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||||
|
var yellowImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAn/xAAWAQEBAQAAAAAAAAAAAAAAAAAABwr/2gAMAwEAAhADEAAAAbEZ/wCqAD//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAEFAh//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/AR//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/AR//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAY/Ah//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/IR//2gAMAwEAAgADAAAAEAAP/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPxAf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPxAf/8QAFBABAAAAAAAAAAAAAAAAAAAAIP/aAAgBAQABPxAf/9k='
|
||||||
|
pdoc.addImage(yellowImg, 'JPEG', posIW, posIH, 4, 4);
|
||||||
|
//pdoc.setFontSize(10);
|
||||||
|
//pdoc.setFontType("normal");
|
||||||
|
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||||
|
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||||
|
//pdoc.text('N', posW, posH,'center');
|
||||||
|
} else {
|
||||||
|
if (data.cell.raw.innerHTML === bad) {
|
||||||
|
console.log('bad');
|
||||||
|
var posIW = (data.cell.x + (data.cell.width / 2)-2);
|
||||||
|
var posIH = (data.cell.y + (data.cell.height / 2)-2);
|
||||||
|
var redImg = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAKAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAj/xAAWAQEBAQAAAAAAAAAAAAAAAAAACAn/2gAMAwEAAhADEAAAAYvlPfwAf//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAQUCH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQMBAT8BH//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8BH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEABj8CH//EABQQAQAAAAAAAAAAAAAAAAAAACD/2gAIAQEAAT8hH//aAAwDAQACAAMAAAAQAA//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAEDAQE/EB//xAAUEQEAAAAAAAAAAAAAAAAAAAAg/9oACAECAQE/EB//xAAUEAEAAAAAAAAAAAAAAAAAAAAg/9oACAEBAAE/EB//2Q=='
|
||||||
|
pdoc.addImage(redImg, 'JPEG', posIW, posIH, 4, 4);
|
||||||
|
//pdoc.setFontSize(10);
|
||||||
|
//pdoc.setFontType("normal");
|
||||||
|
//var posW = (data.cell.x + (data.cell.width / 2));
|
||||||
|
//var posH = (data.cell.y + (data.cell.height / 2));
|
||||||
|
//pdoc.text('B', posW, posH,'center');
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
pdoc.autoTable({
|
pdoc.autoTable({
|
||||||
theme : 'grid',
|
theme : 'grid',
|
||||||
startY : yPos,
|
startY : yPos,
|
||||||
|
@ -393,6 +478,7 @@ public class SynopticTablePanelResult {
|
||||||
bodyStyles : {
|
bodyStyles : {
|
||||||
fontSize : 9
|
fontSize : 9
|
||||||
},
|
},
|
||||||
|
didDrawCell : checkColor,
|
||||||
html : secondTable
|
html : secondTable
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -401,6 +487,20 @@ public class SynopticTablePanelResult {
|
||||||
if (resultType == 'image') {
|
if (resultType == 'image') {
|
||||||
console.log('Result Type image: ' + i);
|
console.log('Result Type image: ' + i);
|
||||||
var childrenTable = resultOutputNumber.children;
|
var childrenTable = resultOutputNumber.children;
|
||||||
|
|
||||||
|
var titleCurrentImage = childrenTable[0].rows[0].cells[0];
|
||||||
|
console.log('Title current image: '
|
||||||
|
+ titleCurrentImage.textContent);
|
||||||
|
yPos += 2;
|
||||||
|
pdoc.setFontSize(10);
|
||||||
|
pdoc.setFontType("bold");
|
||||||
|
pdoc.text(titleCurrentImage.textContent, xPos,
|
||||||
|
yPos, 'left');
|
||||||
|
yPos += 6;
|
||||||
|
|
||||||
|
pdoc.setFontSize(10);
|
||||||
|
pdoc.setFontType("normal");
|
||||||
|
|
||||||
var secondDiv = childrenTable[0].rows[1].cells[0];
|
var secondDiv = childrenTable[0].rows[1].cells[0];
|
||||||
var imageElement = secondDiv.getElementsByTagName(
|
var imageElement = secondDiv.getElementsByTagName(
|
||||||
'img').item(0);
|
'img').item(0);
|
||||||
|
@ -419,6 +519,26 @@ public class SynopticTablePanelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i == outputNumber) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (pdfHeightInMM - yPos < pdfHeightInMM / 7) {
|
||||||
|
pdoc.addPage();
|
||||||
|
yPos = tMargin; // Restart position
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var numberOfPages = pdoc.internal.getNumberOfPages();
|
||||||
|
console.log('NumberOfPages: ' + numberOfPages);
|
||||||
|
for (var k = 1; k <= numberOfPages; k++) {
|
||||||
|
pdoc.setPage(k);
|
||||||
|
console.log('CurrentPage: ' + k);
|
||||||
|
var footner = 'Page ' + k + "/" + numberOfPages;
|
||||||
|
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Done');
|
console.log('Done');
|
||||||
|
@ -426,5 +546,4 @@ public class SynopticTablePanelResult {
|
||||||
pdoc.save(filename);
|
pdoc.save(filename);
|
||||||
|
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue