Enhancement on Task #17166 Release Synoptic table functionality
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@181203 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5efabf2bc9
commit
0934f0cb84
|
@ -7,8 +7,9 @@ package org.gcube.portlets.user.performfishanalytics.client;
|
|||
/**
|
||||
* The Enum DataMinerAlgorithms.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 8, 2019
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Jul 12, 2019
|
||||
*/
|
||||
public enum DataMinerAlgorithms {
|
||||
|
||||
|
@ -17,7 +18,8 @@ public enum DataMinerAlgorithms {
|
|||
SPEEDOMETER("SPEEDOMETER","SPEEDOMETER"),
|
||||
BOXPLOT("BOXPLOT","BOXPLOT"),
|
||||
DEA_ANALYSIS("DEA_ANALYSIS", "DEA_ANALYSIS"),
|
||||
CORRELATION("CORRELATION", "CORRELATION");
|
||||
CORRELATION("CORRELATION", "CORRELATION"),
|
||||
PERFORMFISH_SYNOPTICTABLE_BATCH("PERFORMFISH_SYNOPTICTABLE_BATCH", "PERFORMFISH_SYNOPTICTABLE_BATCH");
|
||||
|
||||
String id;
|
||||
String name;
|
||||
|
|
|
@ -30,7 +30,13 @@ public class PerformFishAnalyticsConstant {
|
|||
public static final String DM_INPUT_KPI_PARAM = "inputKPI";
|
||||
public static final String DM_OUTPUT_KPI_PARAM = "outputKPI";
|
||||
public static final int CSV_BATCHES_TABLE_MINIMUM_SIZE = 4;
|
||||
|
||||
|
||||
//SYNOPTIC TABLE
|
||||
public static final String DM_INPUT_TABLE = "inputTable";
|
||||
public static final String DM_ZONE_LABELS = "zonesLabels";
|
||||
public static final String DM_QUARTER_LABELS = "quartersLabels";
|
||||
public static final String DM_VALUE_ALL = "ALL";
|
||||
|
||||
public static final String PERFORM_FISH_AREA_PARAM = "area";
|
||||
public static final String PERFORM_FISH_QUARTER_PARAM = "quarter";
|
||||
public static final String PERFORM_FISH_PERIOD_PARAM = "period";
|
||||
|
|
|
@ -100,4 +100,7 @@ public interface PerformFishAnalyticsService extends RemoteService {
|
|||
|
||||
DataMinerResponse callingDataMinerPerformFishAnnualCorrelationAnalysis(PerformFishResponse peformFishReponse,
|
||||
Map<String, List<String>> mapParameters) throws Exception;
|
||||
|
||||
DataMinerResponse callDMServiceToLoadSynopticTable(PerformFishResponse performFishResponse,
|
||||
Map<String, List<String>> mapParameters) throws Exception;
|
||||
}
|
||||
|
|
|
@ -85,4 +85,8 @@ public interface PerformFishAnalyticsServiceAsync
|
|||
|
||||
void callingDataMinerPerformFishAnnualCorrelationAnalysis(PerformFishResponse peformFishReponse,
|
||||
Map<String, List<String>> mapParameters, AsyncCallback<DataMinerResponse> callback);
|
||||
|
||||
|
||||
void callDMServiceToLoadSynopticTable(PerformFishResponse performFishResponse,
|
||||
Map<String, List<String>> mapParameters, AsyncCallback<DataMinerResponse> asyncCallback);
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ public class PerformFishAnnualAnalyticsViewController {
|
|||
headerPage.showLoading(true, "Loading Data....");
|
||||
westPanel = new VerticalPanel();
|
||||
estPanel = new VerticalPanel();
|
||||
recapPage = new RecapSubmitPage(PerformFishAnnualAnalyticsController.eventBus);
|
||||
recapPage = new RecapSubmitPage(PerformFishAnnualAnalyticsController.eventBus, true);
|
||||
tabPanel = new TabPanelView();
|
||||
|
||||
headerPage.add(new PortletTitle("PerformFISH Statistical Analysis"));
|
||||
|
|
|
@ -21,6 +21,8 @@ import org.gcube.portlets.user.performfishanalytics.client.event.LoadBatchesEven
|
|||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadBatchesEventHandler;
|
||||
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.LoadSynopticTableEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadSynopticTableEventHandler;
|
||||
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;
|
||||
|
@ -35,6 +37,7 @@ 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.KPI;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.PopulationType;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.dataminer.DataMinerResponse;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishInitParameter;
|
||||
|
@ -53,6 +56,7 @@ 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.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Panel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
@ -133,7 +137,14 @@ public class PerformFishAnalyticsController {
|
|||
public void onSelectedPopulationType(
|
||||
SelectedPopulationTypeEvent selectedPopulationTypeEvent) {
|
||||
|
||||
PopulationType opt = selectedPopulationTypeEvent.getSelectedPopulationType();
|
||||
viewController.setRootPopulationTypeForKPIs(selectedPopulationTypeEvent.getSelectedPopulationType());
|
||||
|
||||
if (opt.getName().equalsIgnoreCase(PerformFishAnalyticsConstant.BATCH_LEVEL.GROW_OUT_INDIVIDUAL_CLOSED_BATCHES.name())) {
|
||||
viewController.visibleSynopticTable(true);
|
||||
} else {
|
||||
viewController.visibleSynopticTable(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -225,7 +236,7 @@ public class PerformFishAnalyticsController {
|
|||
//viewController.resetBatchIdStatus();
|
||||
viewController.setBatchIdStatus(ControlGroupType.INFO);
|
||||
viewController.enableLoadBatches(true);
|
||||
viewController.enableSynopticTable(true);
|
||||
viewController.enableSynopticTable(false);
|
||||
viewController.showAlertForLoadBatches("Please load your batches corresponding to the selected options, by pressing the 'Load Batches' button", AlertType.INFO, false);
|
||||
viewController.enableAllAlgorithmsForSubmit(false);
|
||||
|
||||
|
@ -243,10 +254,14 @@ public class PerformFishAnalyticsController {
|
|||
public void onAddedBatchId(AddedBatchIdEvent checkValidBatchIdEvent) {
|
||||
|
||||
boolean isBatchIdValid = viewController.validateBatchIdSelection();
|
||||
if(isBatchIdValid)
|
||||
if(isBatchIdValid) {
|
||||
viewController.enableAllAlgorithmsForSubmit(true);
|
||||
else
|
||||
viewController.enableSynopticTable(true);
|
||||
}
|
||||
else {
|
||||
viewController.enableAllAlgorithmsForSubmit(false);
|
||||
viewController.enableSynopticTable(false);
|
||||
}
|
||||
|
||||
//viewController.resyncSelectedKPIs();
|
||||
}
|
||||
|
@ -299,6 +314,80 @@ public class PerformFishAnalyticsController {
|
|||
return;
|
||||
}
|
||||
});
|
||||
|
||||
eventBus.addHandler(LoadSynopticTableEvent.TYPE, new LoadSynopticTableEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onLoadSynopticTable(LoadSynopticTableEvent loadSynopticTableEvent) {
|
||||
|
||||
boolean isValidBatchId = viewController.validateBatchIdSelection();
|
||||
|
||||
if(isValidBatchId) {
|
||||
callAlgorithmSynopticTableBatch(viewController.getPerformFishResponse(), viewController.getRequestMapParameters());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void callAlgorithmSynopticTableBatch(final PerformFishResponse performFishResponse, final Map<String, List<String>> performFishRequestParameters) {
|
||||
GWT.log("Read perform fish response: "+performFishResponse);
|
||||
|
||||
String batchTableURL = performFishResponse.getMapParameters().get(PerformFishAnalyticsConstant.BATCHES_TABLE);
|
||||
|
||||
if(batchTableURL==null || batchTableURL.isEmpty())
|
||||
Window.alert("Something seems wrong. No batches tables matching with parameter "+PerformFishAnalyticsConstant.BATCHES_TABLE+" returned from service");
|
||||
|
||||
final Map<String, List<String>> mapParameters = new HashMap<String, List<String>>();
|
||||
|
||||
StringBuilder dataInputsFormatter = new StringBuilder();
|
||||
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_INPUT_TABLE+"="+ batchTableURL +";");
|
||||
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_ZONE_LABELS+"="+PerformFishAnalyticsConstant.DM_VALUE_ALL+";");
|
||||
dataInputsFormatter.append(PerformFishAnalyticsConstant.DM_QUARTER_LABELS+"="+PerformFishAnalyticsConstant.DM_VALUE_ALL+";");
|
||||
String dataInParameters = dataInputsFormatter.toString();
|
||||
|
||||
mapParameters.put(PerformFishAnalyticsConstant.DATA_INPUTS, Arrays.asList(dataInParameters));
|
||||
|
||||
GWT.log("Calling DM service with client input parameters: "+mapParameters);
|
||||
|
||||
final DataMinerAlgorithms chartType = DataMinerAlgorithms.PERFORMFISH_SYNOPTICTABLE_BATCH;
|
||||
|
||||
final SubmitRequestPanel submitRequestPanel = new SubmitRequestPanel("", 1);
|
||||
//submitRequestPanel.getElement().addClassName("ext-horizontal-panel");
|
||||
String tabTitle = chartType.getName().substring(0,1).toUpperCase()+chartType.getName().toLowerCase().substring(1,chartType.getName().length()); //CAMEL CASE
|
||||
final Tab tab = viewController.createTab(submitRequestPanel, tabTitle+" #"+(viewController.currentNumberOfTab()+1));
|
||||
final HTMLPanel panelContainer = submitRequestPanel.getContainerPanel();
|
||||
|
||||
final LoaderIcon loaderIcon = new LoaderIcon("Submitting request to "+DataMinerAlgorithms.PERFORMFISH_SYNOPTICTABLE_BATCH.getName()+"...");
|
||||
loaderIcon.setVisible(true);
|
||||
panelContainer.setVisible(true);
|
||||
panelContainer.add(loaderIcon);
|
||||
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
|
||||
@Override
|
||||
public void execute() {
|
||||
loaderIcon.setFocus(true);
|
||||
}});
|
||||
|
||||
PerformFishAnalyticsServiceAsync.Util.getInstance().callDMServiceToLoadSynopticTable(performFishResponse, mapParameters, new AsyncCallback<DataMinerResponse>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(DataMinerResponse dmResponse) {
|
||||
loaderIcon.setVisible(false);
|
||||
checkTabSpinner(submitRequestPanel, tab);
|
||||
//field_unary_algorithm.setVisible(true);
|
||||
GWT.log("I'm displaying: "+dmResponse);
|
||||
displayOutputFilesAsStaticEntities(dmResponse, chartType, null, null, null, panelContainer, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
loaderIcon.setVisible(false);
|
||||
checkTabSpinner(submitRequestPanel, tab);
|
||||
displayOutputFilesAsStaticEntities(null, chartType, null, null, null, panelContainer, true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
@ -622,6 +711,8 @@ public class PerformFishAnalyticsController {
|
|||
break;
|
||||
case DEA_CHART:
|
||||
break;
|
||||
case PERFORMFISH_SYNOPTICTABLE_BATCH:
|
||||
break;
|
||||
}
|
||||
|
||||
ShowResult showResult = new ShowResult(title);
|
||||
|
@ -665,6 +756,8 @@ public class PerformFishAnalyticsController {
|
|||
break;
|
||||
case DEA_CHART:
|
||||
break;
|
||||
case PERFORMFISH_SYNOPTICTABLE_BATCH:
|
||||
break;
|
||||
}
|
||||
|
||||
ShowResult showResult = new ShowResult(title);
|
||||
|
|
|
@ -128,7 +128,7 @@ public class PerformFishAnalyticsViewController {
|
|||
headerPage.showLoading(true, "Loading Data....");
|
||||
westPanel = new VerticalPanel();
|
||||
estPanel = new VerticalPanel();
|
||||
recapPage = new RecapSubmitPage(PerformFishAnalyticsController.eventBus);
|
||||
recapPage = new RecapSubmitPage(PerformFishAnalyticsController.eventBus, false);
|
||||
tabPanel = new TabPanelView();
|
||||
|
||||
headerPage.add(new PortletTitle("PerformFISH Statistical Analysis"));
|
||||
|
@ -576,16 +576,28 @@ public class PerformFishAnalyticsViewController {
|
|||
* @param closable the closable
|
||||
*/
|
||||
public void showAlertForLoadBatches(String msg, AlertType type, boolean closable){
|
||||
|
||||
batchIDAndListKPI.showAlert(msg, type, closable);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Enable synoptic table.
|
||||
*
|
||||
* @param b the b
|
||||
*/
|
||||
public void enableSynopticTable(boolean b) {
|
||||
form.setEnableSynopticTable(b);
|
||||
|
||||
recapPage.activeSynopticTable(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Visible synoptic table.
|
||||
*
|
||||
* @param b the b
|
||||
*/
|
||||
public void visibleSynopticTable(boolean b){
|
||||
recapPage.setVisibleLoadSynopsisPanel(b);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,13 @@ import org.gcube.portlets.user.performfishanalytics.shared.performfishservice.Pe
|
|||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
/**
|
||||
* The Class LoadPopulationTypeEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
* Jan 22, 2019
|
||||
*
|
||||
* Jul 12, 2019
|
||||
*/
|
||||
public class LoadPopulationTypeEvent extends GwtEvent<LoadPopulationTypeEventHandler> {
|
||||
public static Type<LoadPopulationTypeEventHandler> TYPE = new Type<LoadPopulationTypeEventHandler>();
|
||||
|
@ -19,7 +21,7 @@ public class LoadPopulationTypeEvent extends GwtEvent<LoadPopulationTypeEventHan
|
|||
* Instantiates a new load population type event.
|
||||
*
|
||||
* @param populationName the population name
|
||||
* @param result
|
||||
* @param result the result
|
||||
*/
|
||||
public LoadPopulationTypeEvent(String populationName, PerformFishInitParameter result) {
|
||||
|
||||
|
@ -49,6 +51,8 @@ public class LoadPopulationTypeEvent extends GwtEvent<LoadPopulationTypeEventHan
|
|||
|
||||
|
||||
/**
|
||||
* Gets the inits the parameters.
|
||||
*
|
||||
* @return the initParameters
|
||||
*/
|
||||
public PerformFishInitParameter getInitParameters() {
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package org.gcube.portlets.user.performfishanalytics.client.event;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
/**
|
||||
* The Class LoadSynopticTableEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Jul 12, 2019
|
||||
*/
|
||||
public class LoadSynopticTableEvent extends GwtEvent<LoadSynopticTableEventHandler> {
|
||||
public static Type<LoadSynopticTableEventHandler> TYPE = new Type<LoadSynopticTableEventHandler>();
|
||||
private boolean annualAnalysis;
|
||||
|
||||
/**
|
||||
* Instantiates a new load batches event.
|
||||
*/
|
||||
public LoadSynopticTableEvent(boolean annualAnalysis) {
|
||||
this.annualAnalysis = annualAnalysis;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<LoadSynopticTableEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(LoadSynopticTableEventHandler handler) {
|
||||
handler.onLoadSynopticTable(this);
|
||||
}
|
||||
|
||||
public boolean isAnnualAnalysis() {
|
||||
return annualAnalysis;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.user.performfishanalytics.client.event;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface LoadSynopticTableEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Jul 12, 2019
|
||||
*/
|
||||
public interface LoadSynopticTableEventHandler extends EventHandler {
|
||||
|
||||
|
||||
/**
|
||||
* On load synoptic table.
|
||||
*
|
||||
* @param loadSynopticTableEvent the load synoptic table event
|
||||
*/
|
||||
void onLoadSynopticTable(LoadSynopticTableEvent loadSynopticTableEvent);
|
||||
}
|
|
@ -18,7 +18,6 @@ import org.gcube.portlets.user.performfishanalytics.shared.Quarter;
|
|||
import org.gcube.portlets.user.performfishanalytics.shared.Species;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
|
@ -94,8 +93,8 @@ public class PerformFishAnalitycsFormView extends Composite {
|
|||
CheckBox uib_check_all_area;
|
||||
@UiField
|
||||
CheckBox uib_check_all_quarter;
|
||||
@UiField
|
||||
Button uib_button_load_synoptic_table;
|
||||
// @UiField
|
||||
// Button uib_button_load_synoptic_table;
|
||||
|
||||
// @UiField
|
||||
// Fieldset fieldset_add_catalogue_bean;
|
||||
|
@ -136,11 +135,11 @@ public class PerformFishAnalitycsFormView extends Composite {
|
|||
GWT.log("Selected population type: " + populatioTypeSelected);
|
||||
PopulationType opt = mapPopulationType.get(populatioTypeSelected);
|
||||
|
||||
if(opt.getName().equalsIgnoreCase("GROW_OUT_INDIVIDUAL_CLOSED_BATCHES")) {
|
||||
uib_button_load_synoptic_table.setVisible(true);
|
||||
}else {
|
||||
uib_button_load_synoptic_table.setVisible(false);
|
||||
}
|
||||
// if(opt.getName().equalsIgnoreCase("GROW_OUT_INDIVIDUAL_CLOSED_BATCHES")) {
|
||||
// uib_button_load_synoptic_table.setVisible(true);
|
||||
// }else {
|
||||
// uib_button_load_synoptic_table.setVisible(false);
|
||||
// }
|
||||
|
||||
PerformFishAnalyticsController.eventBus.fireEvent(new SelectedPopulationTypeEvent(opt));
|
||||
fillSpecies(opt.getListSpecies());
|
||||
|
@ -220,25 +219,25 @@ public class PerformFishAnalitycsFormView extends Composite {
|
|||
}
|
||||
});
|
||||
|
||||
uib_button_load_synoptic_table.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
// boolean isValidForm = vivalidatePerformFishInputFields();
|
||||
//PerformFishAnalyticsController.eventBus.fireEvent(new PerformFishFieldFormChangedEvent(uib_button_load_synoptic_table));
|
||||
}
|
||||
});
|
||||
// uib_button_load_synoptic_table.addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
//// boolean isValidForm = vivalidatePerformFishInputFields();
|
||||
// PerformFishAnalyticsController.eventBus.fireEvent(new LoadSynopticTableEvent(false));
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the enable synoptic table.
|
||||
*
|
||||
* @param b the new enable synoptic table
|
||||
*/
|
||||
public void setEnableSynopticTable(boolean b) {
|
||||
uib_button_load_synoptic_table.setEnabled(b);
|
||||
}
|
||||
// /**
|
||||
// * Sets the enable synoptic table.
|
||||
// *
|
||||
// * @param b the new enable synoptic table
|
||||
// */
|
||||
// public void setEnableSynopticTable(boolean b) {
|
||||
// uib_button_load_synoptic_table.setEnabled(b);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -100,13 +100,6 @@
|
|||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup>
|
||||
<b:Controls>
|
||||
<b:Button ui:field="uib_button_load_synoptic_table"
|
||||
visible="false" enabled="false">Synoptic Table</b:Button>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
|
|
|
@ -9,6 +9,8 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import org.gcube.portlets.user.performfishanalytics.client.DataMinerAlgorithms;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsController;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.LoadSynopticTableEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.SubmitRequestEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
|
||||
|
||||
|
@ -55,12 +57,20 @@ public class RecapSubmitPage extends Composite {
|
|||
|
||||
@UiField
|
||||
VerticalPanel errorPanelSubmit;
|
||||
|
||||
@UiField
|
||||
VerticalPanel synopsisPanel;
|
||||
|
||||
@UiField
|
||||
Button uib_button_load_synoptic_table;
|
||||
|
||||
private HashMap<String, KPI> mapSelected = new HashMap<String, KPI>();
|
||||
private HashMap<String, HTML> mapLabel = new HashMap<String, HTML>();
|
||||
|
||||
private HandlerManager theEventBus;
|
||||
|
||||
private boolean annualAnalysis;
|
||||
|
||||
/**
|
||||
* The Interface RecapSubmitPageUiBinder.
|
||||
*
|
||||
|
@ -80,9 +90,12 @@ public class RecapSubmitPage extends Composite {
|
|||
* </ui:UiBinder>
|
||||
* Note that depending on the widget that is used, it may be necessary to
|
||||
* implement HasHTML instead of HasText.
|
||||
*
|
||||
* @param eventBus the event bus
|
||||
* @param annualAnalysis the annual analysis
|
||||
*/
|
||||
public RecapSubmitPage(HandlerManager eventBus) {
|
||||
|
||||
public RecapSubmitPage(HandlerManager eventBus, final boolean annualAnalysis) {
|
||||
this.annualAnalysis = annualAnalysis;
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.theEventBus = eventBus;
|
||||
|
||||
|
@ -133,8 +146,36 @@ public class RecapSubmitPage extends Composite {
|
|||
theEventBus.fireEvent(new SubmitRequestEvent(chartType));
|
||||
}
|
||||
});
|
||||
|
||||
uib_button_load_synoptic_table.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
// boolean isValidForm = vivalidatePerformFishInputFields();
|
||||
PerformFishAnalyticsController.eventBus.fireEvent(new LoadSynopticTableEvent(annualAnalysis));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the visible load synopsis panel.
|
||||
*
|
||||
* @param b the new visible load synopsis panel
|
||||
*/
|
||||
public void setVisibleLoadSynopsisPanel(boolean b) {
|
||||
synopsisPanel.setVisible(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the enable synoptic table.
|
||||
*
|
||||
* @param b the new enable synoptic table
|
||||
*/
|
||||
public void activeSynopticTable(boolean b) {
|
||||
uib_button_load_synoptic_table.setEnabled(b);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -295,8 +336,14 @@ public class RecapSubmitPage extends Composite {
|
|||
msg.setType(AlertType.ERROR);
|
||||
errorPanelSubmit.add(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is annual analysis.
|
||||
*
|
||||
* @return true, if is annual analysis
|
||||
*/
|
||||
public boolean isAnnualAnalysis() {
|
||||
return annualAnalysis;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +1,49 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
/* Add CSS here. See the GWT docs on UI Binder for more details */
|
||||
.thetitle {
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.theMarginTop50 {
|
||||
margin-top: 50px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<g:VerticalPanel ui:field="recapPanel">
|
||||
<g:Label styleName="{style.thetitle}" addStyleNames="selected-kpi-panel">
|
||||
<g:Label styleName="{style.thetitle}"
|
||||
addStyleNames="selected-kpi-panel">
|
||||
Selected KPIs
|
||||
</g:Label>
|
||||
</g:VerticalPanel>
|
||||
<g:VerticalPanel ui:field="errorPanelSubmit">
|
||||
</g:VerticalPanel>
|
||||
<g:VerticalPanel styleName="{style.theMarginTop50}">
|
||||
<b:Button ui:field="uib_butt_descriptive_statistics" text="Descriptive Statistics" name="BOXPLOT" addStyleNames="the_margin_top" enabled="false"></b:Button>
|
||||
<b:Button ui:field="uib_butt_speedometer" text="Speedometer" name="SPEEDOMETER" addStyleNames="the_margin_top" enabled="false"></b:Button>
|
||||
<b:Button ui:field="uib_butt_scatter_plot" text="Scatter Plot" name="SCATTER" addStyleNames="the_margin_top" enabled="false"></b:Button>
|
||||
<b:Button ui:field="uib_butt_correlation_analysis" text="Correlation Analysis" name="CORRELATION" addStyleNames="the_margin_top" enabled="false"></b:Button>
|
||||
<b:Button ui:field="uib_butt_descriptive_statistics"
|
||||
text="Descriptive Statistics" name="BOXPLOT"
|
||||
addStyleNames="the_margin_top" enabled="false"></b:Button>
|
||||
<b:Button ui:field="uib_butt_speedometer" text="Speedometer"
|
||||
name="SPEEDOMETER" addStyleNames="the_margin_top" enabled="false"></b:Button>
|
||||
<b:Button ui:field="uib_butt_scatter_plot"
|
||||
text="Scatter Plot" name="SCATTER" addStyleNames="the_margin_top"
|
||||
enabled="false"></b:Button>
|
||||
<b:Button ui:field="uib_butt_correlation_analysis"
|
||||
text="Correlation Analysis" name="CORRELATION"
|
||||
addStyleNames="the_margin_top" enabled="false"></b:Button>
|
||||
</g:VerticalPanel>
|
||||
<g:VerticalPanel ui:field="synopsisPanel"
|
||||
styleName="{style.theMarginTop50}">
|
||||
<g:Label styleName="{style.thetitle}"
|
||||
addStyleNames="selected-kpi-panel">
|
||||
Synopsis
|
||||
</g:Label>
|
||||
<b:Button ui:field="uib_button_load_synoptic_table"
|
||||
enabled="false" addStyleNames="the_margin_top" name="PERFORMFISH_SYNOPTICTABLE_BATCH">Load Synoptic Table</b:Button>
|
||||
</g:VerticalPanel>
|
||||
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -469,6 +469,38 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
|
|||
|
||||
return callTheDataMinerPerformFishCorrelationAnalysis(peformFishReponse,dmRequestParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataMinerResponse callDMServiceToLoadSynopticTable(PerformFishResponse performFishResponse,
|
||||
Map<String, List<String>> mapParameters) throws Exception{
|
||||
|
||||
log.info("Validating Perform-Fish service response...");
|
||||
|
||||
String URLToBatchesTable = performFishResponse.getMapParameters().get(PerformFishAnalyticsConstant.BATCHES_TABLE);
|
||||
|
||||
if(URLToBatchesTable==null || URLToBatchesTable.isEmpty())
|
||||
throw new Exception("Something seems "+PerformFishAnalyticsConstant.BATCHES_TABLE+ " is null or emty");
|
||||
|
||||
//Checking that the perform-fish PerformFishAnalyticsConstant.BATCHES_TABLE has at least 1 row
|
||||
// CSVFile csvFile = readCSVFile(URLToBatchesTable);
|
||||
// log.info("CSVFile read from {} - {}", URLToBatchesTable, csvFile);
|
||||
// if(csvFile==null || csvFile.getValueRows() == null || csvFile.getValueRows().size()<PerformFishAnalyticsConstant.CSV_BATCHES_TABLE_MINIMUM_SIZE){
|
||||
// log.warn("The "+PerformFishAnalyticsConstant.BATCHES_TABLE+" CSV rows are"+csvFile.getValueRows()+". It is less than "+PerformFishAnalyticsConstant.CSV_BATCHES_TABLE_MINIMUM_SIZE);
|
||||
// throw new Exception("Your request does not produce enough data for the analysis, please change your selection and try again");
|
||||
// }
|
||||
|
||||
log.info("Calling the DM service with client parameters: "+mapParameters.toString());
|
||||
//PortalContextInfo pContext = ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
Map<String, List<String>> dmRequestParameters = new HashMap<String, List<String>>();
|
||||
dmRequestParameters.put("request", Arrays.asList("Execute"));
|
||||
dmRequestParameters.put("service", Arrays.asList("WPS"));
|
||||
dmRequestParameters.put("Version", Arrays.asList("1.0.0"));
|
||||
//dmRequestParameters.put("gcube-token", Arrays.asList(pContext.getUserToken()));
|
||||
dmRequestParameters.put("lang", Arrays.asList("en-US"));
|
||||
dmRequestParameters.put("Identifier", Arrays.asList("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.PERFORMFISH_SYNOPTICTABLE_BATCH"));
|
||||
dmRequestParameters.putAll(mapParameters);
|
||||
return callTheDataMiner(dmRequestParameters);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -515,7 +547,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
|
|||
List<DataMinerOutputData> listOut = dmResponse.getListDMOutputData();
|
||||
for (DataMinerOutputData dataMinerOutputData : listOut) {
|
||||
//I'm using this specific output data of DM
|
||||
if(dataMinerOutputData.getFileDescription().contains("outputCharts")){
|
||||
if(dataMinerOutputData.getFileDescription().toLowerCase().contains("outputcharts")){
|
||||
log.info("The output: "+dataMinerOutputData.getFileDescription()+ " with: "+dataMinerOutputData.getMimeType()+" is the candidate to unzip");
|
||||
toDMOutputData = dataMinerOutputData;
|
||||
break;
|
||||
|
@ -523,7 +555,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
|
|||
}
|
||||
|
||||
if(toDMOutputData==null || toDMOutputData.getPublicURL()==null)
|
||||
throw new Exception("The response returned by DM service does not contain a file to unzip with name: 'outputCharts'. Please report this issue at www.d4science.org/contact-us");
|
||||
throw new Exception("The response returned by DM service does not contain a file to unzip with name: 'outputcharts'. Please report this issue at www.d4science.org/contact-us");
|
||||
|
||||
String theZipFileURL = toDMOutputData.getPublicURL();
|
||||
log.info("I'm using the file: "+theZipFileURL);
|
||||
|
@ -625,7 +657,13 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
|
|||
List<DataMinerOutputData> listOut = dmResponse.getListDMOutputData();
|
||||
for (DataMinerOutputData dataMinerOutputData : listOut) {
|
||||
//I'm using this specific output data of DM
|
||||
if(dataMinerOutputData.getFileDescription().contains("outputCharts")){
|
||||
if(dataMinerOutputData.getFileDescription().toLowerCase().contains("outputcharts")){
|
||||
log.info("The output: "+dataMinerOutputData.getFileDescription()+ " with: "+dataMinerOutputData.getMimeType()+" is the candidate to unzip");
|
||||
toDMOutputData = dataMinerOutputData;
|
||||
break;
|
||||
}
|
||||
|
||||
if(dataMinerOutputData.getFileDescription().toLowerCase().contains("outputfile")){
|
||||
log.info("The output: "+dataMinerOutputData.getFileDescription()+ " with: "+dataMinerOutputData.getMimeType()+" is the candidate to unzip");
|
||||
toDMOutputData = dataMinerOutputData;
|
||||
break;
|
||||
|
@ -633,7 +671,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
|
|||
}
|
||||
|
||||
if(toDMOutputData==null || toDMOutputData.getPublicURL()==null)
|
||||
throw new Exception("The response returned by DM service does not contain a file to unzip with name: 'outputCharts'. Please report this issue at www.d4science.org/contact-us");
|
||||
throw new Exception("The response returned by DM service does not contain a file to unzip with name: 'outputcharts' or 'outputfile'. Please report this issue at www.d4science.org/contact-us");
|
||||
|
||||
String theZipFileURL = toDMOutputData.getPublicURL();
|
||||
log.info("I'm using the file: "+theZipFileURL);
|
||||
|
@ -965,4 +1003,5 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue