diff --git a/config/profile.xml b/config/profile.xml index ba3dc9d..e4de0b3 100644 --- a/config/profile.xml +++ b/config/profile.xml @@ -6,7 +6,7 @@ tabular-data-codelistmapping-import-widget allows import from url, file and workspace of maps for codelist PortletsUser tabular-data-codelistmapping-import-widget - 1.7.0-SNAPSHOT + 1.0.0 tabular-data-codelistmapping-import-widget allows import from url, file and workspace of maps for codelist diff --git a/distro/README b/distro/README index 55012b5..0b89652 100644 --- a/distro/README +++ b/distro/README @@ -1,7 +1,9 @@ The gCube System - tabular-data-codelistmapping-import-widget ------------------------------------------------------------ -This work has been supported by the following European projects: iMarine (FP7-INFRASTRUCTURES-2011-2) +This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), +D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), +and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil), Parthenos (H2020-INFRADEV-1-2014-1), BlueBridge (H2020-EINFRA-2015-1). Authors ------- diff --git a/pom.xml b/pom.xml index 7c04916..c477e02 100644 --- a/pom.xml +++ b/pom.xml @@ -38,8 +38,8 @@ ${project.basedir}/distro ${project.build.directory}/${project.build.finalName} 2015-15-10 - https://gcube.wiki.gcube-system.org/gcube/index.php/Tabular_Data_Manager - + http://wiki.gcube-system.org/gcube/Tabular_Data_Manager + templates distro config diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTD.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTD.java index fcfe9b6..b741938 100644 --- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTD.java +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTD.java @@ -9,14 +9,14 @@ import com.google.web.bindery.event.shared.EventBus; /** * - * @author "Giancarlo Panichi" + * @author giancarlo + * email: g.panichi@isti.cnr.it * */ public class CodelistMappingImportWizardTD extends WizardWindow { - protected static final int WITHWIZARD=800; - protected static final int HEIGHTWIZARD=520; - - protected CodelistMappingSession codelistMappingSession; + private static final int WITHWIZARD=800; + private static final int HEIGHTWIZARD=520; + private CodelistMappingSession codelistMappingSession; /** * The id of the {@link CSVTarget} to use. diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTDEntry.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTDEntry.java index ba56aa9..08996b2 100644 --- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTDEntry.java +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingImportWizardTDEntry.java @@ -4,19 +4,30 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.core.client.GWT; import com.google.web.bindery.event.shared.SimpleEventBus; /** * - * @author "Giancarlo Panichi" + * @author giancarlo + * email: g.panichi@isti.cnr.it * */ -public class CodelistMappingImportWizardTDEntry implements EntryPoint { +public class CodelistMappingImportWizardTDEntry implements EntryPoint { + + private CodelistMappingMessages msgs; public void onModuleLoad() { - TRId trId=new TRId(); - SimpleEventBus eventBus=new SimpleEventBus(); - CodelistMappingImportWizardTD importWizard= new CodelistMappingImportWizardTD(trId, "Codelist Mapping Import",eventBus); + initMessages(); + TRId trId = new TRId(); + SimpleEventBus eventBus = new SimpleEventBus(); + CodelistMappingImportWizardTD importWizard = new CodelistMappingImportWizardTD( + trId, msgs.codelistMappingImportWizardHead(), eventBus); Log.info(importWizard.getId()); } + + private void initMessages() { + msgs = GWT.create(CodelistMappingMessages.class); + } + } diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingMessages.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingMessages.java new file mode 100644 index 0000000..e37629a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingMessages.java @@ -0,0 +1,83 @@ +package org.gcube.portlets.user.td.codelistmappingimportwidget.client; + +import com.google.gwt.i18n.client.Messages; + +/** + * + * @author giancarlo email: g.panichi@isti.cnr.it + * + */ +public interface CodelistMappingMessages extends Messages { + + @DefaultMessage("Codelist Mapping Import") + String codelistMappingImportWizardHead(); + + @DefaultMessage("Codelist Mapping source selection") + String sourceSelectionCardHead(); + + @DefaultMessage("Codelist Mapping Import File Upload") + String codelistMappingUploadFileCardHead(); + + @DefaultMessage("Select the Codelist before curation") + String tabResourcesSelectionCardHead(); + + @DefaultMessage("This tabular resource does not have a valid table!") + String attentionThisTabularResourceDoesNotHaveAValidTable(); + + @DefaultMessage("Delete") + String delete(); + + @DefaultMessage("Would you like to delete this tabular resource without table?") + String wouldYouLikeToDeleteThisTabularResourceWithoutTable(); + + @DefaultMessage("Error on delete TabResource: ") + String errorOnDeleteTabularResourceFixed(); + + @DefaultMessage("Select The Code Column") + String columnSelectionCardHead(); + + @DefaultMessage("No columns selected!") + String attentionNoColumnsSelected(); + + @DefaultMessage("Codelist Mapping Detail") + String codelistMappingDetailCardHead(); + + @DefaultMessage("Enter a name...") + String fieldNameEmptyText(); + + @DefaultMessage("Name") + String fieldNameLabel(); + + @DefaultMessage("Enter a description...") + String fieldDescriptionEmptyText(); + + @DefaultMessage("Description") + String fieldDescriptionLabel(); + + @DefaultMessage("XML map") + String fieldDescriptionDefaultValue(); + + @DefaultMessage("Fill in all fields") + String attentionFillInAllFields(); + + @DefaultMessage("Document: ") + String documentFixed(); + + @DefaultMessage("Source: ") + String sourceFixed(); + + @DefaultMessage("Name: ") + String nameFixed(); + + @DefaultMessage("Import Summary") + String summaryImport(); + + @DefaultMessage("An error occured in import codelist mapping: ") + String errorAnErrorOccurredInImportCodelistMappingFixed(); + + @DefaultMessage("Error in Codelist Mapping Import") + String errorInCodelistMappingImportHead(); + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingOperationInProgressCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingOperationInProgressCard.java index dfe130e..96c569f 100644 --- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingOperationInProgressCard.java +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingOperationInProgressCard.java @@ -10,6 +10,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedExcep import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog; import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener; +import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult; @@ -17,6 +18,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; 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.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -36,19 +38,18 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou */ public class CodelistMappingOperationInProgressCard extends WizardCard implements MonitorDialogListener { - - protected CodelistMappingOperationInProgressCard thisCard; - protected CodelistMappingSession codelistMappingSession; - protected TRId newTrId; - protected HtmlLayoutContainer resultField; + private static CommonMessages msgsCommon= GWT.create(CommonMessages.class); + private CodelistMappingMessages msgs; + private CodelistMappingSession codelistMappingSession; + private TRId newTrId; + private HtmlLayoutContainer resultField; + public CodelistMappingOperationInProgressCard( final CodelistMappingSession codelistMappingSession) { - super("Operation In Progress", ""); - + super(msgsCommon.operationInProgress(), ""); this.codelistMappingSession = codelistMappingSession; - thisCard = this; - + initMessages(); VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer(); operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER); @@ -58,19 +59,19 @@ public class CodelistMappingOperationInProgressCard extends WizardCard description.setBorderWidth(0); description.setHTML(0, 0, - "Document: "); + ""+msgs.documentFixed()+""); description.setText(0, 1, "Codelist Mapping"); description.setHTML(1, 0, - "Source: "); + ""+msgs.sourceFixed()+""); description.setText(1, 1, codelistMappingSession.getSource().getName()); description.setHTML(2, 0, - "Name: "); + ""+msgs.nameFixed()+""); description.setText(2, 1, codelistMappingSession .getResourceTDDescriptor().getName()); FramedPanel summary = new FramedPanel(); - summary.setHeadingText("Import Summary"); + summary.setHeadingText(msgs.summaryImport()); summary.setWidth(400); summary.add(description); operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20, @@ -85,7 +86,12 @@ public class CodelistMappingOperationInProgressCard extends WizardCard resultField.setVisible(false); } - + + protected void initMessages(){ + msgs = GWT.create(CodelistMappingMessages.class); + } + + public void importCodelistMapping() { TDGWTServiceAsync.INSTANCE.startCodelistMappingImport( codelistMappingSession, new AsyncCallback() { @@ -103,19 +109,19 @@ public class CodelistMappingOperationInProgressCard extends WizardCard } else { if (caught instanceof TDGWTIsLockedException) { Log.error(caught.getLocalizedMessage()); - showErrorAndHide("Error", + showErrorAndHide(msgsCommon.errorLocked(), caught.getLocalizedMessage(), "", caught); } else { if (caught instanceof TDGWTIsFinalException) { Log.error(caught.getLocalizedMessage()); - showErrorAndHide("Error", + showErrorAndHide(msgsCommon.errorFinal(), caught.getLocalizedMessage(), "", caught); } else { showErrorAndHide( - "Error in import codelist mapping", - "An error occured in import codelist mapping: ", + msgsCommon.error(), + msgs.errorAnErrorOccurredInImportCodelistMappingFixed(), caught.getLocalizedMessage(), caught); } @@ -146,7 +152,7 @@ public class CodelistMappingOperationInProgressCard extends WizardCard newTrId = operationResult.getTrId(); SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); safeHtmlBuilder - .appendHtmlConstant("
Operation Completed
"); + .appendHtmlConstant("
"+msgsCommon.operationCompleted()+"
"); resultField.setHTML(safeHtmlBuilder.toSafeHtml()); resultField.setVisible(true); @@ -177,7 +183,7 @@ public class CodelistMappingOperationInProgressCard extends WizardCard public void operationFailed(Throwable caught, String reason, String details) { SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); safeHtmlBuilder - .appendHtmlConstant("
Operation Failed
"); + .appendHtmlConstant("
"+msgsCommon.operationFailed()+"
"); resultField.setHTML(safeHtmlBuilder.toSafeHtml()); resultField.setVisible(true); if (caught instanceof TDGWTSessionExpiredException) { @@ -188,15 +194,15 @@ public class CodelistMappingOperationInProgressCard extends WizardCard } else { if (caught instanceof TDGWTIsLockedException) { Log.error(caught.getLocalizedMessage()); - showErrorAndHide("Error Locked", caught.getLocalizedMessage(), + showErrorAndHide(msgsCommon.errorLocked(), caught.getLocalizedMessage(), "", caught); } else { if (caught instanceof TDGWTIsFinalException) { Log.error(caught.getLocalizedMessage()); - showErrorAndHide("Error Final", + showErrorAndHide(msgsCommon.errorFinal(), caught.getLocalizedMessage(), "", caught); } else { - showErrorAndHide("Error in Codelist Mapping Import", + showErrorAndHide(msgs.errorInCodelistMappingImportHead(), reason, details, caught); } } @@ -210,7 +216,7 @@ public class CodelistMappingOperationInProgressCard extends WizardCard newTrId = operationResult.getTrId(); SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); safeHtmlBuilder - .appendHtmlConstant("
Problems in the Operation
"); + .appendHtmlConstant("
"+msgsCommon.operationProblem()+"
"); resultField.setHTML(safeHtmlBuilder.toSafeHtml()); resultField.setVisible(true); @@ -242,7 +248,7 @@ public class CodelistMappingOperationInProgressCard extends WizardCard public void operationAborted() { SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); safeHtmlBuilder - .appendHtmlConstant("
Operation Aborted
"); + .appendHtmlConstant("
"+msgsCommon.operationAborted()+"
"); resultField.setHTML(safeHtmlBuilder.toSafeHtml()); resultField.setVisible(true); @@ -272,7 +278,7 @@ public class CodelistMappingOperationInProgressCard extends WizardCard public void operationPutInBackground() { SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); safeHtmlBuilder - .appendHtmlConstant("
Operation in Background
"); + .appendHtmlConstant("
"+msgsCommon.operationInBackground()+"
"); resultField.setHTML(safeHtmlBuilder.toSafeHtml()); resultField.setVisible(true); 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 ea3508e..fb0dc37 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 @@ -5,9 +5,11 @@ 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.tr.resources.ResourceTDDescriptor; +import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages; 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.user.client.Command; import com.sencha.gxt.widget.core.client.FramedPanel; import com.sencha.gxt.widget.core.client.box.AlertMessageBox; @@ -26,50 +28,58 @@ import com.sencha.gxt.widget.core.client.form.TextField; * */ public class CodelistMappingTableDetailCard extends WizardCard { + private static CodelistMappingMessages msgs = GWT.create(CodelistMappingMessages.class); + private CommonMessages msgsCommon; + private CodelistMappingSession codelistMappingSession; + private CodelistMappingTableDetailCard thisCard; - protected CodelistMappingSession codelistMappingSession; - protected CodelistMappingTableDetailCard thisCard; + private VerticalLayoutContainer p; - protected VerticalLayoutContainer p; + private TextField fieldName; + private TextArea fieldDescription; - protected TextField name; - protected TextArea description; - - protected ResourceTDDescriptor resourceDetails = new ResourceTDDescriptor(); + private ResourceTDDescriptor resourceDetails = new ResourceTDDescriptor(); + public CodelistMappingTableDetailCard( final CodelistMappingSession codelistMappingSession) { - super("Codelist Mapping Detail", ""); - + super(msgs.codelistMappingDetailCardHead(), ""); this.codelistMappingSession = codelistMappingSession; thisCard = this; + + initMessages(); + FramedPanel form = new FramedPanel(); form.setHeaderVisible(false); p = new VerticalLayoutContainer(); form.add(p); - name = new TextField(); - name.setAllowBlank(false); - name.setEmptyText("Enter a name..."); + fieldName = new TextField(); + fieldName.setAllowBlank(false); + fieldName.setEmptyText(msgs.fieldNameEmptyText()); if (codelistMappingSession.getLocalFileName() != null && !codelistMappingSession.getLocalFileName().isEmpty()) { - name.setValue(codelistMappingSession.getLocalFileName()); + fieldName.setValue(codelistMappingSession.getLocalFileName()); } else { } - p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1)); + p.add(new FieldLabel(fieldName, msgs.fieldNameLabel()), new VerticalLayoutData(1, -1)); - description = new TextArea(); - description.setAllowBlank(false); - description.setEmptyText("Enter a description..."); - description.setValue("XML map"); - p.add(new FieldLabel(description, "Description"), + fieldDescription = new TextArea(); + fieldDescription.setAllowBlank(false); + fieldDescription.setEmptyText(msgs.fieldDescriptionEmptyText()); + fieldDescription.setValue(msgs.fieldDescriptionDefaultValue()); + p.add(new FieldLabel(fieldDescription, msgs.fieldDescriptionLabel()), new VerticalLayoutData(1, -1)); setContent(form); } + + protected void initMessages(){ + msgsCommon = GWT.create(CommonMessages.class); + } @Override public void setup() { @@ -114,15 +124,15 @@ public class CodelistMappingTableDetailCard extends WizardCard { } }; - if (name.getValue() == null || name.getValue().isEmpty() - || !name.isValid() || description.getValue() == null - || description.getValue().isEmpty() || !description.isValid()) { - d = new AlertMessageBox("Attention!", "Fill in all fields"); + if (fieldName.getValue() == null || fieldName.getValue().isEmpty() + || !fieldName.isValid() || fieldDescription.getValue() == null + || fieldDescription.getValue().isEmpty() || !fieldDescription.isValid()) { + d = new AlertMessageBox(msgsCommon.attention(), msgs.attentionFillInAllFields()); d.addHideHandler(hideHandler); d.show(); } else { - name.setReadOnly(true); - description.setReadOnly(true); + fieldName.setReadOnly(true); + fieldDescription.setReadOnly(true); goNext(); } } @@ -130,8 +140,8 @@ public class CodelistMappingTableDetailCard extends WizardCard { protected void goNext() { Log.debug("goNext()"); try { - resourceDetails.setName(name.getCurrentValue()); - resourceDetails.setDescription(description.getCurrentValue()); + resourceDetails.setName(fieldName.getCurrentValue()); + resourceDetails.setDescription(fieldDescription.getCurrentValue()); codelistMappingSession.setResourceTDDescriptor(resourceDetails); diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUploadFileCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUploadFileCard.java index 77346ed..2166dc3 100644 --- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUploadFileCard.java +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingUploadFileCard.java @@ -7,6 +7,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappi 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.user.client.Command; /** @@ -16,12 +17,13 @@ import com.google.gwt.user.client.Command; * */ public class CodelistMappingUploadFileCard extends WizardCard { - protected CodelistMappingSession codelistMappingSession; - protected CodelistMappingFileUploadPanel fileUploadPanel; - protected CodelistMappingUploadFileCard thisCard; + private static CodelistMappingMessages msgs = GWT.create(CodelistMappingMessages.class); + private CodelistMappingSession codelistMappingSession; + private CodelistMappingFileUploadPanel fileUploadPanel; + private CodelistMappingUploadFileCard thisCard; public CodelistMappingUploadFileCard(final CodelistMappingSession codelistMappingSession) { - super("Codelist Mapping Import File Upload", ""); + super(msgs.codelistMappingUploadFileCardHead(), ""); this.thisCard = this; this.codelistMappingSession = codelistMappingSession; @@ -65,7 +67,12 @@ public class CodelistMappingUploadFileCard extends WizardCard { }; getWizardWindow().setPreviousButtonCommand(sayPreviousCard); - getWizardWindow().setEnableNextButton(false); + setEnableNextButton(false); + setNextButtonVisible(true); + setEnableBackButton(true); + setBackButtonVisible(true); + + } } 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 9b51ec1..49ee5b2 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 @@ -120,7 +120,12 @@ public class CodelistMappingUrlSelectionCard extends WizardCard { }; getWizardWindow().setPreviousButtonCommand(sayPreviousCard); - getWizardWindow().setEnableNextButton(true); + + setEnableNextButton(true); + setNextButtonVisible(true); + setEnableBackButton(true); + setBackButtonVisible(true); + } } diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingWorkSpaceSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingWorkSpaceSelectionCard.java index 7c5a7b4..298a92d 100644 --- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingWorkSpaceSelectionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/CodelistMappingWorkSpaceSelectionCard.java @@ -172,7 +172,10 @@ public class CodelistMappingWorkSpaceSelectionCard extends WizardCard { }; getWizardWindow().setPreviousButtonCommand(sayPreviousCard); - getWizardWindow().setEnableNextButton(false); + setEnableNextButton(false); + setNextButtonVisible(true); + setEnableBackButton(true); + setBackButtonVisible(true); } diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/ColumnSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/ColumnSelectionCard.java index bc4a8f1..f6fafda 100644 --- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/ColumnSelectionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/ColumnSelectionCard.java @@ -2,11 +2,13 @@ package org.gcube.portlets.user.td.codelistmappingimportwidget.client; import org.gcube.portlets.user.td.codelistmappingimportwidget.client.grid.ColumnDataGridPanel; import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; +import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData; import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.shared.GWT; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.user.client.Command; @@ -24,14 +26,18 @@ import com.sencha.gxt.widget.core.client.form.FormPanel; * */ public class ColumnSelectionCard extends WizardCard { - protected ColumnSelectionCard thisCard; - protected CodelistMappingSession codelistMappingSession; - protected ColumnDataGridPanel columnsGridPanel; + private static CodelistMappingMessages msgs = GWT + .create(CodelistMappingMessages.class); + private ColumnSelectionCard thisCard; + private CodelistMappingSession codelistMappingSession; + private ColumnDataGridPanel columnsGridPanel; + private CommonMessages msgsCommon; public ColumnSelectionCard( final CodelistMappingSession codelistMappingSession) { - super("Select The Code Column", ""); + super(msgs.columnSelectionCardHead(), ""); thisCard = this; + initMessages(); if (codelistMappingSession == null) { Log.error("CodelistMappingSession is null"); } @@ -41,6 +47,11 @@ public class ColumnSelectionCard extends WizardCard { setContent(panel); } + + protected void initMessages(){ + msgsCommon = GWT.create(CommonMessages.class); + } + protected FormPanel createPanel() { FormPanel panel = new FormPanel(); @@ -50,21 +61,22 @@ public class ColumnSelectionCard extends WizardCard { VerticalLayoutContainer content = new VerticalLayoutContainer(); panel.add(content); - TRId trId=codelistMappingSession.getConnectedTR().getTrId(); - if(trId==null){ - Log.error("CodelistMappingSession has TRId null: "+codelistMappingSession.getConnectedTR()); + TRId trId = codelistMappingSession.getConnectedTR().getTrId(); + if (trId == null) { + Log.error("CodelistMappingSession has TRId null: " + + codelistMappingSession.getConnectedTR()); } - + columnsGridPanel = new ColumnDataGridPanel(this, trId); columnsGridPanel .addSelectionHandler(new SelectionHandler() { - public void onSelection(SelectionEvent event) { + public void onSelection(SelectionEvent event) { codelistMappingSession .setConnectedColumn(columnsGridPanel .getSelectedItem()); - getWizardWindow().setEnableNextButton(true); + setEnableNextButton(true); } }); @@ -103,26 +115,25 @@ public class ColumnSelectionCard extends WizardCard { getWizardWindow().setPreviousButtonCommand(sayPreviousCard); setEnableNextButton(false); setEnableBackButton(true); - + } protected void checkData() { - getWizardWindow().setEnableNextButton(false); - getWizardWindow().setEnableBackButton(false); + setEnableNextButton(false); + setEnableBackButton(false); AlertMessageBox d; HideHandler hideHandler = new HideHandler() { public void onHide(HideEvent event) { - getWizardWindow().setEnableNextButton(false); - getWizardWindow().setEnableBackButton(true); + setEnableNextButton(false); + setEnableBackButton(true); } }; - ColumnData column = codelistMappingSession - .getConnectedColumn(); + ColumnData column = codelistMappingSession.getConnectedColumn(); if (column == null) { - d = new AlertMessageBox("Attention", "No columns selected"); + d = new AlertMessageBox(msgsCommon.attention(), msgs.attentionNoColumnsSelected()); d.addHideHandler(hideHandler); d.setModal(false); d.show(); diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/SourceSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/SourceSelectionCard.java index 0457ad4..3097799 100644 --- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/SourceSelectionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/SourceSelectionCard.java @@ -8,9 +8,11 @@ import org.gcube.portlets.user.td.gwtservice.shared.source.FileSource; import org.gcube.portlets.user.td.gwtservice.shared.source.SourceType; import org.gcube.portlets.user.td.gwtservice.shared.source.UrlSource; import org.gcube.portlets.user.td.gwtservice.shared.source.WorkspaceSource; +import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages; import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.shared.GWT; import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.user.client.Command; @@ -26,17 +28,19 @@ import com.sencha.gxt.widget.core.client.form.Radio; * */ public class SourceSelectionCard extends WizardCard { - - protected final CodelistMappingSession codelistMappingSession; - - final UrlSource urlSource = UrlSource.INSTANCE; - final FileSource fileSource = FileSource.INSTANCE; - final WorkspaceSource workspaceSource = WorkspaceSource.INSTANCE; + private static final CodelistMappingMessages msgs = GWT + .create(CodelistMappingMessages.class); + private final CodelistMappingSession codelistMappingSession; + private final UrlSource urlSource = UrlSource.INSTANCE; + private final FileSource fileSource = FileSource.INSTANCE; + private final WorkspaceSource workspaceSource = WorkspaceSource.INSTANCE; + private CommonMessages msgsCommon; public SourceSelectionCard(final CodelistMappingSession codelistMappingSession) { - super("Codelist Mapping source selection", ""); - + super(msgs.sourceSelectionCardHead(), ""); this.codelistMappingSession = codelistMappingSession; + initMessages(); + // Default codelistMappingSession.setSource(urlSource); @@ -46,7 +50,7 @@ public class SourceSelectionCard extends WizardCard { Radio radioUrlSource = new Radio(); radioUrlSource.setBoxLabel("

" - + urlSource.getName() + "
" + urlSource.getDescription() + + msgsCommon.urlSourceName() + "
" + msgsCommon.urlSourceDescription() + "

"); radioUrlSource.setName(urlSource.getName()); radioUrlSource.setStylePrimaryName(res.wizardCSS() @@ -55,16 +59,16 @@ public class SourceSelectionCard extends WizardCard { Radio radioFileSource = new Radio(); radioFileSource.setBoxLabel("

" - + fileSource.getName() + "
" - + fileSource.getDescription() + "

"); + + msgsCommon.fileSourceName() + "
" + + msgsCommon.fileSourceDescription() + "

"); radioFileSource.setName(fileSource.getName()); radioFileSource.setStylePrimaryName(res.wizardCSS() .getImportSelectionSource()); Radio radioWorkspaceSource = new Radio(); radioWorkspaceSource.setBoxLabel("

" - + workspaceSource.getName() + "
" - + workspaceSource.getDescription() + "

"); + + msgsCommon.workspaceSourceName() + "
" + + msgsCommon.workspaceSourceDescription() + "

"); radioWorkspaceSource.setName(workspaceSource.getName()); radioWorkspaceSource.setStylePrimaryName(res.wizardCSS() .getImportSelectionSource()); @@ -116,24 +120,32 @@ public class SourceSelectionCard extends WizardCard { } + protected void initMessages(){ + msgsCommon = GWT.create(CommonMessages.class); + } + @Override public void setup() { Log.debug("Setup Card"); Command sayNextCard = new Command() { public void execute() { try { - String sourceId = codelistMappingSession.getSource().getId(); + String sourceId = codelistMappingSession.getSource() + .getId(); if (sourceId == null || sourceId.isEmpty()) { - Log.error("Codelist Mapping Import Source Id: " + sourceId); + Log.error("Codelist Mapping Import Source Id: " + + sourceId); } else { if (sourceId.compareTo(SourceType.FILE.toString()) == 0) { Log.info("NextCard CodelistMappingUploadFileCard"); CodelistMappingUploadFileCard codelistMappingUploadFileCard = new CodelistMappingUploadFileCard( codelistMappingSession); - getWizardWindow().addCard(codelistMappingUploadFileCard); + getWizardWindow().addCard( + codelistMappingUploadFileCard); getWizardWindow().nextCard(); } else { - if (sourceId.compareTo(SourceType.WORKSPACE.toString()) == 0) { + if (sourceId.compareTo(SourceType.WORKSPACE + .toString()) == 0) { Log.info("NextCard CSVWorkspaceSelectionCard"); CodelistMappingWorkSpaceSelectionCard codelistMappingWorkspaceSelectionCard = new CodelistMappingWorkSpaceSelectionCard( codelistMappingSession); @@ -141,7 +153,8 @@ public class SourceSelectionCard extends WizardCard { codelistMappingWorkspaceSelectionCard); getWizardWindow().nextCard(); } else { - if (sourceId.compareTo(SourceType.URL.toString()) == 0) { + if (sourceId.compareTo(SourceType.URL + .toString()) == 0) { Log.info("NextCard CodelistMappingURLSelectionCard"); CodelistMappingUrlSelectionCard codelistMappingUrlSelectionCard = new CodelistMappingUrlSelectionCard( codelistMappingSession); @@ -161,7 +174,13 @@ public class SourceSelectionCard extends WizardCard { }; getWizardWindow().setNextButtonCommand(sayNextCard); - + + setEnableNextButton(true); + setNextButtonVisible(true); + setEnableBackButton(false); + setBackButtonVisible(false); + + } } diff --git a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/TabResourcesSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/TabResourcesSelectionCard.java index ecf9672..4bd259d 100644 --- a/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/TabResourcesSelectionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/codelistmappingimportwidget/client/TabResourcesSelectionCard.java @@ -5,11 +5,13 @@ import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappi import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData; +import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; 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.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.user.client.Command; @@ -24,19 +26,27 @@ import com.sencha.gxt.widget.core.client.event.DialogHideEvent.DialogHideHandler import com.sencha.gxt.widget.core.client.event.HideEvent; import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; +/** + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ public class TabResourcesSelectionCard extends WizardCard { - protected CodelistMappingSession codelistMappingSession; - protected TabResourcesSelectionCard thisCard; - protected TabResourcesSelectionPanel tabResourcesSelectionPanel; - protected TabResource selectedTabResource = null; - + private static CodelistMappingMessages msgs = GWT + .create(CodelistMappingMessages.class); + private CodelistMappingSession codelistMappingSession; + private TabResourcesSelectionCard thisCard; + private TabResourcesSelectionPanel tabResourcesSelectionPanel; + private CommonMessages msgsCommon; + public TabResourcesSelectionCard( final CodelistMappingSession codelistMappingSession) { - super("Select the Codelist before curation", ""); + super(msgs.tabResourcesSelectionCardHead(), ""); Log.debug("TabResourcesSelectionCard"); this.codelistMappingSession = codelistMappingSession; thisCard = this; - + tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard, res); @@ -47,7 +57,7 @@ public class TabResourcesSelectionCard extends WizardCard { codelistMappingSession .setConnectedTR(tabResourcesSelectionPanel .getSelectedItem()); - getWizardWindow().setEnableNextButton(true); + setEnableNextButton(true); } }); @@ -55,6 +65,10 @@ public class TabResourcesSelectionCard extends WizardCard { setContent(tabResourcesSelectionPanel); } + + protected void initMessages(){ + msgsCommon = GWT.create(CommonMessages.class); + } @Override public void setup() { @@ -84,14 +98,14 @@ public class TabResourcesSelectionCard extends WizardCard { }; getWizardWindow().setPreviousButtonCommand(sayPreviousCard); - getWizardWindow().setEnableNextButton(false); - getWizardWindow().setEnableBackButton(false); + setEnableNextButton(false); + setEnableBackButton(false); } protected void retrieveLastTable() { - getWizardWindow().setEnableNextButton(false); - getWizardWindow().setEnableBackButton(false); + setEnableNextButton(false); + setEnableBackButton(false); TDGWTServiceAsync.INSTANCE.getLastTable(codelistMappingSession .getConnectedTR().getTrId(), new AsyncCallback() { @@ -105,8 +119,8 @@ public class TabResourcesSelectionCard extends WizardCard { } else { Log.debug("Attention", "This tabular resource does not have a valid table"); - AlertMessageBox d = new AlertMessageBox("Attention", - "This tabular resource does not have a valid table"); + AlertMessageBox d = new AlertMessageBox(msgsCommon.attention(), + msgs.attentionThisTabularResourceDoesNotHaveAValidTable()); d.addHideHandler(new HideHandler() { public void onHide(HideEvent event) { @@ -130,41 +144,35 @@ public class TabResourcesSelectionCard extends WizardCard { } protected void deleteTRWithLastTableNull() { - final ConfirmMessageBox mb = new ConfirmMessageBox("Delete", - "Would you like to delete this tabular resource without table?"); - /* GXT 3.0.1 - mb.addHideHandler(new HideHandler() { - public void onHide(HideEvent event) { - if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES - .name())) { - callDeleteLastTable(); - } else if (mb.getHideButton() == mb - .getButtonById(PredefinedButton.NO.name())) { - getWizardWindow().setEnableNextButton(true); - getWizardWindow().setEnableBackButton(true); - } - } - }); - */ - + final ConfirmMessageBox mb = new ConfirmMessageBox(msgs.delete(), + msgs.wouldYouLikeToDeleteThisTabularResourceWithoutTable()); + /* + * GXT 3.0.1 mb.addHideHandler(new HideHandler() { public void + * onHide(HideEvent event) { if (mb.getHideButton() == + * mb.getButtonById(PredefinedButton.YES .name())) { + * callDeleteLastTable(); } else if (mb.getHideButton() == mb + * .getButtonById(PredefinedButton.NO.name())) { + * setEnableNextButton(true); + * setEnableBackButton(true); } } }); + */ + // Next in GXT 3.1.1 - - mb.addDialogHideHandler(new DialogHideHandler() { - + + mb.addDialogHideHandler(new DialogHideHandler() { @Override public void onDialogHide(DialogHideEvent event) { switch (event.getHideButton()) { case NO: - getWizardWindow().setEnableNextButton(true); - getWizardWindow().setEnableBackButton(true); + setEnableNextButton(true); + setEnableBackButton(true); break; case YES: callDeleteLastTable(); break; default: - getWizardWindow().setEnableNextButton(true); - getWizardWindow().setEnableBackButton(true); + setEnableNextButton(true); + setEnableBackButton(true); break; } @@ -183,14 +191,14 @@ public class TabResourcesSelectionCard extends WizardCard { .getConnectedTR().getTrId(), new AsyncCallback() { public void onFailure(Throwable caught) { - AlertMessageBox d = new AlertMessageBox("Error", - "Error on delete TabResource: " + AlertMessageBox d = new AlertMessageBox(msgsCommon.error(), + msgs.errorOnDeleteTabularResourceFixed() + caught.getLocalizedMessage()); d.addHideHandler(new HideHandler() { public void onHide(HideEvent event) { - getWizardWindow().setEnableNextButton(true); - getWizardWindow().setEnableBackButton(true); + setEnableNextButton(true); + setEnableBackButton(true); } }); @@ -200,8 +208,8 @@ public class TabResourcesSelectionCard extends WizardCard { public void onSuccess(Void result) { tabResourcesSelectionPanel.gridReload(); - getWizardWindow().setEnableNextButton(false); - getWizardWindow().setEnableBackButton(true); + setEnableNextButton(false); + setEnableBackButton(true); } }); diff --git a/src/main/resources/org/gcube/portlets/user/td/codelistmappingimportwidget/client/Messages.properties b/src/main/resources/org/gcube/portlets/user/td/codelistmappingimportwidget/client/Messages.properties deleted file mode 100644 index c222555..0000000 --- a/src/main/resources/org/gcube/portlets/user/td/codelistmappingimportwidget/client/Messages.properties +++ /dev/null @@ -1,2 +0,0 @@ -sendButton = Send -nameField = Enter your name \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/codelistmappingimportwidget/client/Messages_fr.properties b/src/main/resources/org/gcube/portlets/user/td/codelistmappingimportwidget/client/Messages_fr.properties deleted file mode 100644 index b4a7627..0000000 --- a/src/main/resources/org/gcube/portlets/user/td/codelistmappingimportwidget/client/Messages_fr.properties +++ /dev/null @@ -1,2 +0,0 @@ -sendButton = Envoyer -nameField = Entrez votre nom \ No newline at end of file diff --git a/templates/README b/templates/README index 7e3ad55..38bf491 100644 --- a/templates/README +++ b/templates/README @@ -1,7 +1,9 @@ The gCube System - ${name} ------------------------------------------------------------ -This work has been supported by the following European projects: iMarine (FP7-INFRASTRUCTURES-2011-2) +This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), +D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), +and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil), Parthenos (H2020-INFRADEV-1-2014-1), BlueBridge (H2020-EINFRA-2015-1). Authors ------- diff --git a/templates/profile.xml b/templates/profile.xml index 19ed5bc..ffa3274 100644 --- a/templates/profile.xml +++ b/templates/profile.xml @@ -6,7 +6,7 @@ ${project.description} PortletsUser ${project.name} - ${version} + 1.0.0 ${project.description}