Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-import-widget@99152 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-07-31 11:04:31 +00:00
parent 7b834afd78
commit 9cdd6e67e0
1 changed files with 21 additions and 4 deletions

View File

@ -3,11 +3,14 @@
*/
package org.gcube.portlets.user.td.csvimportwidget.client;
import java.util.Date;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
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.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;
@ -16,6 +19,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;
@ -28,7 +32,8 @@ import com.sencha.gxt.widget.core.client.form.TextField;
*
*/
public class CSVTableDetailCard extends WizardCard {
private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
protected final String TABLEDETAILPANELWIDTH = "100%";
protected final String TABLEDETAILPANELHEIGHT = "100%";
protected final String FORMWIDTH = "538px";
@ -42,6 +47,8 @@ public class CSVTableDetailCard extends WizardCard {
protected TextField name;
protected TextArea description;
protected TextArea rights;
protected DateField validFrom;
protected DateField validUntilTo;
protected TabResource detail = new TabResource();
@ -73,14 +80,12 @@ public class CSVTableDetailCard extends WizardCard {
name.setAllowBlank(false);
name.setEmptyText("Enter a name...");
name.setValue(importSession.getLocalFileName());
name.setAllowBlank(false);
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
description = new TextArea();
description.setAllowBlank(false);
description.setEmptyText("Enter a description...");
description.setValue("File CSV");
description.setAllowBlank(false);
p.add(new FieldLabel(description, "Description"),
new VerticalLayoutData(1, -1));
@ -89,6 +94,13 @@ public class CSVTableDetailCard extends WizardCard {
rights.setAllowBlank(false);
p.add(new FieldLabel(rights, "Rights"), 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);
@ -162,7 +174,11 @@ public class CSVTableDetailCard extends WizardCard {
detail.setName(name.getCurrentValue());
detail.setDescription(description.getCurrentValue());
detail.setRight(rights.getCurrentValue());
Date vFrom=validFrom.getCurrentValue();
detail.setValidFrom(sdf.format(vFrom));
Date vUntilTo=validUntilTo.getCurrentValue();
detail.setValidUntilTo(sdf.format(vUntilTo));
importSession.setTabResource(detail);
CSVOperationInProgressCard csvOperationInProgressCard = new CSVOperationInProgressCard(
@ -172,6 +188,7 @@ public class CSVTableDetailCard extends WizardCard {
getWizardWindow().nextCard();
} catch (Exception e) {
Log.error("sayNextCard :" + e.getLocalizedMessage());
e.printStackTrace();
}
}