From 6737f749e308e716d82a6d5074740f834d30d45a Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 4 Jun 2014 15:26:37 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-codelistmapping-import-widget@96663 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../CodelistMappingTableDetailCard.java | 40 +++++-------- .../CodelistMappingUrlSelectionCard.java | 56 ++++++------------- 2 files changed, 31 insertions(+), 65 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingTableDetailCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingTableDetailCard.java index e922a60..9246f03 100644 --- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingTableDetailCard.java +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingTableDetailCard.java @@ -9,7 +9,6 @@ import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.ui.VerticalPanel; import com.sencha.gxt.widget.core.client.FramedPanel; import com.sencha.gxt.widget.core.client.box.AlertMessageBox; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; @@ -17,7 +16,6 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti 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.FieldLabel; -import com.sencha.gxt.widget.core.client.form.FieldSet; import com.sencha.gxt.widget.core.client.form.TextArea; import com.sencha.gxt.widget.core.client.form.TextField; @@ -29,15 +27,11 @@ import com.sencha.gxt.widget.core.client.form.TextField; */ public class CodelistMappingTableDetailCard extends WizardCard { - protected final String TABLEDETAILPANELWIDTH = "100%"; - protected final String TABLEDETAILPANELHEIGHT = "100%"; - protected final String FORMWIDTH = "538px"; - protected CodelistMappingSession codelistMappingSession; protected CodelistMappingTableDetailCard thisCard; protected VerticalLayoutContainer p; - protected VerticalPanel tableDetailPanel; + protected TextField name; protected TextArea description; @@ -51,43 +45,35 @@ public class CodelistMappingTableDetailCard extends WizardCard { this.codelistMappingSession = codelistMappingSession; thisCard = this; - - tableDetailPanel = new VerticalPanel(); - - tableDetailPanel.setSpacing(4); - tableDetailPanel.setWidth(TABLEDETAILPANELWIDTH); - tableDetailPanel.setHeight(TABLEDETAILPANELHEIGHT); - FramedPanel form = new FramedPanel(); + form.setHeadingText("Details"); - form.setWidth(FORMWIDTH); - - FieldSet fieldSet = new FieldSet(); - fieldSet.setHeadingText("Information"); - fieldSet.setCollapsible(false); - form.add(fieldSet); - + + p = new VerticalLayoutContainer(); - fieldSet.add(p); + form.add(p); name = new TextField(); name.setAllowBlank(false); name.setEmptyText("Enter a name..."); - name.setValue(codelistMappingSession.getLocalFileName()); + if(codelistMappingSession.getLocalFileName()!=null&& + !codelistMappingSession.getLocalFileName().isEmpty()){ + name.setValue(codelistMappingSession.getLocalFileName()); + } else { + + } 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.setValue("XML map"); description.setAllowBlank(false); p.add(new FieldLabel(description, "Description"), new VerticalLayoutData(1, -1)); - tableDetailPanel.add(form); - - setContent(tableDetailPanel); + setContent(form); } diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUrlSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUrlSelectionCard.java index a87b1eb..005b28b 100644 --- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUrlSelectionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUrlSelectionCard.java @@ -4,7 +4,6 @@ package org.gcube.portlets.user.td.codelistmappingimportwidget.client; import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; -import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTD; import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; import com.allen_sauer.gwt.log.client.Log; @@ -16,8 +15,6 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti 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.FieldLabel; -import com.sencha.gxt.widget.core.client.form.FieldSet; -import com.sencha.gxt.widget.core.client.form.TextArea; import com.sencha.gxt.widget.core.client.form.TextField; /** @@ -27,13 +24,12 @@ import com.sencha.gxt.widget.core.client.form.TextField; * */ public class CodelistMappingUrlSelectionCard extends WizardCard { - protected final String FORMWIDTH = "538px"; + protected CodelistMappingSession codelistMappingSession; protected CodelistMappingUrlSelectionCard thisCard; - protected TextField name; - protected TextArea description; + protected TextField urlField; public CodelistMappingUrlSelectionCard( final CodelistMappingSession codelistMappingSession) { @@ -42,31 +38,19 @@ public class CodelistMappingUrlSelectionCard extends WizardCard { this.codelistMappingSession = codelistMappingSession; FramedPanel form = new FramedPanel(); - form.setHeadingText("Url Selection"); - form.setWidth(FORMWIDTH); - - FieldSet fieldSet = new FieldSet(); - fieldSet.setHeadingText(""); - fieldSet.setCollapsible(false); - form.add(fieldSet); - + form.setHeaderVisible(false); + form.setBodyBorder(false); + VerticalLayoutContainer v = new VerticalLayoutContainer(); - fieldSet.add(v); + form.add(v); - name = new TextField(); - name.setAllowBlank(false); - name.setEmptyText("Enter a name..."); - name.setValue(codelistMappingSession.getLocalFileName()); - name.setAllowBlank(false); - v.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1)); + urlField = new TextField(); + urlField.setAllowBlank(false); + urlField.setEmptyText("Insert a valid url..."); + urlField.setValue(codelistMappingSession.getUrl()); + urlField.setAllowBlank(false); + v.add(new FieldLabel(urlField, "Url"), new VerticalLayoutData(1, -1)); - description = new TextArea(); - description.setAllowBlank(false); - description.setEmptyText("Enter a description..."); - description.setValue("XML codelist mapping"); - description.setAllowBlank(false); - v.add(new FieldLabel(description, "Description"), - new VerticalLayoutData(1, -1)); setContent(form); @@ -85,25 +69,21 @@ public class CodelistMappingUrlSelectionCard extends WizardCard { } }; - if (name.getValue() == null || name.getValue().isEmpty() - || !name.isValid() || description.getValue() == null - || description.getValue().isEmpty() || !description.isValid()) { + if (urlField.getValue() == null || urlField.getValue().isEmpty() + || !urlField.isValid()) { d = new AlertMessageBox("Attention!", "Fill in all fields"); d.addHideHandler(hideHandler); d.show(); } else { - name.setReadOnly(true); - description.setReadOnly(true); + urlField.setReadOnly(true); goNext(); } } protected void goNext() { try { - ResourceTD resourceTD=new ResourceTD(); - resourceTD.setName(name.getCurrentValue()); - resourceTD.setDescription(description.getCurrentValue()); - codelistMappingSession.setResourceTD(resourceTD); + String url=urlField.getCurrentValue(); + codelistMappingSession.setUrl(url); CodelistMappingTableDetailCard detailsCard = new CodelistMappingTableDetailCard( codelistMappingSession); @@ -140,7 +120,7 @@ public class CodelistMappingUrlSelectionCard extends WizardCard { }; getWizardWindow().setPreviousButtonCommand(sayPreviousCard); - getWizardWindow().setEnableNextButton(false); + getWizardWindow().setEnableNextButton(true); } }