From 8d67a3315d536a1049d424840cb7ac6137a28535 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 12 Jan 2018 16:00:04 +0000 Subject: [PATCH] ref #9944: TabMan - Enable Excel export operation for DataSet only https://support.d4science.org/issues/#9944 Added operation git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-excel-export-widget@162128 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 2 +- .../client/ExcelOperationInProgressCard.java | 12 ++++----- .../client/ExcelTableDetailCard.java | 25 ++++++++++++++----- .../client/MeasureColumnSelectionCard.java | 3 ++- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/distro/changelog.xml b/distro/changelog.xml index 03ac0cc..9218ff7 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,5 +1,5 @@ - + First Release \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/ExcelOperationInProgressCard.java b/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/ExcelOperationInProgressCard.java index 9cf3feb..3353d32 100644 --- a/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/ExcelOperationInProgressCard.java +++ b/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/ExcelOperationInProgressCard.java @@ -60,7 +60,7 @@ public class ExcelOperationInProgressCard extends WizardCard implements // display:block;vertical-align:text-top; description.setHTML(0, 0, "Destination: "); - description.setText(0, 1, exportSession.getSource().getName()); + description.setText(0, 1, "EXCEL"); description.setHTML(1, 0, "Id: "); @@ -93,7 +93,7 @@ public class ExcelOperationInProgressCard extends WizardCard implements // columnToImportMask - public void exportSDMX() { + public void exportExcel() { TDGWTServiceAsync.INSTANCE.startExcelExport(exportSession, new AsyncCallback() { @@ -115,8 +115,8 @@ public class ExcelOperationInProgressCard extends WizardCard implements caught.getLocalizedMessage(), "", caught); } else { - showErrorAndHide("Error in exportSDMX", - "An error occured in exportSDMX.", + showErrorAndHide("Error in exportEXCEL", + "An error occured in exportEXCEL.", caught.getLocalizedMessage(), caught); } } @@ -130,7 +130,7 @@ public class ExcelOperationInProgressCard extends WizardCard implements setBackButtonVisible(false); getWizardWindow().setEnableNextButton(false); getWizardWindow().setNextButtonToFinish(); - exportSDMX(); + exportExcel(); } // @@ -183,7 +183,7 @@ public class ExcelOperationInProgressCard extends WizardCard implements new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - showErrorAndHide("Error in SDMX Export", reason, details, caught); + showErrorAndHide("Error in EXCEL Export", reason, details, caught); } forceLayout(); } diff --git a/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/ExcelTableDetailCard.java b/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/ExcelTableDetailCard.java index d6da38b..bc6eeb4 100644 --- a/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/ExcelTableDetailCard.java +++ b/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/ExcelTableDetailCard.java @@ -35,7 +35,7 @@ public class ExcelTableDetailCard extends WizardCard { private ExcelExportSession exportSession; private ExcelTableDetailCard thisCard; - private VerticalLayoutContainer p = new VerticalLayoutContainer(); + private VerticalLayoutContainer p; private VerticalPanel tableDetailPanel; private TextField id; @@ -63,7 +63,8 @@ public class ExcelTableDetailCard extends WizardCard { fieldSet.setHeadingText("Information"); fieldSet.setCollapsible(false); form.add(fieldSet); - + + p = new VerticalLayoutContainer(); switch (exportSession.getExportType()) { case DATASET: datasetViewConfig(); @@ -91,6 +92,7 @@ public class ExcelTableDetailCard extends WizardCard { agencyId = new TextField(); agencyId.setVisible(true); + agencyId.setAllowBlank(false); agencyId.setEmptyText("Enter Agency Id..."); if (exportSession.getAgencyId() == null || exportSession.getAgencyId().isEmpty()) { agencyId.setValue(Constants.EXCEL_DATASET_EXPORT_DEFAULT_AGENCY_ID); @@ -101,7 +103,6 @@ public class ExcelTableDetailCard extends WizardCard { FieldLabel agencyNameLabel = new FieldLabel(agencyId, "Agency Id"); p.add(agencyNameLabel, new VerticalLayoutData(1, -1)); - version = new TextField(); version.setAllowBlank(false); version.setEmptyText("Enter Version..."); @@ -113,7 +114,6 @@ public class ExcelTableDetailCard extends WizardCard { measureColumn.setReadOnly(true); p.add(new FieldLabel(measureColumn, "Measure Column"), new VerticalLayoutData(1, -1)); - } @Override @@ -121,7 +121,11 @@ public class ExcelTableDetailCard extends WizardCard { Command sayNextCard = new Command() { public void execute() { - checkData(); + try { + checkData(); + } catch (Exception e) { + Log.error("Error in checkData :" + e.getLocalizedMessage(),e); + } } }; @@ -141,6 +145,10 @@ public class ExcelTableDetailCard extends WizardCard { }; getWizardWindow().setPreviousButtonCommand(sayPreviousCard); + + setBackButtonVisible(true); + setEnableBackButton(true); + getWizardWindow().setEnableNextButton(true); } @@ -182,10 +190,15 @@ public class ExcelTableDetailCard extends WizardCard { protected void goNext() { try { + Log.info("Data:"); + Log.info("Id: "+id.getCurrentValue()); + Log.info("AgencyId: "+agencyId.getCurrentValue()); + Log.info("Version: "+version.getCurrentValue()); + exportSession.setId(id.getCurrentValue()); exportSession.setAgencyId(agencyId.getCurrentValue()); exportSession.setVersion(version.getCurrentValue()); - + ExcelOperationInProgressCard excelOperationInProgressCard = new ExcelOperationInProgressCard(exportSession); getWizardWindow().addCard(excelOperationInProgressCard); Log.info("NextCard ExcelOperationInProgressCard"); diff --git a/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/MeasureColumnSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/MeasureColumnSelectionCard.java index 58ede75..c4edb3c 100644 --- a/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/MeasureColumnSelectionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/excelexportwidget/client/MeasureColumnSelectionCard.java @@ -47,7 +47,7 @@ public class MeasureColumnSelectionCard extends WizardCard { box.show(); retrieveTabularDataInfo(box); - + } @@ -70,6 +70,7 @@ public class MeasureColumnSelectionCard extends WizardCard { }); setContent(measureColumnSelectionPanel); + forceLayout(); }