Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-import-widget@99163 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d54e699ba4
commit
ad4e6cde22
|
@ -3,12 +3,15 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.td.sdmximportwidget.client;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
|
@ -18,6 +21,7 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
|||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.DateField;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||
import com.sencha.gxt.widget.core.client.form.TextArea;
|
||||
|
@ -30,7 +34,8 @@ 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";
|
||||
|
@ -47,6 +52,8 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
protected TextArea description;
|
||||
protected TextArea rights;
|
||||
protected TextField agencyName;
|
||||
protected DateField validFrom;
|
||||
protected DateField validUntilTo;
|
||||
|
||||
protected TextButton checkButton;
|
||||
|
||||
|
@ -105,18 +112,25 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
agencyNameLabel.setLabelSeparator("");
|
||||
p.add(agencyNameLabel, new VerticalLayoutData(1, -1));
|
||||
|
||||
validFrom = new DateField();
|
||||
validFrom.setValue(new Date());
|
||||
p.add(new FieldLabel(validFrom, "Valid From"), new VerticalLayoutData(
|
||||
1, -1));
|
||||
|
||||
validUntilTo = new DateField();
|
||||
p.add(new FieldLabel(validUntilTo, "Valid Until To"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
tableDetailPanel.add(form);
|
||||
|
||||
setContent(tableDetailPanel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
|
||||
public void execute() {
|
||||
checkData();
|
||||
}
|
||||
|
@ -156,21 +170,44 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
};
|
||||
|
||||
if (name.getValue() == null || name.getValue().isEmpty()
|
||||
|| !name.isValid() || description.getValue() == null
|
||||
|| description.getValue().isEmpty() || !description.isValid()
|
||||
|| rights.getValue() == null || rights.getValue().isEmpty()
|
||||
|| !rights.isValid() || agencyName.getValue() == null
|
||||
|| agencyName.getValue().isEmpty() || !agencyName.isValid()) {
|
||||
|
||||
d = new AlertMessageBox("Attention!", "Fill in all fields");
|
||||
|| !name.isValid()) {
|
||||
d = new AlertMessageBox("Attention!", "Fill in name field");
|
||||
d.addHideHandler(hideHandler);
|
||||
d.show();
|
||||
} else {
|
||||
name.setReadOnly(true);
|
||||
description.setReadOnly(true);
|
||||
rights.setReadOnly(true);
|
||||
agencyName.setReadOnly(true);
|
||||
goNext();
|
||||
if (description.getValue() == null
|
||||
|| description.getValue().isEmpty()
|
||||
|| !description.isValid()) {
|
||||
d = new AlertMessageBox("Attention!",
|
||||
"Fill in description field");
|
||||
d.addHideHandler(hideHandler);
|
||||
d.show();
|
||||
} else {
|
||||
if (rights.getValue() == null || rights.getValue().isEmpty()
|
||||
|| !rights.isValid()) {
|
||||
d = new AlertMessageBox("Attention!",
|
||||
"Fill in rights field");
|
||||
d.addHideHandler(hideHandler);
|
||||
d.show();
|
||||
} else {
|
||||
if (agencyName.getValue() == null
|
||||
|| agencyName.getValue().isEmpty()
|
||||
|| !agencyName.isValid()) {
|
||||
|
||||
d = new AlertMessageBox("Attention!",
|
||||
"Fill in agency name field");
|
||||
d.addHideHandler(hideHandler);
|
||||
d.show();
|
||||
|
||||
} else {
|
||||
name.setReadOnly(true);
|
||||
description.setReadOnly(true);
|
||||
rights.setReadOnly(true);
|
||||
agencyName.setReadOnly(true);
|
||||
goNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -181,7 +218,31 @@ public class SDMXTableDetailCard extends WizardCard {
|
|||
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());
|
||||
}
|
||||
}
|
||||
|
||||
importSession.setTabResource(detail);
|
||||
SDMXOperationInProgressCard sdmxOperationInProgressCard = new SDMXOperationInProgressCard(
|
||||
importSession);
|
||||
|
|
Loading…
Reference in New Issue