From 9e8e32a0d0b534d9851ea3ce284cc462d904b0bf Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 27 May 2020 20:05:55 +0200 Subject: [PATCH] ref 17249: Save produced charts as report https://support.d4science.org/issues/17249 Updated PDF support --- changelog.md | 56 +++++ changelog.xml | 16 +- pom.xml | 2 +- .../PerformFishAnnualAnalyticsController.java | 233 +++++++++--------- .../BoxPlotAnnualPanelResult.java | 6 +- .../CorrelationAnnualPanelResult.java | 9 +- .../ScatterAnnualPanelResult.java | 6 +- .../SpeedometerAnnualPanelResult.java | 9 +- .../SynopticTableAnnualPanelResult.java | 10 +- .../client/viewbinder/BoxPlotPanelResult.java | 8 +- .../client/viewbinder/ScatterPanelResult.java | 7 +- .../viewbinder/SpeedometerPanelResult.java | 10 +- .../viewbinder/SynopticTablePanelResult.java | 8 +- 13 files changed, 239 insertions(+), 141 deletions(-) create mode 100644 changelog.md diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..f6dcaa1 --- /dev/null +++ b/changelog.md @@ -0,0 +1,56 @@ +# Changelog + +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [v1.0.0] - 2020-05-28 + +### Added + +**Features** + +[#17249] Added PDF support + + +## [v0.4.0] - 2019-11-07 + +### Added + +**Features** + +[#17252] Enabled DEA Analysis + + +## [v0.3.0] - 2019-07-07 + +### Added + +**Features** + +[#17247] Add numbers to correlation charts + +[#17225] Change Speedometer to Performeter + +[#17570] Added synoptic tables for Pre-grow and Hatchery + + + +## [v0.2.0] - 2019-06-07 + +### Added + +**Features** + +[#17166] Release Synoptic table functionality + + + +## [v0.1.0] - 2019-05-07 + +### Added + +**Features** + +first release + diff --git a/changelog.xml b/changelog.xml index cc23cee..db5a64f 100644 --- a/changelog.xml +++ b/changelog.xml @@ -1,21 +1,25 @@ + + [#17249] Added PDF support + - [Task #17252] Enabled DEA Analysis + [#17252] Enabled DEA Analysis - [Task #17247] Add numbers to correlation charts - [Task #17225] Change Speedometer to Performeter - [Task #17570] Added synoptic tables for Pre-grow and Hatchery + [#17247] Add numbers to correlation charts + [#17225] Change Speedometer to Performeter + [#17570] Added synoptic tables for Pre-grow and Hatchery - [Task #17165] - []Task #17166] Release Synoptic table functionality + [#17166] Release Synoptic table functionality org.gcube.portlets.user performfish-analytics-portlet war - 0.7.0-SNAPSHOT + 1.0.0-SNAPSHOT PerformFish Analytics Portlet diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/annualcontrollers/PerformFishAnnualAnalyticsController.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/annualcontrollers/PerformFishAnnualAnalyticsController.java index 0718feb..09e9657 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/annualcontrollers/PerformFishAnnualAnalyticsController.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/annualcontrollers/PerformFishAnnualAnalyticsController.java @@ -30,8 +30,8 @@ import org.gcube.portlets.user.performfishanalytics.client.event.SelectedPopulat import org.gcube.portlets.user.performfishanalytics.client.event.SubmitRequestEvent; import org.gcube.portlets.user.performfishanalytics.client.event.SubmitRequestEventHandler; import org.gcube.portlets.user.performfishanalytics.client.resources.PerformFishResources; -import org.gcube.portlets.user.performfishanalytics.client.viewannualbinder.CorrelationAnnualPanelResult; import org.gcube.portlets.user.performfishanalytics.client.viewannualbinder.BoxPlotAnnualPanelResult; +import org.gcube.portlets.user.performfishanalytics.client.viewannualbinder.CorrelationAnnualPanelResult; import org.gcube.portlets.user.performfishanalytics.client.viewannualbinder.DeaAnnualPanelResult; import org.gcube.portlets.user.performfishanalytics.client.viewannualbinder.ScatterAnnualPanelResult; import org.gcube.portlets.user.performfishanalytics.client.viewannualbinder.SpeedometerAnnualPanelResult; @@ -123,6 +123,8 @@ public class PerformFishAnnualAnalyticsController { callAlgorithmEvent.getInputKPI(), callAlgorithmEvent.getOutputKPI()); } }); + + eventBus.addHandler(SelectedPopulationTypeEvent.TYPE, new SelectedPopulationTypeEventHandler() { @@ -171,116 +173,9 @@ public class PerformFishAnnualAnalyticsController { @Override public void onLoadFocusEvent(LoadFocusEvent loadFocusEvent) { - - final Map> mapParameters = new HashMap>(); - String farmId = decryptParameters.getParameters() - .get(PerformFishAnalyticsConstant.PERFORM_FISH_FARMID_PARAM); - String batchType = decryptParameters.getParameters() - .get(PerformFishAnalyticsConstant.PERFORM_FISH_BATCH_TYPE_PARAM); - - // String batchType = - // viewAnnualController.getForm().getBatchType(); - - // List 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)); - - PerformFishAnalyticsServiceAsync.Util.getInstance().submitRequestToPerformFishService(mapParameters, - new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - // modal.hide(); - Window.alert(caught.getMessage()); - } - - @Override - public void onSuccess(PerformFishResponse performFishResponse) { - 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() { - - @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 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); - } - } - }); - - } - } - }); - + manageLoadFocus(); } + }); // @@ -319,6 +214,113 @@ public class PerformFishAnnualAnalyticsController { } + private void manageLoadFocus() { + final Map> mapParameters = new HashMap>(); + String farmId = decryptParameters.getParameters().get(PerformFishAnalyticsConstant.PERFORM_FISH_FARMID_PARAM); + String batchType = decryptParameters.getParameters() + .get(PerformFishAnalyticsConstant.PERFORM_FISH_BATCH_TYPE_PARAM); + + // String batchType = + // viewAnnualController.getForm().getBatchType(); + + // List 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)); + + PerformFishAnalyticsServiceAsync.Util.getInstance().submitRequestToPerformFishService(mapParameters, + new AsyncCallback() { + + @Override + public void onFailure(Throwable caught) { + // modal.hide(); + Window.alert(caught.getMessage()); + } + + @Override + public void onSuccess(PerformFishResponse performFishResponse) { + 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() { + + @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 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); + } + } + }); + + } + } + }); + } + /** * Call algorithm synoptic table farm. */ @@ -571,7 +573,7 @@ public class PerformFishAnnualAnalyticsController { final Tab tab = viewAnnualController.createTab( tabTitle + " #" + (viewAnnualController.currentNumberOfTab() + 1), tabDescription, submitRequestPanel); - + requestId++; PerformFishAnalyticsServiceAsync.Util.getInstance().callingDataMinerPerformFishAnnualCorrelationAnalysis( dmInputParameters.getPerformFishResponse(), mapParameters, new AsyncCallback() { @@ -581,7 +583,7 @@ public class PerformFishAnnualAnalyticsController { submitRequestPanel.showLoader(false, null); checkTabSpinner(submitRequestPanel, tab); CorrelationAnnualPanelResult analyticsPanelResult = new CorrelationAnnualPanelResult(requestId, - eventBus, tabTitle, tabDescription); + tabTitle, tabDescription); analyticsPanelResult.addSelectedKPIs(inputKPI); analyticsPanelResult.addListBatchIds(Arrays.asList(theFocusValue)); analyticsPanelResult.addParameters(PerformFishAnalyticsConstant.DATA_INPUTS, mapParameters, @@ -597,8 +599,8 @@ public class PerformFishAnnualAnalyticsController { submitRequestPanel.showLoader(false, null); checkTabSpinner(submitRequestPanel, tab); try { - CorrelationAnnualPanelResult analyticsPanelResult = new CorrelationAnnualPanelResult(requestId, - eventBus, tabTitle, tabDescription); + CorrelationAnnualPanelResult analyticsPanelResult = new CorrelationAnnualPanelResult( + requestId, tabTitle, tabDescription); analyticsPanelResult.addSelectedKPIs(inputKPI); analyticsPanelResult.addListBatchIds(Arrays.asList(theFocusValue)); analyticsPanelResult.addParameters(PerformFishAnalyticsConstant.DATA_INPUTS, mapParameters, @@ -654,6 +656,9 @@ public class PerformFishAnnualAnalyticsController { } } + + + /** * Append DM input table. diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/BoxPlotAnnualPanelResult.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/BoxPlotAnnualPanelResult.java index 5a7bb4a..8f47935 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/BoxPlotAnnualPanelResult.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/BoxPlotAnnualPanelResult.java @@ -50,6 +50,8 @@ public class BoxPlotAnnualPanelResult { private int outputNumber = 2; private int requestId = 0; + private Button savePDFButton; + public BoxPlotAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController, PerformFishResponse thePerformFishResponse, final DataMinerAlgorithms algorithm, String focusID, List inputKPI, final List outputKPI) { @@ -70,7 +72,7 @@ public class BoxPlotAnnualPanelResult { HorizontalPanel res = new HorizontalPanel(); - Button savePDFButton = new Button(); + savePDFButton = new Button(); savePDFButton.getElement().getStyle().setMargin(10, Unit.PX); savePDFButton.setIcon(IconType.PRINT); savePDFButton.addClickHandler(new ClickHandler() { @@ -81,6 +83,7 @@ public class BoxPlotAnnualPanelResult { // dmResponse.getListOutput().size() } }); + savePDFButton.setVisible(false); res.add(savePDFButton); submitRequestPanel.addWidget(res); @@ -275,6 +278,7 @@ public class BoxPlotAnnualPanelResult { return; } + savePDFButton.setVisible(true); final String toTitle = title; for (OutputFile outputFile : dmResponse.getListOutput()) { diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/CorrelationAnnualPanelResult.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/CorrelationAnnualPanelResult.java index 574f53f..ed11fd4 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/CorrelationAnnualPanelResult.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/CorrelationAnnualPanelResult.java @@ -10,7 +10,7 @@ import java.util.Map; import org.gcube.portlets.user.performfishanalytics.client.DataMinerAlgorithms; import org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsServiceAsync; -import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsController; +import org.gcube.portlets.user.performfishanalytics.client.annualcontrollers.PerformFishAnnualAnalyticsController; import org.gcube.portlets.user.performfishanalytics.client.event.CallAlgorithmEvent; import org.gcube.portlets.user.performfishanalytics.client.view.util.CorrelationValueToColourUtil; import org.gcube.portlets.user.performfishanalytics.shared.FileContentType; @@ -32,7 +32,6 @@ import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.logical.shared.AttachEvent; -import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -114,8 +113,6 @@ public class CorrelationAnnualPanelResult extends Composite { private List selectedAreas; - // private HandlerManager theEventBus; - private Map csvGenerated = new HashMap(); private CorrelationAnnualPanelResult analyticsPanelResult; @@ -123,7 +120,7 @@ public class CorrelationAnnualPanelResult extends Composite { private int outputNumber; private int requestId = 0; - public CorrelationAnnualPanelResult(int reqId, HandlerManager eventBus, final String tabTitle, + public CorrelationAnnualPanelResult(int reqId, final String tabTitle, final String tabDescription) { GWT.log("RequestID: " + reqId); requestId = reqId; @@ -564,7 +561,7 @@ public class CorrelationAnnualPanelResult extends Composite { GWT.log("Called ScatterChart at rowIndex: " + rowIndex + ", columnIndex: " + columnIndex); List selectedKPI = getKPIForIndexes(rowIndex, columnIndex); GWT.log("Selected KPI: " + selectedKPI); - PerformFishAnalyticsController.eventBus + PerformFishAnnualAnalyticsController.eventBus .fireEvent(new CallAlgorithmEvent(DataMinerAlgorithms.SCATTER, focusID, selectedKPI, null)); } diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/ScatterAnnualPanelResult.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/ScatterAnnualPanelResult.java index 112630c..ae4242d 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/ScatterAnnualPanelResult.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/ScatterAnnualPanelResult.java @@ -46,6 +46,7 @@ public class ScatterAnnualPanelResult { private int requestId; private int outputIteration = 1; private int outputNumber = 1; + private Button savePDFButton; public ScatterAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController, PerformFishResponse thePerformFishResponse, final DataMinerAlgorithms algorithm, String focusID, @@ -67,7 +68,7 @@ public class ScatterAnnualPanelResult { HorizontalPanel res = new HorizontalPanel(); - Button savePDFButton = new Button(); + savePDFButton = new Button(); savePDFButton.getElement().getStyle().setMargin(10, Unit.PX); savePDFButton.setIcon(IconType.PRINT); savePDFButton.addClickHandler(new ClickHandler() { @@ -78,6 +79,7 @@ public class ScatterAnnualPanelResult { // dmResponse.getListOutput().size() } }); + savePDFButton.setVisible(false); res.add(savePDFButton); submitRequestPanel.addWidget(res); @@ -267,6 +269,8 @@ public class ScatterAnnualPanelResult { container.add(alert); return; } + + savePDFButton.setVisible(true); final String toTitle = title; diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/SpeedometerAnnualPanelResult.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/SpeedometerAnnualPanelResult.java index 0553574..575835e 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/SpeedometerAnnualPanelResult.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/SpeedometerAnnualPanelResult.java @@ -50,6 +50,8 @@ public class SpeedometerAnnualPanelResult { private int outputIteration = 0; private int outputNumber = 1; + private Button savePDFButton; + public SpeedometerAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController, PerformFishResponse thePerformFishResponse, final DataMinerAlgorithms algorithm, String focusID, List inputKPI, final List outputKPI) { @@ -70,7 +72,7 @@ public class SpeedometerAnnualPanelResult { HorizontalPanel res = new HorizontalPanel(); - Button savePDFButton = new Button(); + savePDFButton = new Button(); savePDFButton.getElement().getStyle().setMargin(10, Unit.PX); savePDFButton.setIcon(IconType.PRINT); savePDFButton.addClickHandler(new ClickHandler() { @@ -81,7 +83,8 @@ public class SpeedometerAnnualPanelResult { // dmResponse.getListOutput().size() } }); - + savePDFButton.setVisible(false); + res.add(savePDFButton); submitRequestPanel.addWidget(res); int oIteration = 0; @@ -268,6 +271,8 @@ public class SpeedometerAnnualPanelResult { return; } + savePDFButton.setVisible(true); + final String toTitle = title; for (OutputFile outputFile : dmResponse.getListOutput()) { diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/SynopticTableAnnualPanelResult.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/SynopticTableAnnualPanelResult.java index 34540f6..75c1b37 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/SynopticTableAnnualPanelResult.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewannualbinder/SynopticTableAnnualPanelResult.java @@ -47,6 +47,8 @@ public class SynopticTableAnnualPanelResult { private int outputIteration = 1; private int outputNumber = 0; + private Button savePDFButton; + public SynopticTableAnnualPanelResult(int reqId, PerformFishAnnualAnalyticsViewController viewAnnualController, PerformFishResponse performFishResponse) { GWT.log("RequestID: " + reqId); @@ -63,7 +65,7 @@ public class SynopticTableAnnualPanelResult { // TODO HorizontalPanel res = new HorizontalPanel(); - Button savePDFButton = new Button(); + savePDFButton = new Button(); savePDFButton.getElement().getStyle().setMargin(10, Unit.PX); savePDFButton.setIcon(IconType.PRINT); savePDFButton.addClickHandler(new ClickHandler() { @@ -74,7 +76,8 @@ public class SynopticTableAnnualPanelResult { // dmResponse.getListOutput().size() } }); - + savePDFButton.setVisible(false); + res.add(savePDFButton); submitRequestPanel.addWidget(res); @@ -209,10 +212,13 @@ public class SynopticTableAnnualPanelResult { container.add(alert); return; } + + savePDFButton.setVisible(true); final String toTitle = title; outputNumber = 1; + for (OutputFile outputFile : dmResponse.getListOutput()) { final FileContentType fileContentType = outputFile.getDataType(); diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/BoxPlotPanelResult.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/BoxPlotPanelResult.java index 0665977..cd89ab5 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/BoxPlotPanelResult.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/BoxPlotPanelResult.java @@ -47,6 +47,8 @@ public class BoxPlotPanelResult { private int outputNumber = 3; private int requestId = 0; + private Button savePDFButton; + public BoxPlotPanelResult(int reqId, PerformFishAnalyticsViewController viewController, final DataMinerAlgorithms algorithm, String focusID, List inputKPI, final List outputKPI) { GWT.log("RequestID: " + reqId); @@ -66,7 +68,7 @@ public class BoxPlotPanelResult { HorizontalPanel res = new HorizontalPanel(); - Button savePDFButton = new Button(); + savePDFButton = new Button(); savePDFButton.getElement().getStyle().setMargin(10, Unit.PX); savePDFButton.setIcon(IconType.PRINT); savePDFButton.addClickHandler(new ClickHandler() { @@ -77,6 +79,7 @@ public class BoxPlotPanelResult { // dmResponse.getListOutput().size() } }); + savePDFButton.setVisible(false); res.add(savePDFButton); submitRequestPanel.addWidget(res); @@ -227,7 +230,8 @@ public class BoxPlotPanelResult { container.add(alert); return; } - + + savePDFButton.setVisible(true); final String toTitle = title; for (OutputFile outputFile : dmResponse.getListOutput()) { diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/ScatterPanelResult.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/ScatterPanelResult.java index 6865f4e..dbb4546 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/ScatterPanelResult.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/ScatterPanelResult.java @@ -43,6 +43,7 @@ public class ScatterPanelResult { private int requestId = 0; private int outputIteration = 1; private int outputNumber = 1; + private Button savePDFButton; public ScatterPanelResult(int reqId, PerformFishAnalyticsViewController viewController, final DataMinerAlgorithms algorithm, String focusID, List inputKPI, final List outputKPI) { @@ -63,7 +64,7 @@ public class ScatterPanelResult { HorizontalPanel res = new HorizontalPanel(); - Button savePDFButton = new Button(); + savePDFButton = new Button(); savePDFButton.getElement().getStyle().setMargin(10, Unit.PX); savePDFButton.setIcon(IconType.PRINT); savePDFButton.addClickHandler(new ClickHandler() { @@ -74,6 +75,7 @@ public class ScatterPanelResult { // dmResponse.getListOutput().size() } }); + savePDFButton.setVisible(false); res.add(savePDFButton); submitRequestPanel.addWidget(res); @@ -217,7 +219,8 @@ public class ScatterPanelResult { container.add(alert); return; } - + + savePDFButton.setVisible(true); final String toTitle = title; for (OutputFile outputFile : dmResponse.getListOutput()) { diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/SpeedometerPanelResult.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/SpeedometerPanelResult.java index 1b3d8e4..7e500f9 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/SpeedometerPanelResult.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/SpeedometerPanelResult.java @@ -43,6 +43,7 @@ public class SpeedometerPanelResult { private int requestId; private int outputIteration = 0; private int outputNumber = 1; + private Button savePDFButton; public SpeedometerPanelResult(int reqId, PerformFishAnalyticsViewController viewController, final DataMinerAlgorithms algorithm, String focusID, List inputKPI, final List outputKPI) { @@ -63,7 +64,7 @@ public class SpeedometerPanelResult { HorizontalPanel res = new HorizontalPanel(); - Button savePDFButton = new Button(); + savePDFButton = new Button(); savePDFButton.getElement().getStyle().setMargin(10, Unit.PX); savePDFButton.setIcon(IconType.PRINT); savePDFButton.addClickHandler(new ClickHandler() { @@ -73,7 +74,8 @@ public class SpeedometerPanelResult { saveFilePDF(algorithm.getId(), tabTitle, tabTitle, tabDescr, requestId, outputIteration, outputNumber); } }); - + savePDFButton.setVisible(false); + res.add(savePDFButton); submitRequestPanel.addWidget(res); int oIteration = 0; @@ -214,7 +216,9 @@ public class SpeedometerPanelResult { container.add(alert); return; } - + + savePDFButton.setVisible(true); + final String toTitle = title; for (OutputFile outputFile : dmResponse.getListOutput()) { diff --git a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/SynopticTablePanelResult.java b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/SynopticTablePanelResult.java index 6b8c4b8..45a6ace 100644 --- a/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/SynopticTablePanelResult.java +++ b/src/main/java/org/gcube/portlets/user/performfishanalytics/client/viewbinder/SynopticTablePanelResult.java @@ -44,6 +44,8 @@ public class SynopticTablePanelResult { private int outputIteration = 1; private int outputNumber = 0; + private Button savePDFButton; + public SynopticTablePanelResult(int reqId, PerformFishAnalyticsViewController viewController, PerformFishResponse performFishResponse, final Map> performFishRequestParameters) { GWT.log("RequestID: " + reqId); @@ -105,7 +107,7 @@ public class SynopticTablePanelResult { PerformFishResources.INSTANCE.synopticTable().getText(), submitRequestPanel); HorizontalPanel res = new HorizontalPanel(); - Button savePDFButton = new Button(); + savePDFButton = new Button(); savePDFButton.getElement().getStyle().setMargin(10, Unit.PX); savePDFButton.setIcon(IconType.PRINT); savePDFButton.addClickHandler(new ClickHandler() { @@ -116,6 +118,7 @@ public class SynopticTablePanelResult { // dmResponse.getListOutput().size() } }); + savePDFButton.setVisible(false); res.add(savePDFButton); submitRequestPanel.addWidget(res); @@ -204,7 +207,10 @@ public class SynopticTablePanelResult { return; } + savePDFButton.setVisible(false); + final String toTitle = title; + outputNumber = 1; for (OutputFile outputFile : dmResponse.getListOutput()) {