diff --git a/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/CSVTableDetailCard.java b/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/CSVTableDetailCard.java index 973d8c5..56e2d15 100644 --- a/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/CSVTableDetailCard.java +++ b/src/main/java/org/gcube/portlets/user/td/csvimportwidget/client/CSVTableDetailCard.java @@ -96,7 +96,7 @@ public class CSVTableDetailCard extends WizardCard { FieldSet fieldSet = new FieldSet(); fieldSet.setHeadingText("Information"); fieldSet.setCollapsible(false); - + form.add(fieldSet); p = new VerticalLayoutContainer(); @@ -153,7 +153,7 @@ public class CSVTableDetailCard extends WizardCard { } }; - + loader.addLoadHandler(new LoadResultListStoreBinding>( storeCombo)); Log.trace("LoaderCombo created"); @@ -176,11 +176,9 @@ public class CSVTableDetailCard extends WizardCard { Log.trace("Combo Licence created"); // / - p.add(new FieldLabel(comboLicences, "Licence"), - new VerticalLayoutData(1, -1)); + p.add(new FieldLabel(comboLicences, "Licence"), new VerticalLayoutData( + 1, -1)); - - tableDetailPanel.add(form); setCenterWidget(tableDetailPanel, new MarginData(0)); @@ -202,7 +200,8 @@ public class CSVTableDetailCard extends WizardCard { Log.error("load combo failure:" + caught.getLocalizedMessage()); showErrorAndHide("Error", - "Error retrieving licences.",caught.getLocalizedMessage(),caught); + "Error retrieving licences.", + caught.getLocalizedMessage(), caught); } callback.onFailure(caught); } @@ -292,38 +291,20 @@ public class CSVTableDetailCard extends WizardCard { protected void goNext() { try { - detail= new TabResource(); + detail = new TabResource(); detail.setName(name.getCurrentValue()); detail.setDescription(description.getCurrentValue()); detail.setRight(rights.getCurrentValue()); + detail.setValidFrom(validFrom.getCurrentValue()); + detail.setValidUntilTo(validUntilTo.getCurrentValue()); - Date vFrom = validFrom.getCurrentValue(); - if (vFrom == null) { - Log.debug("Valid From is null"); - } else { - try { - detail.setValidFrom(sdf.format(vFrom)); - } catch (Throwable e) { - Log.error("Error parsing Valid From " - + e.getLocalizedMessage()); - } - } - - Date vUntilTo = validUntilTo.getCurrentValue(); - if (vUntilTo == null) { - Log.debug("Valid Until To is null"); - } else { - try { - detail.setValidUntilTo(sdf.format(vUntilTo)); - } catch (Throwable e) { - Log.error("Error parsing Valid Until To " - + e.getLocalizedMessage()); - } - } - - if(vFrom!=null && vUntilTo!=null && vFrom.compareTo(vUntilTo)>0){ - Log.debug("Attention Valid From field is higher than Valid Until To field"); - AlertMessageBox d = new AlertMessageBox("Attention!", "Valid From field is higher than Valid Until To field"); + if (validFrom.getCurrentValue() != null + && validUntilTo.getCurrentValue() != null + && validFrom.getCurrentValue().compareTo( + validUntilTo.getCurrentValue()) > 0) { + Log.debug("Attention Valid From field is higher than Valid Until To field"); + AlertMessageBox d = new AlertMessageBox("Attention!", + "Valid From field is higher than Valid Until To field"); d.addHideHandler(new HideHandler() { public void onHide(HideEvent event) { @@ -335,12 +316,15 @@ public class CSVTableDetailCard extends WizardCard { d.show(); return; } - - if(comboLicences.getCurrentValue()!=null&& - comboLicences.getCurrentValue().getLicenceId()!=null && !comboLicences.getCurrentValue().getLicenceId().isEmpty()){ - detail.setLicence(comboLicences.getCurrentValue().getLicenceId()); + + if (comboLicences.getCurrentValue() != null + && comboLicences.getCurrentValue().getLicenceId() != null + && !comboLicences.getCurrentValue().getLicenceId() + .isEmpty()) { + detail.setLicence(comboLicences.getCurrentValue() + .getLicenceId()); } - + importSession.setTabResource(detail); CSVOperationInProgressCard csvOperationInProgressCard = new CSVOperationInProgressCard(