From af6d14f0a393c8dd53bf18036b73a5d061c2aa90 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 6 Nov 2015 17:29:41 +0000 Subject: [PATCH] 915: TDM - Support the Spanish language Task-Url: https://support.d4science.org/issues/915 Updated Spanish Support git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-extractcodelist-widget@120230 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/README | 2 +- pom.xml | 3 +- .../client/ExtractCodelistDetailsCard.java | 116 ++++++------- .../client/ExtractCodelistMessages.java | 139 ++++++++++++++++ ...xtractCodelistOperationInProgressCard.java | 102 +++++++----- .../client/ExtractCodelistWizardTD.java | 31 ++-- .../client/ExtractCodelistWizardTDEntry.java | 22 ++- .../client/SourceColumnsSelectionCard.java | 45 +++--- .../client/TargetColumnsSelectionCard.java | 54 +++++-- .../client/TargetColumnsSelectionPanel.java | 153 ++++++++++-------- .../client/grid/ColumnDataGridPanel.java | 26 +-- .../ExtractCodelistWizardTD.gwt.xml | 65 ++++---- .../ExtractCodelistMessages_es.properties | 42 +++++ .../ExtractCodelistMessages_it.properties | 42 +++++ .../client/ExtractcodelistMessages.properties | 42 +++++ .../client/Messages.properties | 2 - .../client/Messages_fr.properties | 2 - 17 files changed, 621 insertions(+), 267 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages.java create mode 100644 src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages_es.properties create mode 100644 src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages_it.properties create mode 100644 src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractcodelistMessages.properties delete mode 100644 src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/Messages.properties delete mode 100644 src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/Messages_fr.properties diff --git a/distro/README b/distro/README index f3d2c83..97123e5 100644 --- a/distro/README +++ b/distro/README @@ -39,7 +39,7 @@ Documentation tabular-data-extractcodelist-widget ensures the extraction of codelist from tabular resources Documentation is available on-line from the Projects Documentation Wiki: - https://gcube.wiki.gcube-system.org/gcube/index.php/Tabular_Data_Manager + http://wiki.gcube-system.org/gcube/Tabular_Data_Manager Licensing diff --git a/pom.xml b/pom.xml index 7b160cd..8580754 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,8 @@ ${project.basedir}/distro ${project.build.directory}/${project.build.finalName} 2015-10-15 - 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/extractcodelistwidget/client/ExtractCodelistDetailsCard.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistDetailsCard.java index 8f02b8d..4263449 100644 --- a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistDetailsCard.java +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistDetailsCard.java @@ -1,9 +1,9 @@ package org.gcube.portlets.user.td.extractcodelistwidget.client; - import org.gcube.portlets.user.td.expressionwidget.client.properties.ColumnDataPropertiesCombo; import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; +import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData; import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; @@ -33,7 +33,6 @@ 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.Radio; import com.sencha.gxt.widget.core.client.form.TextField; -import com.sencha.gxt.widget.core.client.info.Info; /** * @@ -42,12 +41,13 @@ import com.sencha.gxt.widget.core.client.info.Info; * */ public class ExtractCodelistDetailsCard extends WizardCard { - // private static DateTimeFormat sdf = - // DateTimeFormat.getFormat("yyyy-MM-dd"); private static final String TABLEDETAILPANELWIDTH = "100%"; private static final String TABLEDETAILPANELHEIGHT = "100%"; private static final String FORMWIDTH = "538px"; + private static ExtractCodelistMessages msgs = GWT + .create(ExtractCodelistMessages.class); + private CommonMessages msgsCommon; private ExtractCodelistSession extractCodelistSession; private ExtractCodelistDetailsCard thisCard; @@ -55,23 +55,34 @@ public class ExtractCodelistDetailsCard extends WizardCard { private VerticalLayoutContainer p; private VerticalPanel tableDetailPanel; - private TextField name; + private TextField nameField; private Radio automaticallyAttachTrue; private Radio automaticallyAttachFalse; private TabResource detail; private ComboBox comboAttachToColumn; private ColumnData attachColumn; - private FieldLabel attachToColumnField; + private FieldLabel comboAttachToColumnLabel; public ExtractCodelistDetailsCard( final ExtractCodelistSession extractCodelistSession) { - super("Codelist Detail", ""); + super(msgs.extractCodelistDetailCardHead(), ""); this.extractCodelistSession = extractCodelistSession; thisCard = this; attachColumn = null; + initMessages(); + create(); + + } + + protected void initMessages() { + msgsCommon = GWT.create(CommonMessages.class); + } + + protected void create() { + tableDetailPanel = new VerticalPanel(); tableDetailPanel.setSpacing(4); @@ -79,39 +90,40 @@ public class ExtractCodelistDetailsCard extends WizardCard { tableDetailPanel.setHeight(TABLEDETAILPANELHEIGHT); FramedPanel form = new FramedPanel(); - form.setHeadingText("Details"); + form.setHeadingText(msgs.extractCodelistDetailsCardFormHead()); form.setWidth(FORMWIDTH); - FieldSet fieldSet = new FieldSet(); - fieldSet.setHeadingText("Information"); - fieldSet.setCollapsible(false); - form.add(fieldSet); + FieldSet infoFieldSet = new FieldSet(); + infoFieldSet.setHeadingText(msgs.infoFieldSetHead()); + infoFieldSet.setCollapsible(false); + form.add(infoFieldSet); p = new VerticalLayoutContainer(); - fieldSet.add(p); + infoFieldSet.add(p); - name = new TextField(); - name.setAllowBlank(false); - name.setEmptyText("Enter a name..."); - name.setAllowBlank(false); - FieldLabel nameField=new FieldLabel(name, "Name"); - nameField.setToolTip("Enter the name of new codelist extracted"); - p.add(nameField, new VerticalLayoutData(1, -1, - new Margins(0))); + nameField = new TextField(); + nameField.setAllowBlank(false); + nameField.setEmptyText(msgs.nameFieldEmptyText()); + nameField.setAllowBlank(false); + FieldLabel nameFieldLabel = new FieldLabel(nameField, + msgs.nameFieldLabel()); + nameFieldLabel.setToolTip(msgs.nameFieldToolTip()); + p.add(nameFieldLabel, new VerticalLayoutData(1, -1, new Margins(0))); // / automaticallyAttachTrue = new Radio(); - automaticallyAttachTrue.setBoxLabel("True"); + automaticallyAttachTrue + .setBoxLabel(msgs.automaticallyAttachTrueLabel()); automaticallyAttachTrue.setValue(true); - + automaticallyAttachFalse = new Radio(); - automaticallyAttachFalse.setBoxLabel("False"); - - + automaticallyAttachFalse.setBoxLabel(msgs + .automaticallyAttachFalseLabel()); + ToggleGroup automaticallyAttachGroup = new ToggleGroup(); automaticallyAttachGroup.add(automaticallyAttachTrue); automaticallyAttachGroup.add(automaticallyAttachFalse); - + automaticallyAttachGroup .addValueChangeHandler(new ValueChangeHandler>() { @@ -120,9 +132,9 @@ public class ExtractCodelistDetailsCard extends WizardCard { ValueChangeEvent> event) { try { if (automaticallyAttachTrue.getValue()) { - attachToColumnField.setVisible(true); + comboAttachToColumnLabel.setVisible(true); } else { - attachToColumnField.setVisible(false); + comboAttachToColumnLabel.setVisible(false); } thisCard.forceLayout(); @@ -139,10 +151,10 @@ public class ExtractCodelistDetailsCard extends WizardCard { automaticallyAttachPanel.add(automaticallyAttachTrue); automaticallyAttachPanel.add(automaticallyAttachFalse); - FieldLabel fieldAttach = new FieldLabel(automaticallyAttachPanel, - "Attach"); - fieldAttach.setToolTip("Select true if you want automatically attach the generated codelist"); - p.add(fieldAttach, new VerticalLayoutData(-1, -1, new Margins(0))); + FieldLabel attachFieldLabel = new FieldLabel(automaticallyAttachPanel, + msgs.attachFieldLabel()); + attachFieldLabel.setToolTip(msgs.attachFieldToolTip()); + p.add(attachFieldLabel, new VerticalLayoutData(-1, -1, new Margins(0))); // // @@ -159,16 +171,16 @@ public class ExtractCodelistDetailsCard extends WizardCard { Log.trace("Combo AttachToColumn created"); addHandlersForComboAttachToColumn(propsColumnData.label()); - comboAttachToColumn.setEmptyText("Select a column..."); + comboAttachToColumn.setEmptyText(msgs.comboAttachToColumnEmptyText()); comboAttachToColumn.setWidth(191); comboAttachToColumn.setTypeAhead(false); comboAttachToColumn.setEditable(false); comboAttachToColumn.setTriggerAction(TriggerAction.ALL); - attachToColumnField = new FieldLabel(comboAttachToColumn, - "Attach To Column"); - attachToColumnField.setToolTip("Select the column to be attached to extraced codelist"); - p.add(attachToColumnField, - new VerticalLayoutData(1, -1, new Margins(0))); + comboAttachToColumnLabel = new FieldLabel(comboAttachToColumn, + msgs.comboAttachToColumnLabel()); + comboAttachToColumnLabel.setToolTip(msgs.comboAttachToColumnToolTip()); + p.add(comboAttachToColumnLabel, new VerticalLayoutData(1, -1, + new Margins(0))); // / tableDetailPanel.add(form); @@ -186,13 +198,6 @@ public class ExtractCodelistDetailsCard extends WizardCard { comboAttachToColumn .addSelectionHandler(new SelectionHandler() { public void onSelection(SelectionEvent event) { - Info.display( - "Column Selected", - "You selected " - + (event.getSelectedItem() == null ? "nothing" - : label.getLabel(event - .getSelectedItem()) - + "!")); Log.debug("ComboAttachToColumn selected: " + event.getSelectedItem()); ColumnData column = event.getSelectedItem(); @@ -249,25 +254,26 @@ public class ExtractCodelistDetailsCard extends WizardCard { } }; - if (name.getValue() == null || name.getValue().isEmpty() - || !name.isValid()) { - d = new AlertMessageBox("Attention!", "Fill name fields"); + if (nameField.getValue() == null || nameField.getValue().isEmpty() + || !nameField.isValid()) { + d = new AlertMessageBox(msgsCommon.attention(), + msgs.attentionFillNameField()); d.addHideHandler(hideHandler); d.show(); } else { if (getAutomaticallyAttach()) { attachColumn = comboAttachToColumn.getCurrentValue(); if (attachColumn == null) { - d = new AlertMessageBox("Attention!", - "Select column to attach codelist!"); + d = new AlertMessageBox(msgsCommon.attention(), + msgs.attentionSelectColumnToAttachCodelist()); d.addHideHandler(hideHandler); d.show(); } else { - name.setReadOnly(true); + nameField.setReadOnly(true); goNext(); } } else { - name.setReadOnly(true); + nameField.setReadOnly(true); goNext(); } } @@ -284,7 +290,7 @@ public class ExtractCodelistDetailsCard extends WizardCard { protected void goNext() { try { detail = new TabResource(); - detail.setName(name.getCurrentValue()); + detail.setName(nameField.getCurrentValue()); extractCodelistSession.setTabResource(detail); extractCodelistSession @@ -297,7 +303,7 @@ public class ExtractCodelistDetailsCard extends WizardCard { getWizardWindow().nextCard(); } catch (Exception e) { Log.error("sayNextCard :" + e.getLocalizedMessage()); - name.setReadOnly(false); + nameField.setReadOnly(false); } } diff --git a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages.java new file mode 100644 index 0000000..165eed9 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages.java @@ -0,0 +1,139 @@ +package org.gcube.portlets.user.td.extractcodelistwidget.client; + +import com.google.gwt.i18n.client.Messages; + +/** + * + * @author giancarlo email: g.panichi@isti.cnr.it + * + */ +public interface ExtractCodelistMessages extends Messages { + + @DefaultMessage("Extract Codelist") + String extractCodelistWizardHead(); + + @DefaultMessage("Codelist Detail") + String extractCodelistDetailCardHead(); + + @DefaultMessage("Details") + String extractCodelistDetailsCardFormHead(); + + @DefaultMessage("Information") + String infoFieldSetHead(); + + @DefaultMessage("Enter a name...") + String nameFieldEmptyText(); + + @DefaultMessage("Name") + String nameFieldLabel(); + + @DefaultMessage("Enter the name of new codelist extracted") + String nameFieldToolTip(); + + @DefaultMessage("True") + String automaticallyAttachTrueLabel(); + + @DefaultMessage("False") + String automaticallyAttachFalseLabel(); + + @DefaultMessage("Attach") + String attachFieldLabel(); + + @DefaultMessage("Select true if you want automatically attach the generated codelist") + String attachFieldToolTip(); + + @DefaultMessage("Select a column...") + String comboAttachToColumnEmptyText(); + + @DefaultMessage("Attach To Column") + String comboAttachToColumnLabel(); + + @DefaultMessage("Select the column to be attached to extracted codelist") + String comboAttachToColumnToolTip(); + + @DefaultMessage("Fill name fields!") + String attentionFillNameField(); + + @DefaultMessage("Select column to attach codelist!") + String attentionSelectColumnToAttachCodelist(); + + @DefaultMessage("Source Column") + String sourceColumnsSelectionCardHead(); + + @DefaultMessage("No column selected!") + String attentionNoColumnSelected(); + + @DefaultMessage("Target Column") + String targetColumnsSelectionCardHead(); + + @DefaultMessage("Connect Codelist") + String btnConnectTitle(); + + @DefaultMessage("Disconnect Codelist") + String btnDisconnectTitle(); + + @DefaultMessage("Select a Column...") + String comboDefNewColumnEmptyText(); + + @DefaultMessage("Select a new column...") + String comboReferenceDefColumnEmptyText(); + + @DefaultMessage("Select from Codelist...") + String comboColumnEmptyText(); + + @DefaultMessage("New") + String checkNewLabel(); + + @DefaultMessage("Error retrieving columns on server.") + String errorRetrievingColumnsFixed(); + + @DefaultMessage("Error creating form!") + String errorCreatingForm(); + + @DefaultMessage("Error creating form for check radio!") + String errorCreatingFormForCheckRadio(); + + @DefaultMessage("Fill all column!") + String attentionFillAllColumn(); + + @DefaultMessage("An error occurred in extract codelist.") + String errorInExtractCodelistFixed(); + + @DefaultMessage("An error occurred setting collateral table final.") + String errorAnErrorOccurredSettingCollateralTableFinalFixed(); + + @DefaultMessage("No collateral id retrieved") + String errorNoCollateralIdRetrieved(); + + @DefaultMessage("Collateral id is null") + String errorCollateralIdIsNull(); + + @DefaultMessage("An error occurred retrieving column on collateral table.") + String errorAnErrorOccurredRetrievingColumnOnCollateralTableFixed(); + + @DefaultMessage("An error occured no label retrieved for attach column") + String errorAnErrorOccurredNoLabelRetrievedForAttachColumnFixed(); + + @DefaultMessage("No label retrieved for attach column") + String errorNoLabelRetrievedForAttachColumn(); + + @DefaultMessage("An error occurred no attach column match") + String errorAnErrorOccurredNoAttachColumnMatchFixed(); + + @DefaultMessage("No attach column match") + String errorNoAttachColumnMatch(); + + @DefaultMessage("An error occurred on start change column type.") + String errorAnErrorOccurredOnStartChangeColumnTypeFixed(); + + @DefaultMessage("The Codelists is available in the list of yours tabular resources") + String codelistAvailableInResources(); + + @DefaultMessage("Columns") + String columns(); + + @DefaultMessage("No column loaded: ") + String errorNoColumnLoadedFixed(); + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistOperationInProgressCard.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistOperationInProgressCard.java index e057d76..1427ee9 100644 --- a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistOperationInProgressCard.java +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistOperationInProgressCard.java @@ -12,6 +12,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistTarge import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession; 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; @@ -22,6 +23,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeC 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; @@ -40,6 +42,8 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou */ public class ExtractCodelistOperationInProgressCard extends WizardCard implements MonitorDialogListener { + private static CommonMessages msgsCommon = GWT.create(CommonMessages.class); + private ExtractCodelistMessages msgs; @SuppressWarnings("unused") private ExtractCodelistOperationInProgressCard thisCard; @@ -52,12 +56,14 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard public ExtractCodelistOperationInProgressCard( final ExtractCodelistSession extractCodelistSession) { - super("Operation In Progress", ""); + super(msgsCommon.operationInProgress(), ""); this.extractCodelistSession = extractCodelistSession; thisCard = this; automaticallyAttached = false; + initMessages(); + VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer(); operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.LEFT); @@ -71,6 +77,11 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard } + protected void initMessages() { + msgs = GWT.create(ExtractCodelistMessages.class); + + } + public void extractCodelist() { TDGWTServiceAsync.INSTANCE.startExtractCodelist(extractCodelistSession, new AsyncCallback() { @@ -87,8 +98,8 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - showErrorAndHide("Error in extract codelist", - "An error occured in extract codelist.", + showErrorAndHide(msgsCommon.error(), + msgs.errorInExtractCodelistFixed(), caught.getLocalizedMessage(), caught); return; } @@ -99,22 +110,24 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard public void setCollateralTRIdFinal(ArrayList collateralIds) { if (collateralIds == null || collateralIds.isEmpty()) { monitorDialog.hide(); - showErrorAndHide("Error in extract codelist", - "An error occured setting collateral table final.", - "No collateral id retrieved", new Throwable( - "No collateral id retrieved")); - + showErrorAndHide( + msgsCommon.error(), + msgs.errorAnErrorOccurredSettingCollateralTableFinalFixed(), + msgs.errorNoCollateralIdRetrieved(), + new Throwable(msgs.errorNoCollateralIdRetrieved())); + return; - + } collateralTRId = collateralIds.get(0); if (collateralTRId == null) { monitorDialog.hide(); - showErrorAndHide("Error in extract codelist", - "An error occured setting collateral table final.", - "Collateral id is null", new Throwable( - "Collateral id is null")); - + showErrorAndHide( + msgsCommon.error(), + msgs.errorAnErrorOccurredSettingCollateralTableFinalFixed(), + msgs.errorCollateralIdIsNull(), + new Throwable(msgs.errorCollateralIdIsNull())); + return; } @@ -136,8 +149,8 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard SessionExpiredType.EXPIREDONSERVER)); } else { showErrorAndHide( - "Error in extract codelist", - "An error occured setting collateral table final.", + msgsCommon.error(), + msgs.errorAnErrorOccurredSettingCollateralTableFinalFixed(), caught.getLocalizedMessage(), caught); } } @@ -158,8 +171,8 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard SessionExpiredType.EXPIREDONSERVER)); } else { showErrorAndHide( - "Error in extract codelist", - "An error occured retrieving column on collateral table.", + msgsCommon.error(), + msgs.errorAnErrorOccurredRetrievingColumnOnCollateralTableFixed(), caught.getLocalizedMessage(), caught); } } @@ -193,8 +206,8 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard labelOfAttachColumn = targetCol.getTargetColumn() .getLabel(); typeCodeOfColumnAttach = ColumnTypeCode - .getColumnTypeCodeFromId(targetCol.getTargetColumn() - .getTypeCode()); + .getColumnTypeCodeFromId(targetCol + .getTargetColumn().getTypeCode()); } break; } @@ -203,17 +216,18 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard ColumnData codelistColumnReference = null; if (labelOfAttachColumn == null) { - showErrorAndHide("Error in extract codelist", - "An error occured no label retrieved for attach column", - "No label retrieved for attach column", new Throwable( - "No label retrieved for attach column")); + showErrorAndHide( + msgsCommon.error(), + msgs.errorAnErrorOccurredNoLabelRetrievedForAttachColumnFixed(), + msgs.errorNoLabelRetrievedForAttachColumn(), new Throwable( + msgs.errorNoLabelRetrievedForAttachColumn())); return; } else { for (ColumnData refColumn : refColumns) { if (refColumn.getLabel().compareTo(labelOfAttachColumn) == 0) { - if (ColumnTypeCode - .getColumnTypeCodeFromId(refColumn.getTypeCode()) - .compareTo(typeCodeOfColumnAttach) == 0) { + if (ColumnTypeCode.getColumnTypeCodeFromId( + refColumn.getTypeCode()).compareTo( + typeCodeOfColumnAttach) == 0) { codelistColumnReference = refColumn; break; } else { @@ -231,10 +245,10 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard columnTypeCodeTarget, null, codelistColumnReference); callChangeColumnType(changeColumnTypeSession); } else { - showErrorAndHide("Error in extract codelist", - "An error occured no attach column match", - "No attach column match", new Throwable( - "No attach column match")); + showErrorAndHide(msgsCommon.error(), + msgs.errorAnErrorOccurredNoAttachColumnMatchFixed(), + msgs.errorNoAttachColumnMatch(), + new Throwable(msgs.errorNoAttachColumnMatch())); } } @@ -250,8 +264,8 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard SessionExpiredType.EXPIREDONSERVER)); } else { showErrorAndHide( - "Error in extract codelist", - "An error occured on start change column type.", + msgsCommon.error(), + msgs.errorAnErrorOccurredOnStartChangeColumnTypeFixed(), caught.getLocalizedMessage(), caught); } } @@ -300,8 +314,11 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard protected void updateOnComplete() { SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); safeHtmlBuilder - .appendHtmlConstant("
Operation Completed
" - + "
The Codelists is available in the list of yours tabular resources
"); + .appendHtmlConstant("
" + + msgsCommon.operationCompleted() + + "
" + + "
" + + msgs.codelistAvailableInResources() + "
"); resultField.setHTML(safeHtmlBuilder.toSafeHtml()); resultField.setVisible(true); Command sayComplete = new Command() { @@ -329,7 +346,8 @@ public class ExtractCodelistOperationInProgressCard 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) { @@ -338,8 +356,7 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - showErrorAndHide("Error in Extract Codelist", reason, details, - caught); + showErrorAndHide(msgsCommon.error(), reason, details, caught); } forceLayout(); @@ -351,7 +368,8 @@ public class ExtractCodelistOperationInProgressCard 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); @@ -382,7 +400,8 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard public void operationAborted() { SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); safeHtmlBuilder - .appendHtmlConstant("
Operation Aborted
"); + .appendHtmlConstant("
" + + msgsCommon.operationAborted() + "
"); resultField.setHTML(safeHtmlBuilder.toSafeHtml()); resultField.setVisible(true); @@ -412,7 +431,8 @@ public class ExtractCodelistOperationInProgressCard 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/extractcodelistwidget/client/ExtractCodelistWizardTD.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistWizardTD.java index 347c82f..a36b366 100644 --- a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistWizardTD.java +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistWizardTD.java @@ -1,44 +1,33 @@ package org.gcube.portlets.user.td.extractcodelistwidget.client; - - import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow; import com.google.web.bindery.event.shared.EventBus; - - /** * */ -public class ExtractCodelistWizardTD extends WizardWindow { +public class ExtractCodelistWizardTD extends WizardWindow { - protected ExtractCodelistSession exportSession; - protected TRId trId; + private ExtractCodelistSession exportSession; - - /** * * @param title * @param eventBus */ - public ExtractCodelistWizardTD(TRId trId,String title, EventBus eventBus) { - super(title,eventBus); - this.trId=trId; - - exportSession= new ExtractCodelistSession(); + public ExtractCodelistWizardTD(TRId trId, String title, EventBus eventBus) { + super(title, eventBus); + + exportSession = new ExtractCodelistSession(); exportSession.setTrId(trId); - SourceColumnsSelectionCard sourceColumnsSelectionCard=new SourceColumnsSelectionCard(exportSession); + SourceColumnsSelectionCard sourceColumnsSelectionCard = new SourceColumnsSelectionCard( + exportSession); addCard(sourceColumnsSelectionCard); sourceColumnsSelectionCard.setup(); - - + } - - - - + } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistWizardTDEntry.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistWizardTDEntry.java index f18c59a..98cbe68 100644 --- a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistWizardTDEntry.java +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistWizardTDEntry.java @@ -4,20 +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 ExtractCodelistWizardTDEntry implements EntryPoint { +public class ExtractCodelistWizardTDEntry implements EntryPoint { + + private ExtractCodelistMessages msgs; - public void onModuleLoad() { - SimpleEventBus eventBus=new SimpleEventBus(); - TRId trId=new TRId("10"); - ExtractCodelistWizardTD extractWizard= new ExtractCodelistWizardTD(trId,"ExtractCodelist",eventBus); + initMessages(); + SimpleEventBus eventBus = new SimpleEventBus(); + TRId trId = new TRId("10"); + ExtractCodelistWizardTD extractWizard = new ExtractCodelistWizardTD( + trId, msgs.extractCodelistWizardHead(), eventBus); Log.info(extractWizard.getId()); } + + protected void initMessages() { + msgs = GWT.create(ExtractCodelistMessages.class); + } + } diff --git a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/SourceColumnsSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/SourceColumnsSelectionCard.java index 2c09ce1..27c504c 100644 --- a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/SourceColumnsSelectionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/SourceColumnsSelectionCard.java @@ -1,14 +1,15 @@ package org.gcube.portlets.user.td.extractcodelistwidget.client; - import java.util.ArrayList; import org.gcube.portlets.user.td.extractcodelistwidget.client.grid.ColumnDataGridPanel; import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession; +import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages; 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.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; @@ -19,33 +20,37 @@ 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.FormPanel; - - /** * - * @author "Giancarlo Panichi" + * @author giancarlo email: g.panichi@isti.cnr.it * */ public class SourceColumnsSelectionCard extends WizardCard { + private static ExtractCodelistMessages msgs = GWT + .create(ExtractCodelistMessages.class); + private CommonMessages msgsCommon; + private ExtractCodelistSession extractCodelistSession; + private ColumnDataGridPanel columnsGridPanel; - - protected ExtractCodelistSession extractCodelistSession; - protected ColumnDataGridPanel columnsGridPanel; - - public SourceColumnsSelectionCard(final ExtractCodelistSession extractCodelistSession) { - super("Source Column", ""); - + public SourceColumnsSelectionCard( + final ExtractCodelistSession extractCodelistSession) { + super(msgs.sourceColumnsSelectionCardHead(), ""); if (extractCodelistSession == null) { Log.error("ExtractCodelistSession is null"); } this.extractCodelistSession = extractCodelistSession; - FormPanel panel = createPanel(); - setContent(panel); + initMessages(); + createPanel(); } - protected FormPanel createPanel() { + protected void initMessages() { + msgsCommon = GWT.create(CommonMessages.class); + } + + protected void createPanel() { FormPanel panel = new FormPanel(); panel.setLabelWidth(90); panel.getElement().setPadding(new Padding(5)); @@ -66,10 +71,9 @@ public class SourceColumnsSelectionCard extends WizardCard { content.add(columnsGridPanel); - return panel; - } + setContent(panel); - + } @Override public void setup() { @@ -85,7 +89,9 @@ public class SourceColumnsSelectionCard extends WizardCard { getWizardWindow().setNextButtonCommand(sayNextCard); setEnableBackButton(false); + setBackButtonVisible(false); setEnableNextButton(true); + setNextButtonVisible(true); } protected void checkData() { @@ -103,7 +109,8 @@ public class SourceColumnsSelectionCard extends WizardCard { ArrayList columns = columnsGridPanel.getSelectedItems(); if (columns.size() == 0) { - d = new AlertMessageBox("Attention", "No columns selected"); + d = new AlertMessageBox(msgsCommon.attention(), + msgs.attentionNoColumnSelected()); d.addHideHandler(hideHandler); d.setModal(false); d.show(); @@ -122,6 +129,7 @@ public class SourceColumnsSelectionCard extends WizardCard { getWizardWindow().nextCard(); } catch (Exception e) { Log.error("sayNextCard :" + e.getLocalizedMessage()); + e.printStackTrace(); } } @@ -131,4 +139,3 @@ public class SourceColumnsSelectionCard extends WizardCard { } } - diff --git a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/TargetColumnsSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/TargetColumnsSelectionCard.java index 71e5c70..a40a56d 100644 --- a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/TargetColumnsSelectionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/TargetColumnsSelectionCard.java @@ -4,22 +4,33 @@ import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSessi 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; +/** + * + * @author giancarlo email: g.panichi@isti.cnr.it + * + */ public class TargetColumnsSelectionCard extends WizardCard { - private TargetColumnsSelectionCard thisCard; - protected ExtractCodelistSession extractCodelistSession; - protected TargetColumnsSelectionPanel targetColumnsSelectionPanel; + private static ExtractCodelistMessages msgs = GWT + .create(ExtractCodelistMessages.class); - public TargetColumnsSelectionCard(final ExtractCodelistSession extractCodelistSession) { - super("Target Column", ""); - thisCard=this; + private TargetColumnsSelectionCard thisCard; + private ExtractCodelistSession extractCodelistSession; + private TargetColumnsSelectionPanel targetColumnsSelectionPanel; + + public TargetColumnsSelectionCard( + final ExtractCodelistSession extractCodelistSession) { + super(msgs.targetColumnsSelectionCardHead(), ""); + thisCard = this; if (extractCodelistSession == null) { Log.error("ExtractCodelistSession is null"); } this.extractCodelistSession = extractCodelistSession; - - targetColumnsSelectionPanel =new TargetColumnsSelectionPanel(this); + + targetColumnsSelectionPanel = new TargetColumnsSelectionPanel(this); setContent(targetColumnsSelectionPanel); } @@ -36,8 +47,7 @@ public class TargetColumnsSelectionCard extends WizardCard { }; getWizardWindow().setNextButtonCommand(sayNextCard); - - + Command sayPreviousCard = new Command() { public void execute() { try { @@ -51,15 +61,18 @@ public class TargetColumnsSelectionCard extends WizardCard { }; getWizardWindow().setPreviousButtonCommand(sayPreviousCard); - + setEnableBackButton(true); + setBackButtonVisible(true); setEnableNextButton(true); + setNextButtonVisible(true); + } protected void checkData() { getWizardWindow().setEnableNextButton(false); getWizardWindow().setEnableBackButton(false); - if(targetColumnsSelectionPanel.updateExtractCodelistSession()){ + if (targetColumnsSelectionPanel.updateExtractCodelistSession()) { goNext(); } else { getWizardWindow().setEnableNextButton(true); @@ -69,10 +82,12 @@ public class TargetColumnsSelectionCard extends WizardCard { protected void goNext() { try { - ExtractCodelistDetailsCard destCard= new ExtractCodelistDetailsCard( + ExtractCodelistDetailsCard destCard = new ExtractCodelistDetailsCard( extractCodelistSession); - /*ExtractCodelistOperationInProgressCard destCard = new ExtractCodelistOperationInProgressCard( - extractCodelistSession);*/ + /* + * ExtractCodelistOperationInProgressCard destCard = new + * ExtractCodelistOperationInProgressCard( extractCodelistSession); + */ Log.info("NextCard ExtractCodelistOperationInProgressCard"); getWizardWindow().addCard(destCard); getWizardWindow().nextCard(); @@ -86,5 +101,12 @@ public class TargetColumnsSelectionCard extends WizardCard { } - + /** + * + * @return + */ + public ExtractCodelistSession getExtractCodelistSession() { + return extractCodelistSession; + } + } diff --git a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/TargetColumnsSelectionPanel.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/TargetColumnsSelectionPanel.java index f40128b..c3e3bcc 100644 --- a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/TargetColumnsSelectionPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/TargetColumnsSelectionPanel.java @@ -15,6 +15,7 @@ import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectio import org.gcube.portlets.user.td.columnwidget.client.properties.ExtractCodelistDefColumnPropertiesCombo; import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; +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.tr.TableType; @@ -70,6 +71,9 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements private static final int LABEL_SIZE_IN_CHAR = 17; private static final int COMBOWIDTH = 270; + private CommonMessages msgsCommon; + private ExtractCodelistMessages msgs; + private TargetColumnsSelectionCard parent; private TabResource connection; private ArrayList connectionColumns; @@ -90,11 +94,17 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements this.parent = parent; connection = null; Log.debug("Create TargetColumnsSelectionPanel()"); + initMessages(); init(); create(); } + protected void initMessages() { + msgs = GWT.create(ExtractCodelistMessages.class); + msgsCommon = GWT.create(CommonMessages.class); + } + protected void init() { setWidth(WIDTH); setHeight(HEIGHT); @@ -109,7 +119,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements btnConnect = new TextButton(); btnConnect.setIcon(ResourceBundle.INSTANCE.codelistLink24()); btnConnect.setIconAlign(IconAlign.TOP); - btnConnect.setTitle("Connect Codelist"); + btnConnect.setTitle(msgs.btnConnectTitle()); btnConnect.addSelectHandler(new SelectHandler() { public void onSelect(SelectEvent event) { @@ -127,7 +137,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements btnDisconnect = new TextButton(); btnDisconnect.setIcon(ResourceBundle.INSTANCE.codelistLinkBreak24()); btnDisconnect.setIconAlign(IconAlign.TOP); - btnDisconnect.setTitle("Disconnect Codelist"); + btnDisconnect.setTitle(msgs.btnDisconnectTitle()); btnDisconnect.addSelectHandler(new SelectHandler() { public void onSelect(SelectEvent event) { @@ -148,7 +158,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements form.setHeight(FIELDSHEIGHT); formLayout = new VerticalLayoutContainer(); - //formLayout.setScrollMode(ScrollMode.AUTO); + // formLayout.setScrollMode(ScrollMode.AUTO); formLayout.setAdjustForScroll(true); ArrayList fields = generateFields(); @@ -160,8 +170,8 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements form.add(formLayout); VerticalLayoutContainer v = new VerticalLayoutContainer(); - //v.setHeight(HEIGHT); - //v.setWidth(WIDTH); + // v.setHeight(HEIGHT); + // v.setWidth(WIDTH); v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0))); v.add(form, new VerticalLayoutData(1, -1, new Margins(0))); @@ -178,7 +188,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements protected ArrayList generateFields() { ArrayList fields = new ArrayList(); int i = 0; - for (ColumnData sourceCol : parent.extractCodelistSession + for (ColumnData sourceCol : parent.getExtractCodelistSession() .getSourceColumns()) { String label = new String(); if (sourceCol != null && sourceCol.getLabel() != null) { @@ -186,7 +196,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements if (label.length() > LABEL_SIZE_IN_CHAR + 2) { label = label.substring(0, LABEL_SIZE_IN_CHAR); label += "..."; - } + } } if (connection == null) { @@ -213,14 +223,14 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements // comboDefColumn ExtractCodelistDefColumnPropertiesCombo props = GWT .create(ExtractCodelistDefColumnPropertiesCombo.class); - ListStore storeComboDefColumn = new ListStore( + ListStore storeComboDefNewColumn = new ListStore( props.id()); - final ComboBox comboDefColumn = new ComboBox( - storeComboDefColumn, props.label()); + final ComboBox comboDefNewColumn = new ComboBox( + storeComboDefNewColumn, props.label()); Log.debug("ComboDefColumn created"); - final CreateDefColumnListener createDefColumnListener = new CreateDefColumnListener() { + final CreateDefColumnListener createDefNewColumnListener = new CreateDefColumnListener() { @Override public void failedDefColumnCreation(String reason, String details) { @@ -230,7 +240,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements @Override public void completedDefColumnCreation(ColumnMockUp columnMockUp) { - comboDefColumn.setValue(columnMockUp, true); + comboDefNewColumn.setValue(columnMockUp, true); } @@ -241,47 +251,49 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements } }; - comboDefColumn.addTriggerClickHandler(new TriggerClickHandler() { + comboDefNewColumn.addTriggerClickHandler(new TriggerClickHandler() { @Override public void onTriggerClick(TriggerClickEvent event) { Log.debug("ComboDefColumn TriggerClickEvent"); - comboDefColumn.collapse(); + comboDefNewColumn.collapse(); - CreateDefColumnDialog createDefColumnDialog = new CreateDefColumnDialog( + CreateDefColumnDialog createDefNewColumnDialog = new CreateDefColumnDialog( TableType.CODELIST, parent.getEventBus()); - createDefColumnDialog.addListener(createDefColumnListener); - createDefColumnDialog.show(); + createDefNewColumnDialog + .addListener(createDefNewColumnListener); + createDefNewColumnDialog.show(); } }); - comboDefColumn.setEmptyText("Select a Column..."); - comboDefColumn.setWidth(COMBOWIDTH); - comboDefColumn.setEditable(false); - comboDefColumn.setTriggerAction(TriggerAction.ALL); + comboDefNewColumn.setEmptyText(msgs.comboDefNewColumnEmptyText()); + comboDefNewColumn.setWidth(COMBOWIDTH); + comboDefNewColumn.setEditable(false); + comboDefNewColumn.setTriggerAction(TriggerAction.ALL); - FieldLabel columnLabel = new FieldLabel(comboDefColumn, label); - columnLabel.setId(col.getColumnId()); - return columnLabel; + FieldLabel comboDefNewColumnLabel = new FieldLabel(comboDefNewColumn, + label); + comboDefNewColumnLabel.setId(col.getColumnId()); + return comboDefNewColumnLabel; } protected FieldLabel retrieveReferenceColumnLabel(int index, final ColumnData col, String label) { - // comboDefColumn + // comboReferenceDefColumn ExtractCodelistDefColumnPropertiesCombo props = GWT .create(ExtractCodelistDefColumnPropertiesCombo.class); - ListStore storeComboDefColumn = new ListStore( + ListStore storeComboReferenceDefColumn = new ListStore( props.id()); - final ComboBox comboDefColumn = new ComboBox( - storeComboDefColumn, props.label()); - comboDefColumn.setItemId(COMBO_DEF_COLUMN); + final ComboBox comboReferenceDefColumn = new ComboBox( + storeComboReferenceDefColumn, props.label()); + comboReferenceDefColumn.setItemId(COMBO_DEF_COLUMN); Log.debug("ComboDefColumn created"); - final CreateDefColumnListener createDefColumnListener = new CreateDefColumnListener() { + final CreateDefColumnListener createReferenceDefColumnListener = new CreateDefColumnListener() { @Override public void failedDefColumnCreation(String reason, String details) { @@ -291,7 +303,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements @Override public void completedDefColumnCreation(ColumnMockUp columnMockUp) { - comboDefColumn.setValue(columnMockUp, true); + comboReferenceDefColumn.setValue(columnMockUp, true); } @@ -302,26 +314,29 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements } }; - comboDefColumn.addTriggerClickHandler(new TriggerClickHandler() { + comboReferenceDefColumn + .addTriggerClickHandler(new TriggerClickHandler() { - @Override - public void onTriggerClick(TriggerClickEvent event) { - Log.debug("ComboDefColumn TriggerClickEvent"); - comboDefColumn.collapse(); + @Override + public void onTriggerClick(TriggerClickEvent event) { + Log.debug("ComboDefColumn TriggerClickEvent"); + comboReferenceDefColumn.collapse(); - CreateDefColumnDialog createDefColumnDialog = new CreateDefColumnDialog( - TableType.CODELIST, parent.getEventBus()); - createDefColumnDialog.addListener(createDefColumnListener); - createDefColumnDialog.show(); + CreateDefColumnDialog createReferenceDefColumnDialog = new CreateDefColumnDialog( + TableType.CODELIST, parent.getEventBus()); + createReferenceDefColumnDialog + .addListener(createReferenceDefColumnListener); + createReferenceDefColumnDialog.show(); - } + } - }); + }); - comboDefColumn.setEmptyText("Select a new column..."); - comboDefColumn.setWidth(COMBOWIDTH); - comboDefColumn.setEditable(false); - comboDefColumn.setTriggerAction(TriggerAction.ALL); + comboReferenceDefColumn.setEmptyText(msgs + .comboReferenceDefColumnEmptyText()); + comboReferenceDefColumn.setWidth(COMBOWIDTH); + comboReferenceDefColumn.setEditable(false); + comboReferenceDefColumn.setTriggerAction(TriggerAction.ALL); // comboColumn ColumnDataPropertiesCombo propsCod = GWT @@ -336,7 +351,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements Log.debug("ComboColumn created"); - comboColumn.setEmptyText("Select from Codelist..."); + comboColumn.setEmptyText(msgs.comboColumnEmptyText()); comboColumn.setWidth(COMBOWIDTH); comboColumn.setEditable(false); comboColumn.setTriggerAction(TriggerAction.ALL); @@ -344,18 +359,18 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements CheckBox checkNew = new CheckBox(); checkNew.setItemId(CHECK_NEW); checkNew.setEnabled(true); - checkNew.setBoxLabel("New"); + checkNew.setBoxLabel(msgs.checkNewLabel()); checkNew.addValueChangeHandler(new ValueChangeHandler() { @Override public void onValueChange(ValueChangeEvent event) { if (event.getValue()) { comboColumn.setVisible(false); - comboDefColumn.setVisible(true); + comboReferenceDefColumn.setVisible(true); forceLayout(); } else { comboColumn.setVisible(true); - comboDefColumn.setVisible(false); + comboReferenceDefColumn.setVisible(false); forceLayout(); } @@ -365,16 +380,16 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements HBoxLayoutContainer flowButton = new HBoxLayoutContainer(); flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); flowButton.setPack(BoxLayoutPack.START); - - BoxLayoutData boxLayoutData=new BoxLayoutData(new Margins(2, 4, 2, 4)); + + BoxLayoutData boxLayoutData = new BoxLayoutData(new Margins(2, 4, 2, 4)); flowButton.add(checkNew, boxLayoutData); flowButton.add(comboColumn, boxLayoutData); - flowButton.add(comboDefColumn, boxLayoutData); + flowButton.add(comboReferenceDefColumn, boxLayoutData); FieldLabel columnLabel = new FieldLabel(flowButton, label); columnLabel.setId(col.getColumnId()); - comboDefColumn.setVisible(false); - + comboReferenceDefColumn.setVisible(false); + return columnLabel; } @@ -416,7 +431,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements @Override public void failed(String reason, String detail) { Log.debug("Connection Failed: " + reason + " " + detail); - UtilsGXT3.alert("Error on connect", reason); + UtilsGXT3.alert(msgsCommon.error(), reason); btnConnect.enable(); } @@ -435,13 +450,16 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements } else { if (caught instanceof TDGWTIsLockedException) { Log.error(caught.getLocalizedMessage()); - parent.showErrorAndHide("Error Locked", - caught.getLocalizedMessage(), "", caught); + parent.showErrorAndHide( + msgsCommon.errorLocked(), + caught.getLocalizedMessage(), "", + caught); } else { Log.debug("Error retrieving columns: " + caught.getLocalizedMessage()); - parent.showErrorAndHide("Error retrieving columns", - "Error retrieving columns on server.",caught.getLocalizedMessage(), caught); + parent.showErrorAndHide(msgsCommon.error(), + msgs.errorRetrievingColumnsFixed(), + caught.getLocalizedMessage(), caught); } } } @@ -470,7 +488,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements protected void updatedForm() { form.clear(); formLayout = new VerticalLayoutContainer(); - //formLayout.setScrollMode(ScrollMode.AUTO); + // formLayout.setScrollMode(ScrollMode.AUTO); formLayout.setAdjustForScroll(true); ArrayList fields = generateFields(); @@ -494,7 +512,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements String columnId = fieldLabel.getId(); Log.debug("Field id:" + columnId); ColumnData colCurrent = null; - for (ColumnData col : parent.extractCodelistSession + for (ColumnData col : parent.getExtractCodelistSession() .getSourceColumns()) { if (col.getColumnId().compareTo(columnId) == 0) { colCurrent = col; @@ -503,7 +521,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements } } if (colCurrent == null) { - UtilsGXT3.alert("Error creating form", "Error creating form!"); + UtilsGXT3.alert(msgsCommon.error(), msgs.errorCreatingForm()); return false; } @@ -524,8 +542,8 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements CheckBox checkNew = (CheckBox) flowButton .getItemByItemId(CHECK_NEW); if (checkNew == null) { - UtilsGXT3.alert("Error creating form", - "Error creating form for check radio!"); + UtilsGXT3.alert(msgsCommon.error(), + msgs.errorCreatingFormForCheckRadio()); return false; } @@ -545,7 +563,8 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements .getItemByItemId(COMBO_COLUMN); ColumnData columnData = comboColumn.getCurrentValue(); if (columnData == null) { - UtilsGXT3.alert("Attention", "Fill all column!"); + UtilsGXT3.alert(msgsCommon.attention(), + msgs.attentionFillAllColumn()); return false; } else { ExtractCodelistTargetColumn extractCodelistTargetC = new ExtractCodelistTargetColumn( @@ -559,7 +578,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements } Log.debug("UpdateExtractCodelistSession:" + targetColumns); - parent.extractCodelistSession.setTargetColumns(targetColumns); + parent.getExtractCodelistSession().setTargetColumns(targetColumns); return true; } diff --git a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/grid/ColumnDataGridPanel.java b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/grid/ColumnDataGridPanel.java index d97cdff..5ac5c26 100644 --- a/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/grid/ColumnDataGridPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/extractcodelistwidget/client/grid/ColumnDataGridPanel.java @@ -3,9 +3,11 @@ package org.gcube.portlets.user.td.extractcodelistwidget.client.grid; import java.util.ArrayList; import java.util.List; +import org.gcube.portlets.user.td.extractcodelistwidget.client.ExtractCodelistMessages; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; +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.tr.column.ColumnData; @@ -49,20 +51,21 @@ import com.sencha.gxt.widget.core.client.grid.Grid; public class ColumnDataGridPanel extends ContentPanel implements HasSelectionHandlers { private static final int GRIDHEIGHT = 360; - private static final ColumnDataProperties props = GWT .create(ColumnDataProperties.class); - private final CheckBoxSelectionModel sm; - private final Grid grid; - + + private ExtractCodelistMessages msgs; + private CommonMessages msgsCommon; private WizardCard parent; - + public ColumnDataGridPanel(WizardCard parent) { this.parent = parent; Log.debug("ColumnDataGridPanel"); - setHeadingText("Columns"); + initMessages(); + + setHeadingText(msgs.columns()); ColumnConfig labelCol = new ColumnConfig( props.label()); @@ -125,7 +128,12 @@ public class ColumnDataGridPanel extends ContentPanel implements setWidget(con); } - + + protected void initMessages(){ + msgsCommon = GWT.create(CommonMessages.class); + msgs = GWT.create(ExtractCodelistMessages.class); + } + public Grid getGrid() { return grid; } @@ -144,12 +152,12 @@ public class ColumnDataGridPanel extends ContentPanel implements } else { if (caught instanceof TDGWTIsLockedException) { Log.error(caught.getLocalizedMessage()); - UtilsGXT3.alert("Error Locked", + UtilsGXT3.alert(msgsCommon.errorLocked(), caught.getLocalizedMessage()); } else { Log.error("No columns loaded: " + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error", "No columns loaded: " + UtilsGXT3.alert(msgsCommon.error(), msgs.errorNoColumnLoadedFixed() + caught.getLocalizedMessage()); } diff --git a/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/ExtractCodelistWizardTD.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/ExtractCodelistWizardTD.gwt.xml index dfd597d..a371e29 100644 --- a/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/ExtractCodelistWizardTD.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/ExtractCodelistWizardTD.gwt.xml @@ -1,35 +1,46 @@ - - + + + - - - + + + - - - - - - + + + + + + - - - - - - + + + + + - - - - - + + + + + + + + + + + + - - - - - diff --git a/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages_es.properties b/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages_es.properties new file mode 100644 index 0000000..03a879a --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages_es.properties @@ -0,0 +1,42 @@ +extractCodelistWizardHead = Extract Codelist +extractCodelistDetailCardHead = Codelist Detail +extractCodelistDetailsCardFormHead = Details +infoFieldSetHead = Information +nameFieldEmptyText = Enter a name... +nameFieldLabel = Name +nameFieldToolTip = Enter the name of new codelist extracted +automaticallyAttachTrueLabel = True +automaticallyAttachFalseLabel = False +attachFieldLabel = Attach +attachFieldToolTip = Select true if you want automatically attach the generated codelist +comboAttachToColumnEmptyText = Select a column... +comboAttachToColumnLabel = Attach To Column +comboAttachToColumnToolTip = Select the column to be attached to extracted codelist +attentionFillNameField = Fill name fields! +attentionSelectColumnToAttachCodelist = Select column to attach codelist! +sourceColumnsSelectionCardHead = Source Column +attentionNoColumnSelected = No column selected! +targetColumnsSelectionCardHead = Target Column +btnConnectTitle = Connect Codelist +btnDisconnectTitle = Disconnect Codelist +comboDefNewColumnEmptyText = Select a Column... +comboReferenceDefColumnEmptyText = Select a new column... +comboColumnEmptyText = Select from Codelist... +checkNewLabel = New +errorRetrievingColumnsFixed = Error retrieving columns on server. +errorCreatingForm = Error creating form! +errorCreatingFormForCheckRadio = Error creating form for check radio! +attentionFillAllColumn = Fill all column! +errorInExtractCodelistFixed = An error occurred in extract codelist. +errorAnErrorOccurredSettingCollateralTableFinalFixed = An error occurred setting collateral table final. +errorNoCollateralIdRetrieved = No collateral id retrieved +errorCollateralIdIsNull = Collateral id is null +errorAnErrorOccurredRetrievingColumnOnCollateralTableFixed = An error occurred retrieving column on collateral table. +errorAnErrorOccurredNoLabelRetrievedForAttachColumnFixed = An error occured no label retrieved for attach column +errorNoLabelRetrievedForAttachColumn = No label retrieved for attach column +errorAnErrorOccurredNoAttachColumnMatchFixed = An error occurred no attach column match +errorNoAttachColumnMatch = No attach column match +errorAnErrorOccurredOnStartChangeColumnTypeFixed = An error occurred on start change column type. +codelistAvailableInResources = The Codelists is available in the list of yours tabular resources +columns = Columns +errorNoColumnLoadedFixed = No column loaded: diff --git a/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages_it.properties b/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages_it.properties new file mode 100644 index 0000000..7528765 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractCodelistMessages_it.properties @@ -0,0 +1,42 @@ +extractCodelistWizardHead = Estrai Codelist +extractCodelistDetailCardHead = Codelist Dettaglio +extractCodelistDetailsCardFormHead = Dettagli +infoFieldSetHead = Info +nameFieldEmptyText = Inserisci un nome... +nameFieldLabel = Nome +nameFieldToolTip = Inserisci il nome della nuova codelist estratta +automaticallyAttachTrueLabel = Vero +automaticallyAttachFalseLabel = Falso +attachFieldLabel = Aggancia +attachFieldToolTip = Seleziona vero se vuoi automaticamente agganciare la codelist generata +comboAttachToColumnEmptyText = Seleziona una colonna... +comboAttachToColumnLabel = Aggancia alla Colonna +comboAttachToColumnToolTip = Seleziona la colonna per essere agganciata alla codelist estratta +attentionFillNameField = Riempi il campo nome! +attentionSelectColumnToAttachCodelist = Seleziona la colonna per essere agganciata alla codelist! +sourceColumnsSelectionCardHead = Colonna Sorgente +attentionNoColumnSelected = Nessuna colonna selezionata! +targetColumnsSelectionCardHead = Colonna Target +btnConnectTitle = Connetti Codelist +btnDisconnectTitle = Disconnetti Codelist +comboDefNewColumnEmptyText = Seleziona una colonna... +comboReferenceDefColumnEmptyText = Seleziona una nuova colonna... +comboColumnEmptyText = Seleziona dalla codelist... +checkNewLabel = Nuovo +errorRetrievingColumnsFixed = Errore recuperando le colonne sul server. +errorCreatingForm = Errore creando la form! +errorCreatingFormForCheckRadio = Errore creando la form per i radio check! +attentionFillAllColumn = Riempi tutte le colonne! +errorInExtractCodelistFixed = Un errore è stato generato nell''estrazione della codelist. +errorAnErrorOccurredSettingCollateralTableFinalFixed = Un errore è stato generato settando la collateral table a finale. +errorNoCollateralIdRetrieved = Nessun collateral id recuperato +errorCollateralIdIsNull = Collateral id è null +errorAnErrorOccurredRetrievingColumnOnCollateralTableFixed = Un errore è stato generato recuperando la colonna su collateral table. +errorAnErrorOccurredNoLabelRetrievedForAttachColumnFixed = Errore nessuna etichetta recuperata per agganciare la colonna +errorNoLabelRetrievedForAttachColumn = Nessuna etichetta recuperata per agganciare la colonna +errorAnErrorOccurredNoAttachColumnMatchFixed = Errore nessuna colonna di aggancio combacia +errorNoAttachColumnMatch = Nessuna colonna di aggancio combacia +errorAnErrorOccurredOnStartChangeColumnTypeFixed = Un errore è stato generato nel cambio tipo di colonna. +codelistAvailableInResources = La Codelist è disponibile nella lista delle tabular resources +columns = Colonne +errorNoColumnLoadedFixed = Nessuna colonna caricata: diff --git a/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractcodelistMessages.properties b/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractcodelistMessages.properties new file mode 100644 index 0000000..03a879a --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/ExtractcodelistMessages.properties @@ -0,0 +1,42 @@ +extractCodelistWizardHead = Extract Codelist +extractCodelistDetailCardHead = Codelist Detail +extractCodelistDetailsCardFormHead = Details +infoFieldSetHead = Information +nameFieldEmptyText = Enter a name... +nameFieldLabel = Name +nameFieldToolTip = Enter the name of new codelist extracted +automaticallyAttachTrueLabel = True +automaticallyAttachFalseLabel = False +attachFieldLabel = Attach +attachFieldToolTip = Select true if you want automatically attach the generated codelist +comboAttachToColumnEmptyText = Select a column... +comboAttachToColumnLabel = Attach To Column +comboAttachToColumnToolTip = Select the column to be attached to extracted codelist +attentionFillNameField = Fill name fields! +attentionSelectColumnToAttachCodelist = Select column to attach codelist! +sourceColumnsSelectionCardHead = Source Column +attentionNoColumnSelected = No column selected! +targetColumnsSelectionCardHead = Target Column +btnConnectTitle = Connect Codelist +btnDisconnectTitle = Disconnect Codelist +comboDefNewColumnEmptyText = Select a Column... +comboReferenceDefColumnEmptyText = Select a new column... +comboColumnEmptyText = Select from Codelist... +checkNewLabel = New +errorRetrievingColumnsFixed = Error retrieving columns on server. +errorCreatingForm = Error creating form! +errorCreatingFormForCheckRadio = Error creating form for check radio! +attentionFillAllColumn = Fill all column! +errorInExtractCodelistFixed = An error occurred in extract codelist. +errorAnErrorOccurredSettingCollateralTableFinalFixed = An error occurred setting collateral table final. +errorNoCollateralIdRetrieved = No collateral id retrieved +errorCollateralIdIsNull = Collateral id is null +errorAnErrorOccurredRetrievingColumnOnCollateralTableFixed = An error occurred retrieving column on collateral table. +errorAnErrorOccurredNoLabelRetrievedForAttachColumnFixed = An error occured no label retrieved for attach column +errorNoLabelRetrievedForAttachColumn = No label retrieved for attach column +errorAnErrorOccurredNoAttachColumnMatchFixed = An error occurred no attach column match +errorNoAttachColumnMatch = No attach column match +errorAnErrorOccurredOnStartChangeColumnTypeFixed = An error occurred on start change column type. +codelistAvailableInResources = The Codelists is available in the list of yours tabular resources +columns = Columns +errorNoColumnLoadedFixed = No column loaded: diff --git a/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/Messages.properties b/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/Messages.properties deleted file mode 100644 index c222555..0000000 --- a/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/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/extractcodelistwidget/client/Messages_fr.properties b/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/Messages_fr.properties deleted file mode 100644 index b4a7627..0000000 --- a/src/main/resources/org/gcube/portlets/user/td/extractcodelistwidget/client/Messages_fr.properties +++ /dev/null @@ -1,2 +0,0 @@ -sendButton = Envoyer -nameField = Entrez votre nom \ No newline at end of file