ref 17249: Save produced charts as report
https://support.d4science.org/issues/17249 Added PDF support for Speedometer
This commit is contained in:
parent
8ca0cbeb69
commit
9177c518d1
|
@ -464,7 +464,7 @@ public class BoxPlotAnnualPanelResult {
|
||||||
var kpiName = $doc.getElementById(kpiId);
|
var kpiName = $doc.getElementById(kpiId);
|
||||||
|
|
||||||
yPos += 2;
|
yPos += 2;
|
||||||
pdoc.setFontSize(16);
|
pdoc.setFontSize(14);
|
||||||
pdoc.setFontType("bold");
|
pdoc.setFontType("bold");
|
||||||
pdoc.text(kpiName.textContent, xPos, yPos, 'left');
|
pdoc.text(kpiName.textContent, xPos, yPos, 'left');
|
||||||
yPos += 6;
|
yPos += 6;
|
||||||
|
@ -497,7 +497,7 @@ public class BoxPlotAnnualPanelResult {
|
||||||
console.log('Title current table: '
|
console.log('Title current table: '
|
||||||
+ titleCurrentTable.textContent);
|
+ titleCurrentTable.textContent);
|
||||||
yPos += 2;
|
yPos += 2;
|
||||||
pdoc.setFontSize(12);
|
pdoc.setFontSize(10);
|
||||||
pdoc.setFontType("bold");
|
pdoc.setFontType("bold");
|
||||||
pdoc.text(titleCurrentTable.textContent, xPos, yPos,
|
pdoc.text(titleCurrentTable.textContent, xPos, yPos,
|
||||||
'left');
|
'left');
|
||||||
|
@ -531,7 +531,7 @@ public class BoxPlotAnnualPanelResult {
|
||||||
console.log('Title current image: '
|
console.log('Title current image: '
|
||||||
+ titleCurrentImage.textContent);
|
+ titleCurrentImage.textContent);
|
||||||
yPos += 2;
|
yPos += 2;
|
||||||
pdoc.setFontSize(12);
|
pdoc.setFontSize(10);
|
||||||
pdoc.setFontType("bold");
|
pdoc.setFontType("bold");
|
||||||
pdoc.text(titleCurrentImage.textContent, xPos,
|
pdoc.text(titleCurrentImage.textContent, xPos,
|
||||||
yPos, 'left');
|
yPos, 'left');
|
||||||
|
|
|
@ -46,15 +46,15 @@ public class SpeedometerAnnualPanelResult {
|
||||||
private Map<Integer, FlexTable> boxPlotOrderBy = new HashMap<Integer, FlexTable>();
|
private Map<Integer, FlexTable> boxPlotOrderBy = new HashMap<Integer, FlexTable>();
|
||||||
|
|
||||||
private PerformFishAnnualAnalyticsViewController viewAnnualController;
|
private PerformFishAnnualAnalyticsViewController viewAnnualController;
|
||||||
|
private int requestId = 0;
|
||||||
private int outputIteration = 0;
|
private int outputIteration = 0;
|
||||||
private int outputNumber = 0;
|
private int outputNumber = 1;
|
||||||
private int requestId;
|
|
||||||
|
|
||||||
public SpeedometerAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController,
|
public SpeedometerAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController,
|
||||||
PerformFishResponse thePerformFishResponse,
|
PerformFishResponse thePerformFishResponse, final DataMinerAlgorithms algorithm, String focusID,
|
||||||
final DataMinerAlgorithms algorithm, String focusID, List<KPI> inputKPI, final List<KPI> outputKPI) {
|
List<KPI> inputKPI, final List<KPI> outputKPI) {
|
||||||
GWT.log("RequestID: "+reqId);
|
GWT.log("RequestID: " + reqId);
|
||||||
requestId=reqId;
|
requestId = reqId;
|
||||||
this.viewAnnualController = viewAnnualController;
|
this.viewAnnualController = viewAnnualController;
|
||||||
TextResource algDescr = PerformFishResources.INSTANCE.farm_SPEEDOMETER();
|
TextResource algDescr = PerformFishResources.INSTANCE.farm_SPEEDOMETER();
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ public class SpeedometerAnnualPanelResult {
|
||||||
oIteration++;
|
oIteration++;
|
||||||
String title = "KPI: " + kpi.getName();
|
String title = "KPI: " + kpi.getName();
|
||||||
HTML toBigTitle = new HTML(title);
|
HTML toBigTitle = new HTML(title);
|
||||||
|
toBigTitle.getElement().setId("KPI_SpeedometerAnnual_" + requestId + "_" + oIteration);
|
||||||
toBigTitle.getElement().addClassName("to-big-title");
|
toBigTitle.getElement().addClassName("to-big-title");
|
||||||
submitRequestPanel.addWidget(toBigTitle);
|
submitRequestPanel.addWidget(toBigTitle);
|
||||||
HorizontalPanel hp = new HorizontalPanel();
|
HorizontalPanel hp = new HorizontalPanel();
|
||||||
|
@ -117,11 +118,12 @@ public class SpeedometerAnnualPanelResult {
|
||||||
* the panel
|
* the panel
|
||||||
* @param tab
|
* @param tab
|
||||||
* the tab
|
* the tab
|
||||||
* @param tabDescr
|
* @param tabDescr
|
||||||
* @param tabTitle
|
* @param tabTitle
|
||||||
*/
|
*/
|
||||||
private void callDataMinerServiceForChart(final DataMinerInputParameters dmInputParameters,
|
private void callDataMinerServiceForChart(final DataMinerInputParameters dmInputParameters,
|
||||||
final SubmitRequestPanel requestPanel, final ComplexPanel panelContainer, final Tab tab, final int oIteration) {
|
final SubmitRequestPanel requestPanel, final ComplexPanel panelContainer, final Tab tab,
|
||||||
|
final int oIteration) {
|
||||||
|
|
||||||
GWT.log("Building DM request with input parameters: " + dmInputParameters);
|
GWT.log("Building DM request with input parameters: " + dmInputParameters);
|
||||||
|
|
||||||
|
@ -207,7 +209,7 @@ public class SpeedometerAnnualPanelResult {
|
||||||
GWT.log("I'm displaying: " + dmResponse);
|
GWT.log("I'm displaying: " + dmResponse);
|
||||||
displayOutputFilesAsStaticEntities(dmResponse, dmInputParameters.getChartType(),
|
displayOutputFilesAsStaticEntities(dmResponse, dmInputParameters.getChartType(),
|
||||||
dmInputParameters.getInputKPI(), dmInputParameters.getOutputKPI(),
|
dmInputParameters.getInputKPI(), dmInputParameters.getOutputKPI(),
|
||||||
dmInputParameters.getFocusID(), panelContainer, false,oIteration);
|
dmInputParameters.getFocusID(), panelContainer, false, oIteration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -216,13 +218,12 @@ public class SpeedometerAnnualPanelResult {
|
||||||
checkTabSpinner(requestPanel, tab);
|
checkTabSpinner(requestPanel, tab);
|
||||||
displayOutputFilesAsStaticEntities(null, dmInputParameters.getChartType(),
|
displayOutputFilesAsStaticEntities(null, dmInputParameters.getChartType(),
|
||||||
dmInputParameters.getInputKPI(), dmInputParameters.getOutputKPI(),
|
dmInputParameters.getInputKPI(), dmInputParameters.getOutputKPI(),
|
||||||
dmInputParameters.getFocusID(), panelContainer, true,oIteration);
|
dmInputParameters.getFocusID(), panelContainer, true, oIteration);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append DM input table.
|
* Append DM input table.
|
||||||
*
|
*
|
||||||
|
@ -246,10 +247,15 @@ public class SpeedometerAnnualPanelResult {
|
||||||
return dataInputsFormatter;
|
return dataInputsFormatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getOutputId(int oIteration, String title) {
|
||||||
|
String outputId = "OutputId_" + requestId + "_" + oIteration + "_" + 1;
|
||||||
|
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 " : "";
|
||||||
|
|
||||||
|
@ -264,13 +270,9 @@ public class SpeedometerAnnualPanelResult {
|
||||||
|
|
||||||
final String toTitle = title;
|
final String toTitle = title;
|
||||||
|
|
||||||
int oNumber = 0;
|
|
||||||
|
|
||||||
for (OutputFile outputFile : dmResponse.getListOutput()) {
|
for (OutputFile outputFile : dmResponse.getListOutput()) {
|
||||||
oNumber++;
|
final FileContentType fileContentType = outputFile.getDataType();
|
||||||
final String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + oNumber;
|
|
||||||
final FileContentType fileContentType= outputFile.getDataType();
|
|
||||||
|
|
||||||
switch (outputFile.getDataType()) {
|
switch (outputFile.getDataType()) {
|
||||||
case IMAGE:
|
case IMAGE:
|
||||||
PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile,
|
PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile,
|
||||||
|
@ -293,11 +295,12 @@ public class SpeedometerAnnualPanelResult {
|
||||||
title = chartType.getTitle() + "<br>";
|
title = chartType.getTitle() + "<br>";
|
||||||
title += "Selected Farm: " + focusID + "<br>";
|
title += "Selected Farm: " + focusID + "<br>";
|
||||||
title += "Normalized with respect to all farm data in the VRE";
|
title += "Normalized with respect to all farm data in the VRE";
|
||||||
|
|
||||||
|
String outputId = getOutputId(oIteration, title);
|
||||||
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -321,6 +324,7 @@ public class SpeedometerAnnualPanelResult {
|
||||||
|
|
||||||
String title = toTitle;
|
String title = toTitle;
|
||||||
|
|
||||||
|
String outputId = getOutputId(oIteration, title);
|
||||||
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);
|
||||||
|
@ -334,8 +338,6 @@ public class SpeedometerAnnualPanelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outputNumber=oNumber;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,6 +433,20 @@ public class SpeedometerAnnualPanelResult {
|
||||||
|
|
||||||
for (var i = 1; i <= outputIteration; i++) {
|
for (var i = 1; i <= outputIteration; i++) {
|
||||||
|
|
||||||
|
var kpiId = 'KPI_SpeedometerAnnual_' + requestId + '_' + i;
|
||||||
|
console.log('kpiId: ' + kpiId);
|
||||||
|
|
||||||
|
var kpiName = $doc.getElementById(kpiId);
|
||||||
|
|
||||||
|
yPos += 2;
|
||||||
|
pdoc.setFontSize(14);
|
||||||
|
pdoc.setFontType("bold");
|
||||||
|
pdoc.text(kpiName.textContent, xPos, yPos, 'left');
|
||||||
|
yPos += 6;
|
||||||
|
|
||||||
|
pdoc.setFontSize(10);
|
||||||
|
pdoc.setFontType("normal");
|
||||||
|
|
||||||
for (var j = 1; j <= outputNumber; j++) {
|
for (var j = 1; j <= outputNumber; j++) {
|
||||||
|
|
||||||
var outputId = 'OutputId_' + requestId + '_' + i + '_' + j;
|
var outputId = 'OutputId_' + requestId + '_' + i + '_' + j;
|
||||||
|
@ -451,6 +467,19 @@ public class SpeedometerAnnualPanelResult {
|
||||||
// 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];
|
||||||
|
|
||||||
|
@ -471,6 +500,20 @@ public class SpeedometerAnnualPanelResult {
|
||||||
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);
|
||||||
|
@ -489,8 +532,30 @@ public class SpeedometerAnnualPanelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i == outputNumber) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
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();
|
||||||
|
|
||||||
|
yPos = tMargin; // Restart position
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
||||||
|
console.log('CurrentPage: ' + currentPage);
|
||||||
|
var footner = 'Page ' + currentPage;
|
||||||
|
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
||||||
|
|
||||||
console.log('Done');
|
console.log('Done');
|
||||||
|
|
||||||
pdoc.save(filename);
|
pdoc.save(filename);
|
||||||
|
|
|
@ -411,7 +411,7 @@ public class BoxPlotPanelResult {
|
||||||
var kpiName = $doc.getElementById(kpiId);
|
var kpiName = $doc.getElementById(kpiId);
|
||||||
|
|
||||||
yPos += 2;
|
yPos += 2;
|
||||||
pdoc.setFontSize(16);
|
pdoc.setFontSize(14);
|
||||||
pdoc.setFontType("bold");
|
pdoc.setFontType("bold");
|
||||||
pdoc.text(kpiName.textContent, xPos, yPos, 'left');
|
pdoc.text(kpiName.textContent, xPos, yPos, 'left');
|
||||||
yPos += 6;
|
yPos += 6;
|
||||||
|
@ -444,7 +444,7 @@ public class BoxPlotPanelResult {
|
||||||
console.log('Title current table: '
|
console.log('Title current table: '
|
||||||
+ titleCurrentTable.textContent);
|
+ titleCurrentTable.textContent);
|
||||||
yPos += 2;
|
yPos += 2;
|
||||||
pdoc.setFontSize(12);
|
pdoc.setFontSize(10);
|
||||||
pdoc.setFontType("bold");
|
pdoc.setFontType("bold");
|
||||||
pdoc.text(titleCurrentTable.textContent, xPos, yPos,
|
pdoc.text(titleCurrentTable.textContent, xPos, yPos,
|
||||||
'left');
|
'left');
|
||||||
|
@ -478,7 +478,7 @@ public class BoxPlotPanelResult {
|
||||||
console.log('Title current image: '
|
console.log('Title current image: '
|
||||||
+ titleCurrentImage.textContent);
|
+ titleCurrentImage.textContent);
|
||||||
yPos += 2;
|
yPos += 2;
|
||||||
pdoc.setFontSize(12);
|
pdoc.setFontSize(10);
|
||||||
pdoc.setFontType("bold");
|
pdoc.setFontType("bold");
|
||||||
pdoc.text(titleCurrentImage.textContent, xPos,
|
pdoc.text(titleCurrentImage.textContent, xPos,
|
||||||
yPos, 'left');
|
yPos, 'left');
|
||||||
|
|
|
@ -42,12 +42,12 @@ public class SpeedometerPanelResult {
|
||||||
private PerformFishAnalyticsViewController viewController;
|
private PerformFishAnalyticsViewController viewController;
|
||||||
private int requestId;
|
private int requestId;
|
||||||
private int outputIteration = 0;
|
private int outputIteration = 0;
|
||||||
private int outputNumber = 0;
|
private int outputNumber = 1;
|
||||||
|
|
||||||
public SpeedometerPanelResult(int reqId,PerformFishAnalyticsViewController viewController,
|
public SpeedometerPanelResult(int reqId, PerformFishAnalyticsViewController viewController,
|
||||||
final DataMinerAlgorithms algorithm, String focusID, List<KPI> inputKPI, final List<KPI> outputKPI) {
|
final DataMinerAlgorithms algorithm, String focusID, List<KPI> inputKPI, final List<KPI> outputKPI) {
|
||||||
GWT.log("RequestID: "+reqId);
|
GWT.log("RequestID: " + reqId);
|
||||||
requestId=reqId;
|
requestId = reqId;
|
||||||
this.viewController = viewController;
|
this.viewController = viewController;
|
||||||
TextResource algDescr = PerformFishResources.INSTANCE.batch_SPEEDOMETER();
|
TextResource algDescr = PerformFishResources.INSTANCE.batch_SPEEDOMETER();
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class SpeedometerPanelResult {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
saveFilePDF(algorithm.getId(), tabTitle, tabTitle, tabDescr, requestId,outputIteration, outputNumber);
|
saveFilePDF(algorithm.getId(), tabTitle, tabTitle, tabDescr, requestId, outputIteration, outputNumber);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ public class SpeedometerPanelResult {
|
||||||
oIteration++;
|
oIteration++;
|
||||||
String title = "KPI: " + kpi.getName();
|
String title = "KPI: " + kpi.getName();
|
||||||
HTML toBigTitle = new HTML(title);
|
HTML toBigTitle = new HTML(title);
|
||||||
|
toBigTitle.getElement().setId("KPI_Speedometer_" + requestId + "_" + oIteration);
|
||||||
toBigTitle.getElement().addClassName("to-big-title");
|
toBigTitle.getElement().addClassName("to-big-title");
|
||||||
submitRequestPanel.addWidget(toBigTitle);
|
submitRequestPanel.addWidget(toBigTitle);
|
||||||
HorizontalPanel hp = new HorizontalPanel();
|
HorizontalPanel hp = new HorizontalPanel();
|
||||||
|
@ -193,9 +194,15 @@ public class SpeedometerPanelResult {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getOutputId(int oIteration, String title) {
|
||||||
|
String outputId = "OutputId_" + requestId + "_" + oIteration + "_" + 1;
|
||||||
|
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 " : "";
|
||||||
|
|
||||||
|
@ -210,13 +217,9 @@ public class SpeedometerPanelResult {
|
||||||
|
|
||||||
final String toTitle = title;
|
final String toTitle = title;
|
||||||
|
|
||||||
int oNumber = 0;
|
|
||||||
|
|
||||||
for (OutputFile outputFile : dmResponse.getListOutput()) {
|
for (OutputFile outputFile : dmResponse.getListOutput()) {
|
||||||
oNumber++;
|
final FileContentType fileContentType = outputFile.getDataType();
|
||||||
final String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + oNumber;
|
|
||||||
final FileContentType fileContentType= outputFile.getDataType();
|
|
||||||
|
|
||||||
switch (outputFile.getDataType()) {
|
switch (outputFile.getDataType()) {
|
||||||
case IMAGE:
|
case IMAGE:
|
||||||
PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile,
|
PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile,
|
||||||
|
@ -239,6 +242,7 @@ public class SpeedometerPanelResult {
|
||||||
title += "Selected Batch ID: " + focusID + "<br>";
|
title += "Selected Batch ID: " + focusID + "<br>";
|
||||||
title += "Normalized with respect to all batches in the VRE";
|
title += "Normalized with respect to all batches in the VRE";
|
||||||
|
|
||||||
|
String outputId = getOutputId(oIteration, title);
|
||||||
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);
|
||||||
|
@ -266,6 +270,7 @@ public class SpeedometerPanelResult {
|
||||||
|
|
||||||
String title = toTitle;
|
String title = toTitle;
|
||||||
|
|
||||||
|
String outputId = getOutputId(oIteration, title);
|
||||||
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);
|
||||||
|
@ -278,13 +283,9 @@ public class SpeedometerPanelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outputNumber=oNumber;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the spinner if all DM responses are returned.
|
* Remove the spinner if all DM responses are returned.
|
||||||
*
|
*
|
||||||
|
@ -307,7 +308,7 @@ public class SpeedometerPanelResult {
|
||||||
int requestId, int outputIteration, int outputNumber)/*-{
|
int requestId, int outputIteration, int outputNumber)/*-{
|
||||||
var that = this;
|
var that = this;
|
||||||
console.log('saveFilePDF()');
|
console.log('saveFilePDF()');
|
||||||
console.log('requestId: '+requestId);
|
console.log('requestId: ' + requestId);
|
||||||
console.log('OutputIteration: ' + outputIteration);
|
console.log('OutputIteration: ' + outputIteration);
|
||||||
console.log('OutputNumber:' + outputNumber);
|
console.log('OutputNumber:' + outputNumber);
|
||||||
|
|
||||||
|
@ -355,9 +356,23 @@ public class SpeedometerPanelResult {
|
||||||
|
|
||||||
for (var i = 1; i <= outputIteration; i++) {
|
for (var i = 1; i <= outputIteration; i++) {
|
||||||
|
|
||||||
|
var kpiId = 'KPI_Speedometer_' + requestId + '_' + i;
|
||||||
|
console.log('kpiId: ' + kpiId);
|
||||||
|
|
||||||
|
var kpiName = $doc.getElementById(kpiId);
|
||||||
|
|
||||||
|
yPos += 2;
|
||||||
|
pdoc.setFontSize(14);
|
||||||
|
pdoc.setFontType("bold");
|
||||||
|
pdoc.text(kpiName.textContent, xPos, yPos, 'left');
|
||||||
|
yPos += 6;
|
||||||
|
|
||||||
|
pdoc.setFontSize(10);
|
||||||
|
pdoc.setFontType("normal");
|
||||||
|
|
||||||
for (var j = 1; j <= outputNumber; j++) {
|
for (var j = 1; j <= outputNumber; j++) {
|
||||||
|
|
||||||
var outputId = 'OutputId_'+requestId+'_'+ i + '_' + j;
|
var outputId = 'OutputId_' + requestId + '_' + i + '_' + j;
|
||||||
console.log('OutputId: ' + outputId);
|
console.log('OutputId: ' + outputId);
|
||||||
|
|
||||||
var resultOutputNumber = $doc.getElementById(outputId);
|
var resultOutputNumber = $doc.getElementById(outputId);
|
||||||
|
@ -375,6 +390,19 @@ public class SpeedometerPanelResult {
|
||||||
// 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];
|
||||||
|
|
||||||
|
@ -395,6 +423,20 @@ public class SpeedometerPanelResult {
|
||||||
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);
|
||||||
|
@ -413,11 +455,34 @@ public class SpeedometerPanelResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i == outputNumber) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
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();
|
||||||
|
|
||||||
|
yPos = tMargin; // Restart position
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var currentPage = pdoc.internal.getCurrentPageInfo().pageNumber;
|
||||||
|
console.log('CurrentPage: ' + currentPage);
|
||||||
|
var footner = 'Page ' + currentPage;
|
||||||
|
pdoc.text(footner, pageCenter, pdfHeightInMM - 7, 'center');
|
||||||
|
|
||||||
console.log('Done');
|
console.log('Done');
|
||||||
|
|
||||||
pdoc.save(filename);
|
pdoc.save(filename);
|
||||||
|
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue