Giancarlo Panichi 9 years ago committed by Giancarlo Panichi
parent a0242c2971
commit 5b5b56a612

@ -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<ListLoadConfig, ListLoadResult<LicenceData>> loader;
protected ComboBox<LicenceData> 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<ListLoadConfig, LicenceData, ListLoadResult<LicenceData>>(
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<ListLoadResult<LicenceData>> 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);

Loading…
Cancel
Save