From 5b5b56a612914a7fe51a5eff98d504f48ac0266d Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 29 Jun 2015 12:36:51 +0000 Subject: [PATCH] Fixed TimeZone git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-import-widget@115610 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/SDMXTableDetailCard.java | 72 ++++++++----------- 1 file changed, 28 insertions(+), 44 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/sdmximportwidget/client/SDMXTableDetailCard.java b/src/main/java/org/gcube/portlets/user/td/sdmximportwidget/client/SDMXTableDetailCard.java index 2282c7b..b1fca83 100644 --- a/src/main/java/org/gcube/portlets/user/td/sdmximportwidget/client/SDMXTableDetailCard.java +++ b/src/main/java/org/gcube/portlets/user/td/sdmximportwidget/client/SDMXTableDetailCard.java @@ -56,7 +56,7 @@ import com.sencha.gxt.widget.core.client.form.TextField; */ public class SDMXTableDetailCard extends WizardCard { protected DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd"); - + protected final String TABLEDETAILPANELWIDTH = "100%"; protected final String TABLEDETAILPANELHEIGHT = "100%"; protected final String FORMWIDTH = "538px"; @@ -77,11 +77,10 @@ public class SDMXTableDetailCard extends WizardCard { protected DateField validUntilTo; protected TextButton checkButton; - + protected ListLoader> loader; protected ComboBox comboLicences; - TabResource detail; public SDMXTableDetailCard(final SDMXImportSession importSession) { @@ -143,7 +142,7 @@ public class SDMXTableDetailCard extends WizardCard { validUntilTo = new DateField(); p.add(new FieldLabel(validUntilTo, "Valid Until To"), new VerticalLayoutData(1, -1)); - + // Combo Licences LicenceDataPropertiesCombo propsLicenceData = GWT .create(LicenceDataPropertiesCombo.class); @@ -168,7 +167,7 @@ public class SDMXTableDetailCard extends WizardCard { } }; - + loader.addLoadHandler(new LoadResultListStoreBinding>( storeCombo)); Log.trace("LoaderCombo created"); @@ -191,15 +190,15 @@ public class SDMXTableDetailCard 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); setContent(tableDetailPanel); } - + protected void loadData(ListLoadConfig loadConfig, final AsyncCallback> callback) { TDGWTServiceAsync.INSTANCE @@ -230,7 +229,7 @@ public class SDMXTableDetailCard extends WizardCard { }); } - + @Override public void setup() { Command sayNextCard = new Command() { @@ -320,39 +319,22 @@ public class SDMXTableDetailCard extends WizardCard { protected void goNext() { try { - detail= new TabResource(); + detail = new TabResource(); detail.setName(name.getCurrentValue()); detail.setAgency(agencyName.getCurrentValue()); detail.setDescription(description.getCurrentValue()); detail.setRight(rights.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"); + detail.setValidFrom(validFrom.getCurrentValue()); + detail.setValidUntilTo(validUntilTo.getCurrentValue()); + + 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) { @@ -363,13 +345,15 @@ public class SDMXTableDetailCard extends WizardCard { }); d.show(); } - - - 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); SDMXOperationInProgressCard sdmxOperationInProgressCard = new SDMXOperationInProgressCard( importSession);