Called the PerformFish service correctly
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@179315 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
851d384cbd
commit
0c046b256b
|
@ -19,7 +19,6 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
|||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.resources.client.TextResource;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
|
|
@ -44,6 +44,13 @@ public class PerformFishAnalyticsConstant {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* The Enum POPULATION_LEVEL.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* May 8, 2019
|
||||
*/
|
||||
public static enum POPULATION_LEVEL{BATCH, FARM};
|
||||
|
||||
|
||||
|
@ -65,4 +72,48 @@ public class PerformFishAnalyticsConstant {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* The Enum PFServiceToDMMappingTable.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* May 8, 2019
|
||||
*/
|
||||
public static enum PFSERVICE_TO_DM_MAPPING_TABLE{
|
||||
|
||||
LethalIncidentsTable("LethalIncidentsTable", ""),
|
||||
AntibioticsTable_internal("AntibioticsTable_internal", ""),
|
||||
AntibioticsTable("AntibioticsTable", ""),
|
||||
AnnualTable_internal("AnnualTable_internal", ""),
|
||||
AnnualTable("AnnualTable", ""),
|
||||
AntiparasiticTable("AntiparasiticTable", ""),
|
||||
AntiparasiticTable_internal("AntiparasiticTable_internal", "");
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new PF service to DM mapping table.
|
||||
*
|
||||
* @param performFishTable the perform fish table
|
||||
* @param dataMinerTable the data miner table
|
||||
*/
|
||||
PFSERVICE_TO_DM_MAPPING_TABLE(String performFishTable, String dataMinerTable){
|
||||
this.performFishTable = performFishTable;
|
||||
this.dataMinerTable=dataMinerTable;
|
||||
}
|
||||
|
||||
String performFishTable;
|
||||
String dataMinerTable;
|
||||
|
||||
|
||||
public String getPerformFishTable() {
|
||||
return performFishTable;
|
||||
}
|
||||
|
||||
public String getDataMinerTable() {
|
||||
return dataMinerTable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,12 +16,10 @@ import org.gcube.portlets.user.performfishanalytics.client.event.AddedBatchIdEve
|
|||
import org.gcube.portlets.user.performfishanalytics.client.event.AddedBatchIdEventHandler;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.CallAlgorithmEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.CallAlgorithmEventHandler;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadBatchesEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadBatchesEventHandler;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadFocusEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadFocusEventHandler;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationTypeEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationTypeEventHandler;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadFocusEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadFocusEventHandler;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.PerformFishFieldFormChangedEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.PerformFishFieldFormChangedEventHandler;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.SelectedKPIEvent;
|
||||
|
@ -37,12 +35,12 @@ import org.gcube.portlets.user.performfishanalytics.client.viewbinder.SubmitRequ
|
|||
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;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVRow;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.dataminer.DataMinerResponse;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishInitParameter;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishResponse;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
|
@ -55,7 +53,6 @@ import com.google.gwt.user.client.ui.ComplexPanel;
|
|||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Panel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
|
@ -78,9 +75,12 @@ public class PerformFishAnnualAnalyticsController {
|
|||
private PerformFishInitParameter decryptParameters;
|
||||
|
||||
|
||||
private PerformFishResponse thePerformFishResponse;
|
||||
|
||||
/** The focus. */
|
||||
//This value is read from the first value of AnnualTable_internal csv returned by PerformFish Service
|
||||
private String focus = null;
|
||||
//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;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -191,18 +191,6 @@ public class PerformFishAnnualAnalyticsController {
|
|||
mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_FARMID_PARAM, Arrays.asList(farmId));
|
||||
mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_BATCH_TYPE_PARAM, Arrays.asList(batchType));
|
||||
|
||||
// if(!listYear.isEmpty()){
|
||||
// mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_QUARTER_PARAM, listYear);
|
||||
// }
|
||||
|
||||
// final Modal modal = new Modal(true);
|
||||
// modal.setCloseVisible(false);
|
||||
// modal.hide(false);
|
||||
// final VerticalPanel vp = new VerticalPanel();
|
||||
// LoaderIcon loader = new LoaderIcon("Loading batch(es) from PerformFish service, please wait...");
|
||||
// vp.add(loader);
|
||||
// loader.show(true);
|
||||
// modal.add(vp);
|
||||
PerformFishAnalyticsServiceAsync.Util.getInstance().submitRequestToPerformFishService(mapParameters, new AsyncCallback<PerformFishResponse>() {
|
||||
|
||||
@Override
|
||||
|
@ -213,32 +201,77 @@ public class PerformFishAnnualAnalyticsController {
|
|||
|
||||
@Override
|
||||
public void onSuccess(PerformFishResponse performFishResponse) {
|
||||
//modal.hide();
|
||||
viewAnnualController.managePerformFishServiceResponse(performFishResponse, mapParameters, POPULATION_LEVEL.BATCH);
|
||||
thePerformFishResponse = performFishResponse;
|
||||
GWT.log("PerformFish Response: "+performFishResponse);
|
||||
|
||||
final String pfTableName = PerformFishAnalyticsConstant.PFSERVICE_TO_DM_MAPPING_TABLE.AnnualTable_internal.getPerformFishTable();
|
||||
|
||||
String fileURL = performFishResponse.getMapParameters().get(pfTableName);
|
||||
|
||||
GWT.log(pfTableName+" is: "+fileURL);
|
||||
|
||||
//Managing the Perform Fish Service Response
|
||||
if(fileURL==null){
|
||||
viewAnnualController.showAlert("No table found by searching for name: "+PerformFishAnalyticsConstant.BATCHES_TABLE_INTERNAL, AlertType.ERROR);
|
||||
}else{
|
||||
|
||||
|
||||
PerformFishAnalyticsServiceAsync.Util.getInstance().readCSVFile(fileURL, new AsyncCallback<CSVFile>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CSVFile result) {
|
||||
|
||||
if(result==null){
|
||||
viewAnnualController.showAlert("The focus was not found in the table "+pfTableName, AlertType.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
int indexOfFARM = result.getHeaderRow().getListValues().indexOf(PerformFishAnalyticsConstant.POPULATION_LEVEL.FARM.name());
|
||||
|
||||
GWT.log("The index of column "+PerformFishAnalyticsConstant.POPULATION_LEVEL.FARM.name()+" is "+indexOfFARM);
|
||||
|
||||
if(indexOfFARM>-1){
|
||||
List<CSVRow> rows = result.getValueRows();
|
||||
|
||||
if(rows==null || rows.isEmpty()){
|
||||
viewAnnualController.showAlert("No valid focus was found in the table "+pfTableName, AlertType.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
String focusValue = null;
|
||||
//IN THE COLUMN WITH HEADER 'FARM' THE FOCUS VALUE IS THE SAME FOR ALL ROWS
|
||||
for (CSVRow row : rows) {
|
||||
focusValue = row.getListValues().get(indexOfFARM);
|
||||
if(focusValue!=null && !focusValue.isEmpty())
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(focusValue==null) {
|
||||
viewAnnualController.showAlert("No valid focus was found in the table "+pfTableName, AlertType.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
theFocusValue = focusValue;
|
||||
GWT.log("Loaded the focus value: "+theFocusValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
//modal.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
eventBus.addHandler(AddedBatchIdEvent.TYPE, new AddedBatchIdEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onAddedBatchId(AddedBatchIdEvent checkValidBatchIdEvent) {
|
||||
|
||||
// boolean isBatchIdValid = viewAnnualController.validateBatchIdSelection();
|
||||
// if(isBatchIdValid)
|
||||
// viewAnnualController.enableAllAlgorithmsForSubmit(true);
|
||||
// else
|
||||
// viewAnnualController.enableAllAlgorithmsForSubmit(false);
|
||||
|
||||
//viewController.resyncSelectedKPIs();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
eventBus.addHandler(SubmitRequestEvent.TYPE, new SubmitRequestEventHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -252,7 +285,7 @@ public class PerformFishAnnualAnalyticsController {
|
|||
viewAnnualController.manageAlgorithmsSubmit(selectedKPI.size());
|
||||
|
||||
|
||||
if(focus!=null) {
|
||||
if(theFocusValue!=null) {
|
||||
|
||||
if(isValidKPI){
|
||||
submitRequestToDM(submitRequestEvent.getChartType());
|
||||
|
@ -296,48 +329,6 @@ public class PerformFishAnnualAnalyticsController {
|
|||
|
||||
}
|
||||
|
||||
private void callPerformFishService(SubmitRequestEvent requestEvent) {
|
||||
|
||||
viewAnnualController.hideErrors();
|
||||
|
||||
final Map<String, List<String>> mapParameters = new HashMap<String, List<String>>();
|
||||
String farmId = decryptParameters.getParameters().get(PerformFishAnalyticsConstant.PERFORM_FISH_FARMID_PARAM);
|
||||
String batchType = viewAnnualController.getForm().getBatchType();
|
||||
|
||||
//List<String> listYear = viewAnnualController.getForm().getYear();
|
||||
|
||||
mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_FARMID_PARAM, Arrays.asList(farmId));
|
||||
mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_BATCH_TYPE_PARAM, Arrays.asList(batchType));
|
||||
|
||||
// if(!listYear.isEmpty()){
|
||||
// mapParameters.put(PerformFishAnalyticsConstant.PERFORM_FISH_QUARTER_PARAM, listYear);
|
||||
// }
|
||||
|
||||
final Modal modal = new Modal(true);
|
||||
modal.setCloseVisible(false);
|
||||
modal.hide(false);
|
||||
final VerticalPanel vp = new VerticalPanel();
|
||||
LoaderIcon loader = new LoaderIcon("Loading batch(es) from PerformFish service, please wait...");
|
||||
vp.add(loader);
|
||||
loader.show(true);
|
||||
modal.add(vp);
|
||||
PerformFishAnalyticsServiceAsync.Util.getInstance().submitRequestToPerformFishService(mapParameters, new AsyncCallback<PerformFishResponse>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
modal.hide();
|
||||
Window.alert(caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(PerformFishResponse performFishResponse) {
|
||||
modal.hide();
|
||||
viewAnnualController.managePerformFishServiceResponse(performFishResponse, mapParameters, POPULATION_LEVEL.FARM);
|
||||
}
|
||||
});
|
||||
modal.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call data miner service for chart type correlation.
|
||||
*
|
||||
|
@ -469,7 +460,7 @@ public class PerformFishAnnualAnalyticsController {
|
|||
submitRequestPanel.addWidget(toBigTitle);
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
hp.getElement().addClassName("ext-horizontal-panel");
|
||||
callDataMinerServiceForChart(viewAnnualController.getPerformFishResponse(), POPULATION_LEVEL.BATCH, Arrays.asList(kpi), Arrays.asList(kpi), algorithm, focusID, submitRequestPanel, hp, tab);
|
||||
callDataMinerServiceForChart(thePerformFishResponse, POPULATION_LEVEL.BATCH, Arrays.asList(kpi), Arrays.asList(kpi), algorithm, focusID, submitRequestPanel, hp, tab);
|
||||
//resultPanel.add(hp);
|
||||
submitRequestPanel.addWidget(hp);
|
||||
}
|
||||
|
@ -487,7 +478,7 @@ public class PerformFishAnnualAnalyticsController {
|
|||
submitRequestPanel.setTheTitle(titleScatter);
|
||||
|
||||
default:
|
||||
callDataMinerServiceForChart(viewAnnualController.getPerformFishResponse(), POPULATION_LEVEL.BATCH, inputKPI, outputKPI, algorithm, focusID, submitRequestPanel, submitRequestPanel.getContainerPanel(), tab);
|
||||
callDataMinerServiceForChart(thePerformFishResponse, POPULATION_LEVEL.BATCH, inputKPI, outputKPI, algorithm, focusID, submitRequestPanel, submitRequestPanel.getContainerPanel(), tab);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,8 @@ package org.gcube.portlets.user.performfishanalytics.client.annualcontrollers;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsConstant;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsConstant.POPULATION_LEVEL;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsServiceAsync;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.view.BaseDockLayoutPanel;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.view.BodyPanel;
|
||||
|
@ -23,7 +21,6 @@ import org.gcube.portlets.user.performfishanalytics.shared.KPI;
|
|||
import org.gcube.portlets.user.performfishanalytics.shared.Population;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.PopulationType;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishInitParameter;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishResponse;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
|
@ -332,42 +329,42 @@ public class PerformFishAnnualAnalyticsViewController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manage perform fish service response.
|
||||
*
|
||||
* @param performFishResponse the perform fish response
|
||||
* @param mapParameters the map parameters
|
||||
* @param populationLevel the population level
|
||||
*/
|
||||
public void managePerformFishServiceResponse(
|
||||
PerformFishResponse performFishResponse,
|
||||
Map<String, List<String>> mapParameters, POPULATION_LEVEL populationLevel) {
|
||||
|
||||
annualListKPIView.managePerformFishServiceResponse(performFishResponse, mapParameters, populationLevel);
|
||||
|
||||
}
|
||||
// /**
|
||||
// * Manage perform fish service response.
|
||||
// *
|
||||
// * @param performFishResponse the perform fish response
|
||||
// * @param mapParameters the map parameters
|
||||
// * @param populationLevel the population level
|
||||
// */
|
||||
// public void managePerformFishServiceResponse(
|
||||
// PerformFishResponse performFishResponse,
|
||||
// Map<String, List<String>> mapParameters, POPULATION_LEVEL populationLevel) {
|
||||
//
|
||||
// annualListKPIView.managePerformFishServiceResponse(performFishResponse, mapParameters, populationLevel);
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Gets the perform fish response.
|
||||
*
|
||||
* @return the perform fish response
|
||||
*/
|
||||
public PerformFishResponse getPerformFishResponse() {
|
||||
|
||||
return annualListKPIView.getPerformFishResponse();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the map parameters.
|
||||
*
|
||||
* @return the map parameters
|
||||
*/
|
||||
public Map<String, List<String>> getRequestMapParameters() {
|
||||
|
||||
return annualListKPIView.getMapParameters();
|
||||
}
|
||||
// /**
|
||||
// * Gets the perform fish response.
|
||||
// *
|
||||
// * @return the perform fish response
|
||||
// */
|
||||
// public PerformFishResponse getPerformFishResponse() {
|
||||
//
|
||||
// return annualListKPIView.getPerformFishResponse();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Gets the map parameters.
|
||||
// *
|
||||
// * @return the map parameters
|
||||
// */
|
||||
// public Map<String, List<String>> getRequestMapParameters() {
|
||||
//
|
||||
// return annualListKPIView.getMapParameters();
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -396,6 +393,17 @@ public class PerformFishAnnualAnalyticsViewController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show alert.
|
||||
*
|
||||
* @param message the message
|
||||
* @param type the type
|
||||
*/
|
||||
public void showAlert(String message, AlertType type){
|
||||
bodyPage.showAlert(message, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate batch id selection.
|
||||
*
|
||||
|
|
|
@ -2,12 +2,13 @@ package org.gcube.portlets.user.performfishanalytics.client.event;
|
|||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
/**
|
||||
* The Class LoadFocusEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* May 7, 2019
|
||||
* May 8, 2019
|
||||
*/
|
||||
public class LoadFocusEvent extends GwtEvent<LoadFocusEventHandler> {
|
||||
public static Type<LoadFocusEventHandler> TYPE = new Type<LoadFocusEventHandler>();
|
||||
|
@ -32,5 +33,4 @@ public class LoadFocusEvent extends GwtEvent<LoadFocusEventHandler> {
|
|||
protected void dispatch(LoadFocusEventHandler handler) {
|
||||
handler.onLoadFocusEvent(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,14 +6,6 @@ package org.gcube.portlets.user.performfishanalytics.client.viewannualbinder;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsConstant;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsConstant.POPULATION_LEVEL;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsServiceAsync;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.annualcontrollers.PerformFishAnnualAnalyticsController;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.AddedBatchIdEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVRow;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishResponse;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
|
@ -22,8 +14,6 @@ import com.google.gwt.core.client.GWT;
|
|||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
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.Composite;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
|
@ -92,84 +82,6 @@ public class AnnualListKPIView extends Composite {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage perform fish service response.
|
||||
*
|
||||
* @param performFishResponse the perform fish response
|
||||
* @param mapParameters the map parameters
|
||||
* @param level the level
|
||||
*/
|
||||
public void managePerformFishServiceResponse(
|
||||
PerformFishResponse performFishResponse,
|
||||
Map<String, List<String>> mapParameters, final POPULATION_LEVEL level) {
|
||||
this.performFishResponse = performFishResponse;
|
||||
this.mapParameters = mapParameters;
|
||||
|
||||
GWT.log("PerformFish Response: "+performFishResponse);
|
||||
|
||||
/*String fileURL = performFishResponse.getMapParameters().get(PerformFishAnalyticsConstant.BATCHES_TABLE_INTERNAL);
|
||||
|
||||
GWT.log("BatchesTable_internal is: "+fileURL);
|
||||
|
||||
//Managing the Perform Fish Service Response
|
||||
if(fileURL==null){
|
||||
showAlert("No select found for "+PerformFishAnalyticsConstant.BATCHES_TABLE_INTERNAL, AlertType.ERROR, false, the_panel_error);
|
||||
}else{
|
||||
|
||||
final LoaderIcon loader = new LoaderIcon("Loading Values...");
|
||||
the_panel_container.insert(loader, 1);
|
||||
|
||||
PerformFishAnalyticsServiceAsync.Util.getInstance().readCSVFile(fileURL, new AsyncCallback<CSVFile>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
loader.setVisible(false);
|
||||
the_panel_container.remove(loader);
|
||||
Window.alert(caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CSVFile result) {
|
||||
loader.setVisible(false);
|
||||
the_panel_container.remove(loader);
|
||||
|
||||
if(result==null){
|
||||
showAlert("No value found for "+PerformFishAnalyticsConstant.BATCHES_TABLE_INTERNAL, AlertType.ERROR, false, the_panel_error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//IT CAN BE "BATCH", "FARM", etc.
|
||||
String theScalePParamValue = level.name();
|
||||
int indexOfTheScaleValue = result.getHeaderRow().getListValues().indexOf(theScalePParamValue);
|
||||
|
||||
if(indexOfTheScaleValue>-1){
|
||||
List<CSVRow> rows = result.getValueRows();
|
||||
|
||||
if(rows==null || rows.isEmpty()){
|
||||
PerformFishAnnualAnalyticsController.eventBus.fireEvent(new AddedBatchIdEvent());
|
||||
return;
|
||||
}
|
||||
|
||||
for (CSVRow row : rows) {
|
||||
String valuePerScaleP = row.getListValues().get(indexOfTheScaleValue);
|
||||
//field_list_focus_id_dea.addItem(valuePerScaleP, valuePerScaleP);
|
||||
// uib_list_batch_id.addItem(valuePerScaleP, valuePerScaleP);
|
||||
// listBatchesID.add(valuePerScaleP);
|
||||
}
|
||||
|
||||
// uib_list_batch_id.addItem(PerformFishAnalyticsConstant.DM_FOCUS_ID_ALL_VALUE, PerformFishAnalyticsConstant.DM_FOCUS_ID_ALL_VALUE);
|
||||
// listBatchesID.add(PerformFishAnalyticsConstant.DM_FOCUS_ID_ALL_VALUE);
|
||||
|
||||
PerformFishAnnualAnalyticsController.eventBus.fireEvent(new AddedBatchIdEvent());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} */
|
||||
}
|
||||
|
||||
/**
|
||||
* Show alert.
|
||||
*
|
||||
|
@ -209,26 +121,26 @@ public class AnnualListKPIView extends Composite {
|
|||
public void showSelectionOK(String msg, boolean closable){
|
||||
showAlert(msg, AlertType.INFO, closable, the_panel_error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the perform fish response.
|
||||
*
|
||||
* @return the performFishResponse
|
||||
*/
|
||||
public PerformFishResponse getPerformFishResponse() {
|
||||
|
||||
return performFishResponse;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the map parameters.
|
||||
*
|
||||
* @return the mapParameters
|
||||
*/
|
||||
public Map<String, List<String>> getMapParameters() {
|
||||
|
||||
return mapParameters;
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * Gets the perform fish response.
|
||||
// *
|
||||
// * @return the performFishResponse
|
||||
// */
|
||||
// public PerformFishResponse getPerformFishResponse() {
|
||||
//
|
||||
// return performFishResponse;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Gets the map parameters.
|
||||
// *
|
||||
// * @return the mapParameters
|
||||
// */
|
||||
// public Map<String, List<String>> getMapParameters() {
|
||||
//
|
||||
// return mapParameters;
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import java.util.Map;
|
|||
|
||||
import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsConstant;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.annualcontrollers.PerformFishAnnualAnalyticsController;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadFocusEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationTypeEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadFocusEvent;
|
||||
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.Population;
|
||||
|
|
Loading…
Reference in New Issue