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
This commit is contained in:
parent
2f3cc1f239
commit
6737f749e3
|
@ -9,7 +9,6 @@ import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.user.client.Command;
|
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.FramedPanel;
|
||||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
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;
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
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.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.TextArea;
|
||||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
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 {
|
public class CodelistMappingTableDetailCard extends WizardCard {
|
||||||
|
|
||||||
protected final String TABLEDETAILPANELWIDTH = "100%";
|
|
||||||
protected final String TABLEDETAILPANELHEIGHT = "100%";
|
|
||||||
protected final String FORMWIDTH = "538px";
|
|
||||||
|
|
||||||
protected CodelistMappingSession codelistMappingSession;
|
protected CodelistMappingSession codelistMappingSession;
|
||||||
protected CodelistMappingTableDetailCard thisCard;
|
protected CodelistMappingTableDetailCard thisCard;
|
||||||
|
|
||||||
protected VerticalLayoutContainer p;
|
protected VerticalLayoutContainer p;
|
||||||
protected VerticalPanel tableDetailPanel;
|
|
||||||
|
|
||||||
protected TextField name;
|
protected TextField name;
|
||||||
protected TextArea description;
|
protected TextArea description;
|
||||||
|
@ -51,43 +45,35 @@ public class CodelistMappingTableDetailCard extends WizardCard {
|
||||||
|
|
||||||
this.codelistMappingSession = codelistMappingSession;
|
this.codelistMappingSession = codelistMappingSession;
|
||||||
thisCard = this;
|
thisCard = this;
|
||||||
|
|
||||||
tableDetailPanel = new VerticalPanel();
|
|
||||||
|
|
||||||
tableDetailPanel.setSpacing(4);
|
|
||||||
tableDetailPanel.setWidth(TABLEDETAILPANELWIDTH);
|
|
||||||
tableDetailPanel.setHeight(TABLEDETAILPANELHEIGHT);
|
|
||||||
|
|
||||||
FramedPanel form = new FramedPanel();
|
FramedPanel form = new FramedPanel();
|
||||||
|
|
||||||
form.setHeadingText("Details");
|
form.setHeadingText("Details");
|
||||||
form.setWidth(FORMWIDTH);
|
|
||||||
|
|
||||||
FieldSet fieldSet = new FieldSet();
|
|
||||||
fieldSet.setHeadingText("Information");
|
|
||||||
fieldSet.setCollapsible(false);
|
|
||||||
form.add(fieldSet);
|
|
||||||
|
|
||||||
p = new VerticalLayoutContainer();
|
p = new VerticalLayoutContainer();
|
||||||
fieldSet.add(p);
|
form.add(p);
|
||||||
|
|
||||||
name = new TextField();
|
name = new TextField();
|
||||||
name.setAllowBlank(false);
|
name.setAllowBlank(false);
|
||||||
name.setEmptyText("Enter a name...");
|
name.setEmptyText("Enter a name...");
|
||||||
name.setValue(codelistMappingSession.getLocalFileName());
|
if(codelistMappingSession.getLocalFileName()!=null&&
|
||||||
|
!codelistMappingSession.getLocalFileName().isEmpty()){
|
||||||
|
name.setValue(codelistMappingSession.getLocalFileName());
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
name.setAllowBlank(false);
|
name.setAllowBlank(false);
|
||||||
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
description = new TextArea();
|
description = new TextArea();
|
||||||
description.setAllowBlank(false);
|
description.setAllowBlank(false);
|
||||||
description.setEmptyText("Enter a description...");
|
description.setEmptyText("Enter a description...");
|
||||||
description.setValue("File CSV");
|
description.setValue("XML map");
|
||||||
description.setAllowBlank(false);
|
description.setAllowBlank(false);
|
||||||
p.add(new FieldLabel(description, "Description"),
|
p.add(new FieldLabel(description, "Description"),
|
||||||
new VerticalLayoutData(1, -1));
|
new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
tableDetailPanel.add(form);
|
setContent(form);
|
||||||
|
|
||||||
setContent(tableDetailPanel);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
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.codelisthelper.CodelistMappingSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTD;
|
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
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;
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
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.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;
|
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 {
|
public class CodelistMappingUrlSelectionCard extends WizardCard {
|
||||||
protected final String FORMWIDTH = "538px";
|
|
||||||
|
|
||||||
protected CodelistMappingSession codelistMappingSession;
|
protected CodelistMappingSession codelistMappingSession;
|
||||||
protected CodelistMappingUrlSelectionCard thisCard;
|
protected CodelistMappingUrlSelectionCard thisCard;
|
||||||
|
|
||||||
protected TextField name;
|
protected TextField urlField;
|
||||||
protected TextArea description;
|
|
||||||
|
|
||||||
public CodelistMappingUrlSelectionCard(
|
public CodelistMappingUrlSelectionCard(
|
||||||
final CodelistMappingSession codelistMappingSession) {
|
final CodelistMappingSession codelistMappingSession) {
|
||||||
|
@ -42,31 +38,19 @@ public class CodelistMappingUrlSelectionCard extends WizardCard {
|
||||||
this.codelistMappingSession = codelistMappingSession;
|
this.codelistMappingSession = codelistMappingSession;
|
||||||
|
|
||||||
FramedPanel form = new FramedPanel();
|
FramedPanel form = new FramedPanel();
|
||||||
form.setHeadingText("Url Selection");
|
form.setHeaderVisible(false);
|
||||||
form.setWidth(FORMWIDTH);
|
form.setBodyBorder(false);
|
||||||
|
|
||||||
FieldSet fieldSet = new FieldSet();
|
|
||||||
fieldSet.setHeadingText("");
|
|
||||||
fieldSet.setCollapsible(false);
|
|
||||||
form.add(fieldSet);
|
|
||||||
|
|
||||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
fieldSet.add(v);
|
form.add(v);
|
||||||
|
|
||||||
name = new TextField();
|
urlField = new TextField();
|
||||||
name.setAllowBlank(false);
|
urlField.setAllowBlank(false);
|
||||||
name.setEmptyText("Enter a name...");
|
urlField.setEmptyText("Insert a valid url...");
|
||||||
name.setValue(codelistMappingSession.getLocalFileName());
|
urlField.setValue(codelistMappingSession.getUrl());
|
||||||
name.setAllowBlank(false);
|
urlField.setAllowBlank(false);
|
||||||
v.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
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);
|
setContent(form);
|
||||||
|
|
||||||
|
@ -85,25 +69,21 @@ public class CodelistMappingUrlSelectionCard extends WizardCard {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (name.getValue() == null || name.getValue().isEmpty()
|
if (urlField.getValue() == null || urlField.getValue().isEmpty()
|
||||||
|| !name.isValid() || description.getValue() == null
|
|| !urlField.isValid()) {
|
||||||
|| description.getValue().isEmpty() || !description.isValid()) {
|
|
||||||
d = new AlertMessageBox("Attention!", "Fill in all fields");
|
d = new AlertMessageBox("Attention!", "Fill in all fields");
|
||||||
d.addHideHandler(hideHandler);
|
d.addHideHandler(hideHandler);
|
||||||
d.show();
|
d.show();
|
||||||
} else {
|
} else {
|
||||||
name.setReadOnly(true);
|
urlField.setReadOnly(true);
|
||||||
description.setReadOnly(true);
|
|
||||||
goNext();
|
goNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void goNext() {
|
protected void goNext() {
|
||||||
try {
|
try {
|
||||||
ResourceTD resourceTD=new ResourceTD();
|
String url=urlField.getCurrentValue();
|
||||||
resourceTD.setName(name.getCurrentValue());
|
codelistMappingSession.setUrl(url);
|
||||||
resourceTD.setDescription(description.getCurrentValue());
|
|
||||||
codelistMappingSession.setResourceTD(resourceTD);
|
|
||||||
|
|
||||||
CodelistMappingTableDetailCard detailsCard = new CodelistMappingTableDetailCard(
|
CodelistMappingTableDetailCard detailsCard = new CodelistMappingTableDetailCard(
|
||||||
codelistMappingSession);
|
codelistMappingSession);
|
||||||
|
@ -140,7 +120,7 @@ public class CodelistMappingUrlSelectionCard extends WizardCard {
|
||||||
};
|
};
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
getWizardWindow().setEnableNextButton(false);
|
getWizardWindow().setEnableNextButton(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue