Added code to maintain a specific ordering to the boxplot results

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@181289 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-07-22 13:45:13 +00:00
parent dded552f09
commit 66af38b439
2 changed files with 71 additions and 6 deletions

View File

@ -51,6 +51,7 @@ import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
@ -83,6 +84,8 @@ public class PerformFishAnnualAnalyticsController {
//This value is read from the first value of column "FARM" contained in
//the table AnnualTable_internal.csv returned by PerformFish Service
private String theFocusValue = null;
private Map<Integer,FlexTable> boxPlotOrderBy = new HashMap<Integer,FlexTable>();
/**
@ -738,7 +741,7 @@ public class PerformFishAnnualAnalyticsController {
* @param container the container
* @param displayError the display error
*/
private void displayOutputFilesAsStaticEntities(DataMinerResponse dmResponse, final DataMinerAlgorithms chartType, List<KPI> inputKPIs, List<KPI> outputKPIs, final String focusID, final Panel container, boolean displayError){
private void displayOutputFilesAsStaticEntities(final DataMinerResponse dmResponse, final DataMinerAlgorithms chartType, List<KPI> inputKPIs, List<KPI> outputKPIs, final String focusID, final Panel container, boolean displayError){
String title = displayError?"No results ":"";
@ -776,7 +779,11 @@ public class PerformFishAnnualAnalyticsController {
//title += "Blue dots indicate the selected batch(es): "+focusID;
title = chartType.getTitle()+" - on all farm data<br>";
title += "Blue dots indicate the selected farm: "+focusID;
break;
ShowResult showResult = new ShowResult(title);
showResult.showImage(base64Content);
displayingOrderedBoxPlot(dmResponse, title, container, showResult);
return;
case CORRELATION:
break;
case DEA_ANALYSIS:
@ -823,7 +830,11 @@ public class PerformFishAnnualAnalyticsController {
}
title+="<br>";
title+="Data aggregation is performed by considering farms as base units";
break;
ShowResult showResult = new ShowResult(title);
showResult.showCSVFile(result, cssTableStyle);
displayingOrderedBoxPlot(dmResponse, title, container, showResult);
return;
case CORRELATION:
break;
case DEA_ANALYSIS:
@ -853,4 +864,26 @@ public class PerformFishAnnualAnalyticsController {
}
}
private void displayingOrderedBoxPlot(final DataMinerResponse dmResponse, String title, final Panel container, ShowResult showResult) {
int hashcode = dmResponse.hashCode();
GWT.log("The hascode is: "+hashcode);
FlexTable flex = boxPlotOrderBy.get(hashcode);
if(flex==null) {
GWT.log("The flextable is null");
flex = new FlexTable();
boxPlotOrderBy.put(hashcode, flex);
container.add(flex);
}
if(title.startsWith("My")) {
flex.setWidget(0, 0, showResult);
}else if (title.startsWith("All")){
flex.setWidget(0, 1, showResult);
}else {
flex.setWidget(0, 2, showResult);
}
}
}

View File

@ -55,6 +55,7 @@ import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
@ -80,6 +81,8 @@ public class PerformFishAnalyticsController {
/** The decrypt parameters. */
private PerformFishInitParameter decryptParameters;
private Map<Integer,FlexTable> boxPlotOrderBy = new HashMap<Integer,FlexTable>();
/**
@ -667,7 +670,7 @@ public class PerformFishAnalyticsController {
* @param container the container
* @param displayError the display error
*/
private void displayOutputFilesAsStaticEntities(DataMinerResponse dmResponse, final DataMinerAlgorithms chartType, List<KPI> inputKPIs, List<KPI> outputKPIs, final String focusID, final Panel container, boolean displayError){
private void displayOutputFilesAsStaticEntities(final DataMinerResponse dmResponse, final DataMinerAlgorithms chartType, List<KPI> inputKPIs, List<KPI> outputKPIs, final String focusID, final Panel container, boolean displayError){
String title = displayError?"No results ":"";
@ -703,7 +706,11 @@ public class PerformFishAnalyticsController {
case BOXPLOT:
title = chartType.getName()+" - on all batches<br>";
title += "Blue dots indicate the selected batch(es): "+focusID;
break;
ShowResult showResult = new ShowResult(title);
showResult.showImage(base64Content);
displayingOrderedBoxPlot(dmResponse, title, container, showResult);
return;
case CORRELATION:
break;
case DEA_ANALYSIS:
@ -753,7 +760,11 @@ public class PerformFishAnalyticsController {
}
title+="<br>";
title+="Data aggregation is performed by considering batches as base units";
break;
ShowResult showResult = new ShowResult(title);
showResult.showCSVFile(result, cssTableStyle);
displayingOrderedBoxPlot(dmResponse, title, container, showResult);
return;
case CORRELATION:
break;
case DEA_ANALYSIS:
@ -783,4 +794,25 @@ public class PerformFishAnalyticsController {
}
}
private void displayingOrderedBoxPlot(final DataMinerResponse dmResponse, String title, final Panel container, ShowResult showResult) {
int hashcode = dmResponse.hashCode();
GWT.log("The hascode is: "+hashcode);
FlexTable flex = boxPlotOrderBy.get(hashcode);
if(flex==null) {
GWT.log("The flextable is null");
flex = new FlexTable();
boxPlotOrderBy.put(hashcode, flex);
container.add(flex);
}
if(title.startsWith("My")) {
flex.setWidget(0, 0, showResult);
}else if (title.startsWith("All")){
flex.setWidget(0, 1, showResult);
}else {
flex.setWidget(0, 2, showResult);
}
}
}