From 459e7d52d174ab9277497d081107b8a586b9702e Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Fri, 8 Mar 2019 16:38:40 +0000 Subject: [PATCH] bug fixing CORRELATION git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@178521 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../PerformFishAnalyticsController.java | 11 ++-- .../viewbinder/AnalyticsPanelResult.java | 65 ++++++++++++++----- .../PerformFishAnalitycsFormView.java | 33 ++++++++++ 3 files changed, 88 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/controllers/PerformFishAnalyticsController.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/controllers/PerformFishAnalyticsController.java index ddccb40..65ecef0 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/controllers/PerformFishAnalyticsController.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/controllers/PerformFishAnalyticsController.java @@ -164,10 +164,12 @@ public class PerformFishAnalyticsController { viewController.manageKPI(selectedKPI.getKpi(), selectedKPI.isChecked(), selectedKPI.getSelectedPopulationType()); int selectedKPIsSize = viewController.getSelectedKPIs().size(); - boolean isValidForm = viewController.validatePerformFishInputFields(); - if(isValidForm) { + //viewController.manageAlgorithmsSubmit(selectedKPIsSize); + List batchIds = viewController.getSelectedBatchID(); + if(batchIds==null || batchIds.size()==0) { + viewController.enableAllAlgorithmsForSubmit(false); + }else viewController.manageAlgorithmsSubmit(selectedKPIsSize); - } } }); @@ -446,7 +448,8 @@ public class PerformFishAnalyticsController { case SCATTER: if(inputKPI.get(0)==null || inputKPI.get(1)==null){ - submitRequestPanel.setTheTitle("Something seems wrong, one or more of the selected KPIs are not valid. Please try again"); + submitRequestPanel.setTheTitle("Sorry, something seems wrong, the selected KPIs are not valid. Please try again"); + checkTabSpinner(submitRequestPanel, tab); return; // Window.alert("Something seems wrong, no selected BatchID, try again"); } diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/AnalyticsPanelResult.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/AnalyticsPanelResult.java index 2aac04d..6f7cabb 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/AnalyticsPanelResult.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/AnalyticsPanelResult.java @@ -312,23 +312,46 @@ public class AnalyticsPanelResult extends Composite { } - /** - * Gets the KPI for name. - * - * @param name the name - * @return the KPI for name - */ +// /** +// * Gets the KPI for name. +// * +// * @param name the name +// * @return the KPI for name +// */ +// public KPI getKPIForName(String name){ +// +// //GWT.log("Selected KPIs: "+selectedKPIs); +// GWT.log("Searching KPI name: "+name); +// KPI foundKPI = null; +// //String purgedName = name.replaceAll("\\%", "").trim(); +// String purgedName = name.trim(); +// for (KPI kpi : selectedKPIs) { +// //String purgedKPIName = kpi.getName().replaceAll("\\%", "").trim(); +// String purgedKPIName = kpi.getName().trim(); +// if(purgedKPIName.compareToIgnoreCase(purgedName)==0) { +// foundKPI = kpi; +// break; +// } +// +// } +// GWT.log("FOUND KPI: "+foundKPI); +// return foundKPI; +// } + public KPI getKPIForName(String name){ - System.out.println("Selected KPIs: "+selectedKPIs); - String purgedName = name.replaceAll("\\%", "").trim(); + GWT.log("Searching KPI name: "+name); + KPI foundKPI = null; + String purgedName = name.trim(); for (KPI kpi : selectedKPIs) { - String purgedKPIName = kpi.getName().replaceAll("\\%", "").trim(); - if(purgedKPIName.compareToIgnoreCase(purgedName)==0) - return kpi; + String purgedKPIName = kpi.getName().trim(); + if(purgedKPIName.compareToIgnoreCase(purgedName)==0) { + foundKPI = kpi; + break; + } } - - return null; + GWT.log("FOUND KPI: "+foundKPI); + return foundKPI; } /** @@ -452,7 +475,7 @@ public class AnalyticsPanelResult extends Composite { @Override public void onSuccess(CSVFile result) { - + GWT.log("Displaying: "+result); HorizontalPanel hp = new HorizontalPanel(); final FlexTable flexTable = new FlexTable(); @@ -460,7 +483,11 @@ public class AnalyticsPanelResult extends Composite { flexTable.getElement().getStyle().setMarginBottom(10, Unit.PX); flexTable.setWidget(0, 0,new Label("")); - + +// for (KPI kpi : selectedKPIs) { +// GWT.log("Selected KPIs are: "+kpi); +// } + CSVRow headerRow = result.getHeaderRow(); //HEADER for (int i=1; i listKPI){ - String key = rowIndex+","+columnIndex; + String key = generateKey(rowIndex, columnIndex); kpiMapPointers.put(key, listKPI); // String kpiNames = ""; @@ -641,9 +668,13 @@ public class AnalyticsPanelResult extends Composite { * @return the KPI for indexes */ public List getKPIForIndexes(int rowIndex, int columnIndex){ - String key = rowIndex+","+columnIndex; + String key = generateKey(rowIndex, columnIndex); return kpiMapPointers.get(key); } + + private String generateKey(int rowIndex, int columnIndex) { + return rowIndex+"-"+columnIndex; + } /** diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/PerformFishAnalitycsFormView.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/PerformFishAnalitycsFormView.java index 9b9525c..ef941b7 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/PerformFishAnalitycsFormView.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/PerformFishAnalitycsFormView.java @@ -2,6 +2,7 @@ package org.gcube.portlets.user.performfishanalytics.client.viewbinder; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -11,6 +12,7 @@ import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationT import org.gcube.portlets.user.performfishanalytics.client.event.PerformFishFieldFormChangedEvent; import org.gcube.portlets.user.performfishanalytics.client.event.SelectedPopulationTypeEvent; import org.gcube.portlets.user.performfishanalytics.shared.Area; +import org.gcube.portlets.user.performfishanalytics.shared.KPI; import org.gcube.portlets.user.performfishanalytics.shared.Period; import org.gcube.portlets.user.performfishanalytics.shared.Population; import org.gcube.portlets.user.performfishanalytics.shared.PopulationType; @@ -209,7 +211,38 @@ public class PerformFishAnalitycsFormView extends Composite { selectAllFields(field_select_area, isChecked); } }); + +// KPI kpi = new KPI("", "", "Number fish/FTE employees in 2nd year", "", null, null, 1); +// getKPIForName("Number fish/FTE employees in 2nd year", Arrays.asList(kpi)); } + +// /** +// * Gets the KPI for name. +// * +// * @param name the name +// * @return the KPI for name +// */ +// public KPI getKPIForName(String name, List selectedKPIs){ +// +// //GWT.log("Selected KPIs: "+selectedKPIs); +// GWT.log("Searching name: "+name); +// KPI foundKPI = null; +// String purgedName = name.replace("\\", "\\\\"); +// GWT.log("Purged name: "+purgedName); +// //String purgedName = name.trim(); +// for (KPI kpi : selectedKPIs) { +// String purgedKPIName = kpi.getName().replace("\\", "\\\\"); +// GWT.log("Purged Selected KPI name: "+purgedName); +// //String purgedKPIName = kpi.getName().trim(); +// if(purgedKPIName.compareToIgnoreCase(purgedName)==0) { +// foundKPI = kpi; +// break; +// } +// +// } +// GWT.log("FOUND KPI: "+foundKPI); +// return foundKPI; +// } /** * Select all fields.