Fixed TimeZone

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-import-widget@115603 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-06-29 12:35:33 +00:00
parent c3aa19ed66
commit a5edf9072b
1 changed files with 24 additions and 40 deletions

View File

@ -176,10 +176,8 @@ 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);
@ -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){
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");
AlertMessageBox d = new AlertMessageBox("Attention!",
"Valid From field is higher than Valid Until To field");
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
@ -336,9 +317,12 @@ public class CSVTableDetailCard extends WizardCard {
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);