diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java index 4915f47..99661ea 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectionDialog; import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectionListener; import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingDialog; -import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingList; import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingListProperties; import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingListener; import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog; @@ -27,6 +26,7 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; +import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; @@ -101,11 +101,11 @@ public class ChangeColumnTypePanel extends FramedPanel implements protected ComboBox comboColumnReferenceType = null; protected FieldLabel comboColumnReferenceTypeLabel; protected ListStore storeComboColumnReferenceType; - + protected ComboBox comboColumnMapping = null; protected FieldLabel comboColumnMappingLabel; protected ListStore storeComboColumnMapping; - + protected ComboBox comboTimeDimensionType = null; protected FieldLabel comboTimeDimensionTypeLabel; @@ -317,7 +317,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements comboColumnReferenceTypeLabel = new FieldLabel( comboColumnReferenceType, "Column"); - //TODO + // TODO // ColumnMapping ColumnMappingListProperties propsColumnMapping = GWT .create(ColumnMappingListProperties.class); @@ -327,8 +327,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements comboColumnMapping = new ComboBox( storeComboColumnMapping, propsColumnMapping.name()); Log.trace("ComboColumnMapping created"); - - + addHandlersForComboColumnMapping(propsColumnMapping.name()); comboColumnMapping.setEmptyText("Select optional mapping..."); @@ -336,8 +335,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements comboColumnMapping.setEditable(false); comboColumnMapping.setTriggerAction(TriggerAction.ALL); - comboColumnMappingLabel = new FieldLabel( - comboColumnMapping, "Mapping"); + comboColumnMappingLabel = new FieldLabel(comboColumnMapping, "Mapping"); // comboTimeDimensionType TimeDimensionTypeProperties propsTimeDimensionType = GWT @@ -553,13 +551,18 @@ public class ChangeColumnTypePanel extends FramedPanel implements + "!")); Log.debug("ComboColumnReferenceType selected: " + event.getSelectedItem()); + comboColumnMapping.reset(); + storeComboColumnMapping.clear(); + storeComboColumnMapping.commitChanges(); + comboColumnMappingLabel.setVisible(true); + forceLayout(); } }); } - + protected void addHandlersForComboColumnMapping( final LabelProvider labelProvider) { @@ -576,7 +579,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements }); } - protected void addHandlersForComboTimeDimensionType( final LabelProvider labelProvider) { @@ -853,6 +855,12 @@ public class ChangeColumnTypePanel extends FramedPanel implements ColumnData columnReference = comboColumnReferenceType .getCurrentValue(); if (columnReference != null) { + ColumnMappingList mapping = comboColumnMapping + .getCurrentValue(); + if (mapping != null) { + changeColumnTypeSession + .setColumnMappingList(mapping); + } changeColumnTypeSession .setCodelistColumnReference(columnReference); callChangeColumnType(); @@ -930,7 +938,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements @Override public void selected(TabResource tabResource) { Log.debug("Selected Codelist: " + tabResource); - comboDimensionType.setValue(tabResource,true); + comboDimensionType.setValue(tabResource, true); retrieveColumnData(tabResource); } @@ -1020,39 +1028,50 @@ public class ChangeColumnTypePanel extends FramedPanel implements } } } - - //TODO + + // TODO protected void callColumnMappingDialog() { - ColumnData referenceColumn=comboColumnReferenceType.getCurrentValue(); - if(referenceColumn==null){ - + ColumnData selectedColumn = comboColumn.getCurrentValue(); + if (selectedColumn == null) { + UtilsGXT3.alert("Attention", + "Column not selected!"); } - - - /*ColumnMappingDialog columnMappingDialog = new ColumnMappingDialog( - eventBus); + + TabResource dimensionTR = comboDimensionType.getCurrentValue(); + if (dimensionTR == null) { + UtilsGXT3.alert("Attention", + "Codelist not selected!"); + } + + ColumnData referenceColumn = comboColumnReferenceType.getCurrentValue(); + if (referenceColumn == null) { + UtilsGXT3.alert("Attention", + "Reference column not selected!"); + } + + ColumnMappingDialog columnMappingDialog = new ColumnMappingDialog(trId, + selectedColumn, dimensionTR, referenceColumn, eventBus); columnMappingDialog.addColumnMappingListener(this); - columnMappingDialog.show();*/ + columnMappingDialog.show(); } @Override public void selectedColumnMapping(ColumnMappingList columnMappingList) { Log.debug("Selected ColumnMapping: " + columnMappingList); - comboColumnMapping.setValue(columnMappingList,true); - + comboColumnMapping.setValue(columnMappingList, true); + } @Override public void abortedColumnMapping() { Log.debug("Column Mapping selection Aborted"); - + } @Override public void failedColumnMapping(String reason, String detail) { - Log.error("Error selecting Column Mapping:"+reason+" "+detail); - + Log.error("Error selecting Column Mapping:" + reason + " " + detail); + } - } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingData.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingData.java deleted file mode 100644 index d655b9e..0000000 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingData.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.gcube.portlets.user.td.columnwidget.client.mapping; - -import java.io.Serializable; - - -import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow; - -/** - * - * @author "Giancarlo Panichi" - * email: g.panichi@isti.cnr.it - * - */ -public class ColumnMappingData implements Serializable { - - private static final long serialVersionUID = 733237646914552402L; - - protected DimensionRow sourceArg; - protected DimensionRow targetArg; - - /** - * - */ - public ColumnMappingData(){ - - } - - /** - * - * @param sourceArg - * @param targetArg - */ - public ColumnMappingData(DimensionRow sourceArg, DimensionRow targetArg){ - this.sourceArg=sourceArg; - this.targetArg=targetArg; - } - - public DimensionRow getSourceArg() { - return sourceArg; - } - - public void setSourceArg(DimensionRow sourceArg) { - this.sourceArg = sourceArg; - } - - public DimensionRow getTargetArg() { - return targetArg; - } - - public void setTargetArg(DimensionRow targetArg) { - this.targetArg = targetArg; - } - - @Override - public String toString() { - return "ColumnMappingData [sourceArg=" + sourceArg + ", targetArg=" - + targetArg + "]"; - } - - - - -} diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingDialog.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingDialog.java index 25c09bc..2990c84 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingDialog.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; +import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -26,22 +27,30 @@ public class ColumnMappingDialog extends Window { protected TRId trId; protected ColumnData selectedColumn; protected TabResource dimensionTR; - protected ColumnData columnReference; + protected ColumnData referenceColumn; protected EventBus eventBus; protected ArrayList listeners; + /** + * + * @param trId + * @param selectedColumn + * @param dimensionTR + * @param referenceColumn + * @param eventBus + */ public ColumnMappingDialog(TRId trId, ColumnData selectedColumn, - TabResource dimensionTR, ColumnData columnReference, + TabResource dimensionTR, ColumnData referenceColumn, EventBus eventBus) { this.trId = trId; this.selectedColumn = selectedColumn; this.dimensionTR = dimensionTR; - this.columnReference= columnReference; + this.referenceColumn= referenceColumn; this.eventBus = eventBus; Log.debug("ColumnMappingDialog: [trId:" + trId + ", selectedColumn:" + selectedColumn + ", dimensionTR:" - + dimensionTR + ", columnReference:" + columnReference + + dimensionTR + ", columnReference:" + referenceColumn + ", eventBus:" + eventBus + "]"); listeners=new ArrayList(); @@ -49,7 +58,7 @@ public class ColumnMappingDialog extends Window { initWindow(); ColumnMappingPanel columnMappingPanel = new ColumnMappingPanel(this, trId, selectedColumn, - dimensionTR, columnReference, + dimensionTR, referenceColumn, eventBus); add(columnMappingPanel); } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingList.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingList.java deleted file mode 100644 index 5b62608..0000000 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingList.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.gcube.portlets.user.td.columnwidget.client.mapping; - -import java.io.Serializable; -import java.util.ArrayList; - -/** - * - * @author "Giancarlo Panichi" email: g.panichi@isti.cnr.it - * - */ -public class ColumnMappingList implements Serializable { - - private static final long serialVersionUID = 733237646914552402L; - - protected String id; - protected String name; - protected ArrayList mapping; - - /** - * - */ - public ColumnMappingList() { - - } - - /** - * - * @param mapping - */ - public ColumnMappingList(String id, String name, - ArrayList mapping) { - this.mapping = mapping; - - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public ArrayList getMapping() { - return mapping; - } - - public void setMapping(ArrayList mapping) { - this.mapping = mapping; - } - - @Override - public String toString() { - return "ColumnMappingList [id=" + id + ", name=" + name + ", mapping=" - + mapping + "]"; - } - -} diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingListProperties.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingListProperties.java index c6e6108..dfcdf30 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingListProperties.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingListProperties.java @@ -5,6 +5,7 @@ package org.gcube.portlets.user.td.columnwidget.client.mapping; import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow; +import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList; import com.google.gwt.editor.client.Editor.Path; import com.sencha.gxt.data.shared.LabelProvider; diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingListener.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingListener.java index 11da016..3ee5d97 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingListener.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingListener.java @@ -1,5 +1,7 @@ package org.gcube.portlets.user.td.columnwidget.client.mapping; +import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList; + diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingPanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingPanel.java index bd967bc..2e92b0e 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/mapping/ColumnMappingPanel.java @@ -11,6 +11,8 @@ import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; +import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingData; +import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList; import org.gcube.portlets.user.td.widgetcommonevent.shared.CellData; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;