ref 17249: Save produced charts as report

https://support.d4science.org/issues/17249

Added PDF support for BoxPlot
This commit is contained in:
Giancarlo Panichi 2020-05-25 18:14:45 +02:00
parent 1e35bb6848
commit 8ca0cbeb69
12 changed files with 300 additions and 107 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/performfish-analytics-portlet-0.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/performfish-analytics-portlet-0.7.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/performfish-analytics-portlet-0.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/performfish-analytics-portlet-0.7.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/performfish-analytics-portlet-0.6.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/performfish-analytics-portlet-0.7.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="performfish-analytics-portlet-0.6.0-SNAPSHOT">
<wb-module deploy-name="performfish-analytics-portlet-0.7.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>

View File

@ -326,8 +326,9 @@ public class PerformFishAnnualAnalyticsController {
*/
protected void callAlgorithmSynopticTableFarm() {
requestId++;
@SuppressWarnings("unused")
SynopticTableAnnualPanelResult synopticTablePanelResult = new SynopticTableAnnualPanelResult(requestId++,
SynopticTableAnnualPanelResult synopticTablePanelResult = new SynopticTableAnnualPanelResult(requestId,
viewAnnualController, thePerformFishResponse);
}
@ -640,21 +641,22 @@ public class PerformFishAnnualAnalyticsController {
private void callAlgorithm(DataMinerAlgorithms algorithm, String focusID, List<KPI> inputKPI,
final List<KPI> outputKPI) {
requestId++;
switch (algorithm) {
case BOXPLOT:
@SuppressWarnings("unused")
BoxPlotAnnualPanelResult boxPlotPanelResult = new BoxPlotAnnualPanelResult(requestId++,
BoxPlotAnnualPanelResult boxPlotAnnualPanelResult = new BoxPlotAnnualPanelResult(requestId,
viewAnnualController, thePerformFishResponse, algorithm, focusID, inputKPI, outputKPI);
break;
case SPEEDOMETER:
@SuppressWarnings("unused")
SpeedometerAnnualPanelResult speedometerPanelResult = new SpeedometerAnnualPanelResult(requestId++,
SpeedometerAnnualPanelResult speedometerAnnualPanelResult = new SpeedometerAnnualPanelResult(requestId,
viewAnnualController, thePerformFishResponse, algorithm, focusID, inputKPI, outputKPI);
break;
case SCATTER:
@SuppressWarnings("unused")
ScatterAnnualPanelResult scatterPanelResult = new ScatterAnnualPanelResult(requestId++,
ScatterAnnualPanelResult scatterAnnualPanelResult = new ScatterAnnualPanelResult(requestId,
viewAnnualController, thePerformFishResponse, algorithm, focusID, inputKPI, outputKPI);
break;
default:

View File

@ -366,8 +366,9 @@ public class PerformFishAnalyticsController {
final Map<String, List<String>> performFishRequestParameters) {
GWT.log("Read perform fish response: " + performFishResponse);
requestId++;
@SuppressWarnings("unused")
SynopticTablePanelResult synopticTablePanelResult = new SynopticTablePanelResult(requestId++, viewController,
SynopticTablePanelResult synopticTablePanelResult = new SynopticTablePanelResult(requestId, viewController,
performFishResponse, performFishRequestParameters);
}
@ -564,21 +565,22 @@ public class PerformFishAnalyticsController {
if (selectedBatchID == null || selectedBatchID.isEmpty())
Window.alert("Something seems wrong, no selected BatchID, try again");
requestId++;
switch (algorithm) {
case BOXPLOT:
@SuppressWarnings("unused")
BoxPlotPanelResult boxPlotPanelResult = new BoxPlotPanelResult(requestId++, viewController, algorithm,
BoxPlotPanelResult boxPlotPanelResult = new BoxPlotPanelResult(requestId, viewController, algorithm,
focusID, inputKPI, outputKPI);
break;
case SPEEDOMETER:
@SuppressWarnings("unused")
SpeedometerPanelResult speedometerPanelResult = new SpeedometerPanelResult(requestId++, viewController,
SpeedometerPanelResult speedometerPanelResult = new SpeedometerPanelResult(requestId, viewController,
algorithm, focusID, inputKPI, outputKPI);
break;
case SCATTER:
@SuppressWarnings("unused")
ScatterPanelResult scatterPanelResult = new ScatterPanelResult(requestId++, viewController, algorithm,
ScatterPanelResult scatterPanelResult = new ScatterPanelResult(requestId, viewController, algorithm,
focusID, inputKPI, outputKPI);
break;
default:

View File

@ -15,6 +15,7 @@ import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFish
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.ShowResult;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.SubmitRequestPanel;
import org.gcube.portlets.user.performfishanalytics.shared.FileContentType;
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
@ -46,13 +47,16 @@ public class BoxPlotAnnualPanelResult {
private PerformFishAnnualAnalyticsViewController viewAnnualController;
private int outputIteration = 0;
private int outputNumber = 0;
private int requestId;
private int outputNumber = 2;
private int requestId=0;
public BoxPlotAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController,
PerformFishResponse thePerformFishResponse,
final DataMinerAlgorithms algorithm, String focusID, List<KPI> inputKPI, final List<KPI> outputKPI) {
this.requestId = reqId;
GWT.log("RequestID: "+reqId);
requestId=reqId;
this.viewAnnualController = viewAnnualController;
TextResource algDescr = PerformFishResources.INSTANCE.farm_BOXPLOT();
@ -89,6 +93,7 @@ public class BoxPlotAnnualPanelResult {
oIteration++;
String title = "KPI: " + kpi.getName();
HTML toBigTitle = new HTML(title);
toBigTitle.getElement().setId("KPI_BoxPlotAnnual_"+requestId+"_"+oIteration);
toBigTitle.getElement().addClassName("to-big-title");
submitRequestPanel.addWidget(toBigTitle);
HorizontalPanel hp = new HorizontalPanel();
@ -101,7 +106,7 @@ public class BoxPlotAnnualPanelResult {
submitRequestPanel.addWidget(hp);
}
outputIteration = oIteration;
GWT.log("outputInteration: "+outputIteration);
}
/**
@ -245,9 +250,27 @@ public class BoxPlotAnnualPanelResult {
}
private String getOutputId(int oIteration, String title){
if (title.startsWith("My")) {
return null;
} else if (title.startsWith("All")) {
String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + 1;
return outputId;
} else {
String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + 2;
return outputId;
}
}
private void displayOutputFilesAsStaticEntities(final DataMinerResponse dmResponse,
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 " : "";
@ -262,16 +285,11 @@ public class BoxPlotAnnualPanelResult {
final String toTitle = title;
outputNumber = dmResponse.getListOutput().size();
int oNumber = 0;
for (final OutputFile outputFile : dmResponse.getListOutput()) {
oNumber++;
final String outputId = "OutputId_" + requestId + "_" + oIteration + "_" + oNumber;
for (OutputFile outputFile : dmResponse.getListOutput()) {
final FileContentType fileContentType= outputFile.getDataType();
switch (outputFile.getDataType()) {
case IMAGE:
PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile,
new AsyncCallback<String>() {
@ -292,7 +310,8 @@ public class BoxPlotAnnualPanelResult {
title = chartType.getTitle() + " - on all farm data<br>";
title += "Blue dots indicate the selected farm: " + focusID;
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
String outputId=getOutputId(oIteration,title);
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showImage(base64Content);
displayingOrderedBoxPlot(dmResponse, title, container, showResult);
@ -300,6 +319,7 @@ public class BoxPlotAnnualPanelResult {
});
break;
case CSV:
PerformFishAnalyticsServiceAsync.Util.getInstance().getCSVFile(outputFile, true,
new AsyncCallback<CSVFile>() {
@ -328,7 +348,9 @@ public class BoxPlotAnnualPanelResult {
title += "<br>";
title += "Data aggregation is performed by considering farms as base units";
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
String outputId=getOutputId(oIteration,title);
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showCSVFile(result, cssTableStyle);
displayingOrderedBoxPlot(dmResponse, title, container, showResult);
@ -436,6 +458,21 @@ public class BoxPlotAnnualPanelResult {
for (var i = 1; i <= outputIteration; i++) {
var kpiId = 'KPI_BoxPlotAnnual_' + requestId + '_' + i;
console.log('kpiId: ' + kpiId);
var kpiName = $doc.getElementById(kpiId);
yPos += 2;
pdoc.setFontSize(16);
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++) {
var outputId = 'OutputId_' + requestId + '_' + i + '_' + j;
@ -456,6 +493,19 @@ public class BoxPlotAnnualPanelResult {
// foo could get resolved and it's defined
var childrenTable = resultOutputNumber.children;
var titleCurrentTable = childrenTable[0].rows[0].cells[0];
console.log('Title current table: '
+ titleCurrentTable.textContent);
yPos += 2;
pdoc.setFontSize(12);
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 secondTable = secondDiv.children[0].children[0];
@ -476,6 +526,21 @@ public class BoxPlotAnnualPanelResult {
if (resultType == 'image') {
console.log('Result Type image: ' + i);
var childrenTable = resultOutputNumber.children;
var titleCurrentImage = childrenTable[0].rows[0].cells[0];
console.log('Title current image: '
+ titleCurrentImage.textContent);
yPos += 2;
pdoc.setFontSize(12);
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 imageElement = secondDiv.getElementsByTagName(
'img').item(0);
@ -494,6 +559,27 @@ public class BoxPlotAnnualPanelResult {
}
}
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();
yPos = tMargin; // Restart position
} 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');
}
}
}
console.log('Done');
@ -502,4 +588,5 @@ public class BoxPlotAnnualPanelResult {
}-*/;
}

View File

@ -15,6 +15,7 @@ import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFish
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.ShowResult;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.SubmitRequestPanel;
import org.gcube.portlets.user.performfishanalytics.shared.FileContentType;
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
@ -48,7 +49,8 @@ public class ScatterAnnualPanelResult {
public ScatterAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController,
PerformFishResponse thePerformFishResponse, final DataMinerAlgorithms algorithm, String focusID,
List<KPI> inputKPI, final List<KPI> outputKPI) {
this.requestId = reqId;
GWT.log("RequestID: "+reqId);
requestId=reqId;
this.viewAnnualController = viewAnnualController;
TextResource algDescr = PerformFishResources.INSTANCE.farm_SCATTER();
@ -258,13 +260,13 @@ public class ScatterAnnualPanelResult {
final String toTitle = title;
outputNumber = dmResponse.getListOutput().size();
int oNumber = 0;
for (final OutputFile outputFile : dmResponse.getListOutput()) {
for (OutputFile outputFile : dmResponse.getListOutput()) {
oNumber++;
final String outputId = "OutputId_" + requestId + "_" + oIteration + "_" + oNumber;
final String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + oNumber;
final FileContentType fileContentType= outputFile.getDataType();
switch (outputFile.getDataType()) {
case IMAGE:
@ -284,7 +286,7 @@ public class ScatterAnnualPanelResult {
public void onSuccess(String base64Content) {
String title = toTitle;
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showImage(base64Content);
container.add(showResult);
@ -311,7 +313,7 @@ public class ScatterAnnualPanelResult {
String title = toTitle;
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showCSVFile(result, cssTableStyle);
container.add(showResult);
}
@ -324,6 +326,7 @@ public class ScatterAnnualPanelResult {
}
outputNumber=oNumber;
}
/**

View File

@ -15,6 +15,7 @@ import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFish
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.ShowResult;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.SubmitRequestPanel;
import org.gcube.portlets.user.performfishanalytics.shared.FileContentType;
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
@ -52,7 +53,8 @@ public class SpeedometerAnnualPanelResult {
public SpeedometerAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController,
PerformFishResponse thePerformFishResponse,
final DataMinerAlgorithms algorithm, String focusID, List<KPI> inputKPI, final List<KPI> outputKPI) {
this.requestId = reqId;
GWT.log("RequestID: "+reqId);
requestId=reqId;
this.viewAnnualController = viewAnnualController;
TextResource algDescr = PerformFishResources.INSTANCE.farm_SPEEDOMETER();
@ -262,13 +264,12 @@ public class SpeedometerAnnualPanelResult {
final String toTitle = title;
outputNumber = dmResponse.getListOutput().size();
int oNumber = 0;
for (final OutputFile outputFile : dmResponse.getListOutput()) {
for (OutputFile outputFile : dmResponse.getListOutput()) {
oNumber++;
final String outputId = "OutputId_" + requestId + "_" + oIteration + "_" + oNumber;
final String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + oNumber;
final FileContentType fileContentType= outputFile.getDataType();
switch (outputFile.getDataType()) {
case IMAGE:
@ -293,7 +294,7 @@ public class SpeedometerAnnualPanelResult {
title += "Selected Farm: " + focusID + "<br>";
title += "Normalized with respect to all farm data in the VRE";
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showImage(base64Content);
container.add(showResult);
@ -320,7 +321,7 @@ public class SpeedometerAnnualPanelResult {
String title = toTitle;
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showCSVFile(result, cssTableStyle);
container.add(showResult);
@ -334,6 +335,8 @@ public class SpeedometerAnnualPanelResult {
}
outputNumber=oNumber;
}
private void displayingOrderedBoxPlot(final DataMinerResponse dmResponse, String title, final Panel container,

View File

@ -14,6 +14,7 @@ import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFish
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.ShowResult;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.SubmitRequestPanel;
import org.gcube.portlets.user.performfishanalytics.shared.FileContentType;
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
@ -48,7 +49,8 @@ public class SynopticTableAnnualPanelResult {
public SynopticTableAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController,
PerformFishResponse performFishResponse) {
this.requestId = reqId;
GWT.log("RequestID: "+reqId);
requestId=reqId;
this.viewAnnualController = viewAnnualController;
final DataMinerAlgorithms algorithm = DataMinerAlgorithms.PERFORMFISH_SYNOPTIC_TABLE_FARM;
@ -199,13 +201,14 @@ public class SynopticTableAnnualPanelResult {
final String toTitle = title;
outputNumber = dmResponse.getListOutput().size();
int oNumber = 0;
for (final OutputFile outputFile : dmResponse.getListOutput()) {
for (OutputFile outputFile : dmResponse.getListOutput()) {
oNumber++;
final String outputId = "OutputId_" + requestId + "_" + oIteration + "_" + oNumber;
final String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + oNumber;
final FileContentType fileContentType= outputFile.getDataType();
switch (outputFile.getDataType()) {
case IMAGE:
@ -226,7 +229,7 @@ public class SynopticTableAnnualPanelResult {
String title = toTitle;
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showImage(base64Content);
container.add(showResult);
@ -260,7 +263,7 @@ public class SynopticTableAnnualPanelResult {
cssTableStyle = "simpletable-synoptic";
}
ShowResult showResultSin = new ShowResult(outputId, title,
outputFile.getDataType());
fileContentType);
showResultSin.showCSVFile(result, cssTableStyle);
displayingOrderedSynopticTable(dmResponse, result.getFileName(), container,
showResultSin);
@ -275,7 +278,7 @@ public class SynopticTableAnnualPanelResult {
break;
}
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showCSVFile(result, cssTableStyle);
container.add(showResult);
@ -288,6 +291,7 @@ public class SynopticTableAnnualPanelResult {
}
}
outputNumber=oNumber;
}

View File

@ -12,6 +12,7 @@ import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsS
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsViewController;
import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFishResources;
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.shared.FileContentType;
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
@ -43,13 +44,13 @@ public class BoxPlotPanelResult {
private PerformFishAnalyticsViewController viewController;
private int outputIteration = 0;
private int outputNumber = 0;
private int requestId;
private int outputNumber = 3;
private int requestId = 0;
public BoxPlotPanelResult(int reqId,PerformFishAnalyticsViewController viewController, final DataMinerAlgorithms algorithm,
String focusID, List<KPI> inputKPI, final List<KPI> outputKPI) {
this.requestId=reqId;
public BoxPlotPanelResult(int reqId, PerformFishAnalyticsViewController viewController,
final DataMinerAlgorithms algorithm, String focusID, List<KPI> inputKPI, final List<KPI> outputKPI) {
GWT.log("RequestID: " + reqId);
requestId = reqId;
this.viewController = viewController;
TextResource algDescr = PerformFishResources.INSTANCE.batch_BOXPLOT();
@ -86,6 +87,7 @@ public class BoxPlotPanelResult {
oIteration++;
String title = "KPI: " + kpi.getName();
HTML toBigTitle = new HTML(title);
toBigTitle.getElement().setId("KPI_BoxPlot_"+requestId+"_"+oIteration);
toBigTitle.getElement().addClassName("to-big-title");
submitRequestPanel.addWidget(toBigTitle);
HorizontalPanel hp = new HorizontalPanel();
@ -194,11 +196,29 @@ public class BoxPlotPanelResult {
}
});
}
private String getOutputId(int oIteration, String title){
if (title.startsWith("My")) {
String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + 1;
return outputId;
} else if (title.startsWith("All")) {
String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + 2;
return outputId;
} else {
String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + 3;
return outputId;
}
}
private void displayOutputFilesAsStaticEntities(final DataMinerResponse dmResponse,
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 " : "";
@ -213,13 +233,9 @@ public class BoxPlotPanelResult {
final String toTitle = title;
outputNumber = dmResponse.getListOutput().size();
for (OutputFile outputFile : dmResponse.getListOutput()) {
int oNumber = 0;
for (final OutputFile outputFile : dmResponse.getListOutput()) {
oNumber++;
final String outputId = "OutputId_" +requestId+"_"+ oIteration + "_" + oNumber;
final FileContentType fileContentType = outputFile.getDataType();
switch (outputFile.getDataType()) {
case IMAGE:
@ -243,7 +259,8 @@ public class BoxPlotPanelResult {
title = chartType.getName() + " - on all batches<br>";
title += "Blue dots indicate the selected batch(es): " + focusID;
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
String outputId=getOutputId(oIteration,title);
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showImage(base64Content);
displayingOrderedBoxPlot(dmResponse, title, container, showResult);
}
@ -277,7 +294,8 @@ public class BoxPlotPanelResult {
title += "<br>";
title += "Data aggregation is performed by considering batches as base units";
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
String outputId=getOutputId(oIteration,title);
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showCSVFile(result, cssTableStyle);
displayingOrderedBoxPlot(dmResponse, title, container, showResult);
@ -291,6 +309,8 @@ public class BoxPlotPanelResult {
}
}
private void displayingOrderedBoxPlot(final DataMinerResponse dmResponse, String title, final Panel container,
@ -337,7 +357,7 @@ public class BoxPlotPanelResult {
int requestId, int outputIteration, int outputNumber)/*-{
var that = this;
console.log('saveFilePDF()');
console.log('requestId: '+requestId);
console.log('requestId: ' + requestId);
console.log('OutputIteration: ' + outputIteration);
console.log('OutputNumber:' + outputNumber);
@ -385,9 +405,24 @@ public class BoxPlotPanelResult {
for (var i = 1; i <= outputIteration; i++) {
var kpiId = 'KPI_BoxPlot_' + requestId + '_' + i;
console.log('kpiId: ' + kpiId);
var kpiName = $doc.getElementById(kpiId);
yPos += 2;
pdoc.setFontSize(16);
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++) {
var outputId = 'OutputId_'+requestId+'_'+ i + '_' + j;
var outputId = 'OutputId_' + requestId + '_' + i + '_' + j;
console.log('OutputId: ' + outputId);
var resultOutputNumber = $doc.getElementById(outputId);
@ -405,6 +440,19 @@ public class BoxPlotPanelResult {
// foo could get resolved and it's defined
var childrenTable = resultOutputNumber.children;
var titleCurrentTable = childrenTable[0].rows[0].cells[0];
console.log('Title current table: '
+ titleCurrentTable.textContent);
yPos += 2;
pdoc.setFontSize(12);
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 secondTable = secondDiv.children[0].children[0];
@ -425,6 +473,21 @@ public class BoxPlotPanelResult {
if (resultType == 'image') {
console.log('Result Type image: ' + i);
var childrenTable = resultOutputNumber.children;
var titleCurrentImage = childrenTable[0].rows[0].cells[0];
console.log('Title current image: '
+ titleCurrentImage.textContent);
yPos += 2;
pdoc.setFontSize(12);
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 imageElement = secondDiv.getElementsByTagName(
'img').item(0);
@ -443,6 +506,27 @@ public class BoxPlotPanelResult {
}
}
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();
yPos = tMargin; // Restart position
} 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');
}
}
}
console.log('Done');

View File

@ -12,6 +12,7 @@ import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsS
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsViewController;
import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFishResources;
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.shared.FileContentType;
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
@ -38,13 +39,14 @@ import com.google.gwt.user.client.ui.Panel;
public class ScatterPanelResult {
private PerformFishAnalyticsViewController viewController;
private int requestId;
private int requestId=0;
private int outputIteration = 0;
private int outputNumber = 0;
public ScatterPanelResult(int reqId,PerformFishAnalyticsViewController viewController,
final DataMinerAlgorithms algorithm, String focusID, List<KPI> inputKPI, final List<KPI> outputKPI) {
this.requestId=reqId;
GWT.log("RequestID: "+reqId);
requestId=reqId;
this.viewController = viewController;
TextResource algDescr = PerformFishResources.INSTANCE.batch_SCATTER();
@ -208,14 +210,12 @@ public class ScatterPanelResult {
final String toTitle = title;
outputNumber = dmResponse.getListOutput().size();
int oNumber = 0;
for (final OutputFile outputFile : dmResponse.getListOutput()) {
for (OutputFile outputFile : dmResponse.getListOutput()) {
oNumber++;
final String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + oNumber;
final FileContentType fileContentType= outputFile.getDataType();
switch (outputFile.getDataType()) {
case IMAGE:
PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile,
@ -234,7 +234,7 @@ public class ScatterPanelResult {
public void onSuccess(String base64Content) {
String title = toTitle;
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showImage(base64Content);
container.add(showResult);
@ -262,7 +262,7 @@ public class ScatterPanelResult {
String title = toTitle;
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showCSVFile(result, cssTableStyle);
container.add(showResult);
}
@ -275,6 +275,8 @@ public class ScatterPanelResult {
}
outputNumber=oNumber;
}

View File

@ -12,6 +12,7 @@ import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsS
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsViewController;
import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFishResources;
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.shared.FileContentType;
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
@ -45,7 +46,8 @@ public class SpeedometerPanelResult {
public SpeedometerPanelResult(int reqId,PerformFishAnalyticsViewController viewController,
final DataMinerAlgorithms algorithm, String focusID, List<KPI> inputKPI, final List<KPI> outputKPI) {
this.requestId=reqId;
GWT.log("RequestID: "+reqId);
requestId=reqId;
this.viewController = viewController;
TextResource algDescr = PerformFishResources.INSTANCE.batch_SPEEDOMETER();
@ -208,13 +210,12 @@ public class SpeedometerPanelResult {
final String toTitle = title;
outputNumber = dmResponse.getListOutput().size();
int oNumber = 0;
for (final OutputFile outputFile : dmResponse.getListOutput()) {
for (OutputFile outputFile : dmResponse.getListOutput()) {
oNumber++;
final String outputId = "OutputId_" +requestId+"_"+ oIteration + "_" + oNumber;
final String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + oNumber;
final FileContentType fileContentType= outputFile.getDataType();
switch (outputFile.getDataType()) {
case IMAGE:
@ -238,7 +239,7 @@ public class SpeedometerPanelResult {
title += "Selected Batch ID: " + focusID + "<br>";
title += "Normalized with respect to all batches in the VRE";
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showImage(base64Content);
container.add(showResult);
@ -265,7 +266,7 @@ public class SpeedometerPanelResult {
String title = toTitle;
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showCSVFile(result, cssTableStyle);
container.add(showResult);
}
@ -278,6 +279,8 @@ public class SpeedometerPanelResult {
}
outputNumber=oNumber;
}

View File

@ -11,6 +11,7 @@ import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsS
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsViewController;
import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFishResources;
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.shared.FileContentType;
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
@ -45,7 +46,8 @@ public class SynopticTablePanelResult {
public SynopticTablePanelResult(int reqId, PerformFishAnalyticsViewController viewController,
PerformFishResponse performFishResponse, final Map<String, List<String>> performFishRequestParameters) {
this.requestId = reqId;
GWT.log("RequestID: "+reqId);
requestId=reqId;
this.viewController = viewController;
String batchTableURL = performFishResponse.getMapParameters().get(PerformFishAnalyticsConstant.BATCHES_TABLE);
@ -194,13 +196,12 @@ public class SynopticTablePanelResult {
final String toTitle = title;
outputNumber = dmResponse.getListOutput().size();
int oNumber = 0;
for (final OutputFile outputFile : dmResponse.getListOutput()) {
for (OutputFile outputFile : dmResponse.getListOutput()) {
oNumber++;
final String outputId = "OutputId_" + requestId + "_" + oIteration + "_" + oNumber;
final String outputId = "OutputId_" + requestId+"_"+oIteration + "_" + oNumber;
final FileContentType fileContentType= outputFile.getDataType();
switch (outputFile.getDataType()) {
case IMAGE:
@ -221,7 +222,7 @@ public class SynopticTablePanelResult {
String title = toTitle;
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showImage(base64Content);
container.add(showResult);
@ -259,7 +260,7 @@ public class SynopticTablePanelResult {
}
ShowResult showResultSin = new ShowResult(outputId, title,
outputFile.getDataType());
fileContentType);
showResultSin.showCSVFile(result, cssTableStyle);
displayingOrderedSynopticTable(dmResponse, result.getFileName(), container,
showResultSin);
@ -271,7 +272,7 @@ public class SynopticTablePanelResult {
break;
}
// ALL OTHER CASES
ShowResult showResult = new ShowResult(outputId, title, outputFile.getDataType());
ShowResult showResult = new ShowResult(outputId, title, fileContentType);
showResult.showCSVFile(result, cssTableStyle);
container.add(showResult);
}
@ -284,6 +285,8 @@ public class SynopticTablePanelResult {
}
outputNumber = oNumber;
}
private void displayingOrderedSynopticTable(final DataMinerResponse dmResponse, String fileName,