Updated column mapping

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@97899 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-06-27 11:08:32 +00:00
parent 6c74b412fe
commit bea7b9cca4
7 changed files with 65 additions and 162 deletions

View File

@ -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.CodelistSelectionDialog;
import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectionListener; 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.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.ColumnMappingListProperties;
import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingListener; import org.gcube.portlets.user.td.columnwidget.client.mapping.ColumnMappingListener;
import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog; 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.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; 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.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.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; 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.client.type.SessionExpiredType;
@ -317,7 +317,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceTypeLabel = new FieldLabel( comboColumnReferenceTypeLabel = new FieldLabel(
comboColumnReferenceType, "Column"); comboColumnReferenceType, "Column");
//TODO // TODO
// ColumnMapping // ColumnMapping
ColumnMappingListProperties propsColumnMapping = GWT ColumnMappingListProperties propsColumnMapping = GWT
.create(ColumnMappingListProperties.class); .create(ColumnMappingListProperties.class);
@ -328,7 +328,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
storeComboColumnMapping, propsColumnMapping.name()); storeComboColumnMapping, propsColumnMapping.name());
Log.trace("ComboColumnMapping created"); Log.trace("ComboColumnMapping created");
addHandlersForComboColumnMapping(propsColumnMapping.name()); addHandlersForComboColumnMapping(propsColumnMapping.name());
comboColumnMapping.setEmptyText("Select optional mapping..."); comboColumnMapping.setEmptyText("Select optional mapping...");
@ -336,8 +335,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnMapping.setEditable(false); comboColumnMapping.setEditable(false);
comboColumnMapping.setTriggerAction(TriggerAction.ALL); comboColumnMapping.setTriggerAction(TriggerAction.ALL);
comboColumnMappingLabel = new FieldLabel( comboColumnMappingLabel = new FieldLabel(comboColumnMapping, "Mapping");
comboColumnMapping, "Mapping");
// comboTimeDimensionType // comboTimeDimensionType
TimeDimensionTypeProperties propsTimeDimensionType = GWT TimeDimensionTypeProperties propsTimeDimensionType = GWT
@ -553,6 +551,11 @@ public class ChangeColumnTypePanel extends FramedPanel implements
+ "!")); + "!"));
Log.debug("ComboColumnReferenceType selected: " Log.debug("ComboColumnReferenceType selected: "
+ event.getSelectedItem()); + event.getSelectedItem());
comboColumnMapping.reset();
storeComboColumnMapping.clear();
storeComboColumnMapping.commitChanges();
comboColumnMappingLabel.setVisible(true);
forceLayout();
} }
@ -577,7 +580,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
} }
protected void addHandlersForComboTimeDimensionType( protected void addHandlersForComboTimeDimensionType(
final LabelProvider<TimeDimensionTypeElement> labelProvider) { final LabelProvider<TimeDimensionTypeElement> labelProvider) {
comboTimeDimensionType comboTimeDimensionType
@ -853,6 +855,12 @@ public class ChangeColumnTypePanel extends FramedPanel implements
ColumnData columnReference = comboColumnReferenceType ColumnData columnReference = comboColumnReferenceType
.getCurrentValue(); .getCurrentValue();
if (columnReference != null) { if (columnReference != null) {
ColumnMappingList mapping = comboColumnMapping
.getCurrentValue();
if (mapping != null) {
changeColumnTypeSession
.setColumnMappingList(mapping);
}
changeColumnTypeSession changeColumnTypeSession
.setCodelistColumnReference(columnReference); .setCodelistColumnReference(columnReference);
callChangeColumnType(); callChangeColumnType();
@ -930,7 +938,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
@Override @Override
public void selected(TabResource tabResource) { public void selected(TabResource tabResource) {
Log.debug("Selected Codelist: " + tabResource); Log.debug("Selected Codelist: " + tabResource);
comboDimensionType.setValue(tabResource,true); comboDimensionType.setValue(tabResource, true);
retrieveColumnData(tabResource); retrieveColumnData(tabResource);
} }
@ -1021,24 +1029,36 @@ public class ChangeColumnTypePanel extends FramedPanel implements
} }
} }
//TODO // TODO
protected void callColumnMappingDialog() { protected void callColumnMappingDialog() {
ColumnData referenceColumn=comboColumnReferenceType.getCurrentValue(); ColumnData selectedColumn = comboColumn.getCurrentValue();
if(referenceColumn==null){ if (selectedColumn == null) {
UtilsGXT3.alert("Attention",
"Column not selected!");
} }
TabResource dimensionTR = comboDimensionType.getCurrentValue();
if (dimensionTR == null) {
UtilsGXT3.alert("Attention",
"Codelist not selected!");
}
/*ColumnMappingDialog columnMappingDialog = new ColumnMappingDialog( ColumnData referenceColumn = comboColumnReferenceType.getCurrentValue();
eventBus); if (referenceColumn == null) {
UtilsGXT3.alert("Attention",
"Reference column not selected!");
}
ColumnMappingDialog columnMappingDialog = new ColumnMappingDialog(trId,
selectedColumn, dimensionTR, referenceColumn, eventBus);
columnMappingDialog.addColumnMappingListener(this); columnMappingDialog.addColumnMappingListener(this);
columnMappingDialog.show();*/ columnMappingDialog.show();
} }
@Override @Override
public void selectedColumnMapping(ColumnMappingList columnMappingList) { public void selectedColumnMapping(ColumnMappingList columnMappingList) {
Log.debug("Selected ColumnMapping: " + columnMappingList); Log.debug("Selected ColumnMapping: " + columnMappingList);
comboColumnMapping.setValue(columnMappingList,true); comboColumnMapping.setValue(columnMappingList, true);
} }
@ -1050,9 +1070,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
@Override @Override
public void failedColumnMapping(String reason, String detail) { public void failedColumnMapping(String reason, String detail) {
Log.error("Error selecting Column Mapping:"+reason+" "+detail); Log.error("Error selecting Column Mapping:" + reason + " " + detail);
} }
} }

View File

@ -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: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
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 + "]";
}
}

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle; 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.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; 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 org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -26,22 +27,30 @@ public class ColumnMappingDialog extends Window {
protected TRId trId; protected TRId trId;
protected ColumnData selectedColumn; protected ColumnData selectedColumn;
protected TabResource dimensionTR; protected TabResource dimensionTR;
protected ColumnData columnReference; protected ColumnData referenceColumn;
protected EventBus eventBus; protected EventBus eventBus;
protected ArrayList<ColumnMappingListener> listeners; protected ArrayList<ColumnMappingListener> listeners;
/**
*
* @param trId
* @param selectedColumn
* @param dimensionTR
* @param referenceColumn
* @param eventBus
*/
public ColumnMappingDialog(TRId trId, ColumnData selectedColumn, public ColumnMappingDialog(TRId trId, ColumnData selectedColumn,
TabResource dimensionTR, ColumnData columnReference, TabResource dimensionTR, ColumnData referenceColumn,
EventBus eventBus) { EventBus eventBus) {
this.trId = trId; this.trId = trId;
this.selectedColumn = selectedColumn; this.selectedColumn = selectedColumn;
this.dimensionTR = dimensionTR; this.dimensionTR = dimensionTR;
this.columnReference= columnReference; this.referenceColumn= referenceColumn;
this.eventBus = eventBus; this.eventBus = eventBus;
Log.debug("ColumnMappingDialog: [trId:" + trId Log.debug("ColumnMappingDialog: [trId:" + trId
+ ", selectedColumn:" + selectedColumn + ", dimensionTR:" + ", selectedColumn:" + selectedColumn + ", dimensionTR:"
+ dimensionTR + ", columnReference:" + columnReference + dimensionTR + ", columnReference:" + referenceColumn
+ ", eventBus:" + eventBus + ", eventBus:" + eventBus
+ "]"); + "]");
listeners=new ArrayList<ColumnMappingListener>(); listeners=new ArrayList<ColumnMappingListener>();
@ -49,7 +58,7 @@ public class ColumnMappingDialog extends Window {
initWindow(); initWindow();
ColumnMappingPanel columnMappingPanel = new ColumnMappingPanel(this, ColumnMappingPanel columnMappingPanel = new ColumnMappingPanel(this,
trId, selectedColumn, trId, selectedColumn,
dimensionTR, columnReference, dimensionTR, referenceColumn,
eventBus); eventBus);
add(columnMappingPanel); add(columnMappingPanel);
} }

View File

@ -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: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ColumnMappingList implements Serializable {
private static final long serialVersionUID = 733237646914552402L;
protected String id;
protected String name;
protected ArrayList<ColumnMappingData> mapping;
/**
*
*/
public ColumnMappingList() {
}
/**
*
* @param mapping
*/
public ColumnMappingList(String id, String name,
ArrayList<ColumnMappingData> 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<ColumnMappingData> getMapping() {
return mapping;
}
public void setMapping(ArrayList<ColumnMappingData> mapping) {
this.mapping = mapping;
}
@Override
public String toString() {
return "ColumnMappingList [id=" + id + ", name=" + name + ", mapping="
+ mapping + "]";
}
}

View File

@ -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.DimensionRow;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList;
import com.google.gwt.editor.client.Editor.Path; import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.data.shared.LabelProvider; import com.sencha.gxt.data.shared.LabelProvider;

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.user.td.columnwidget.client.mapping; package org.gcube.portlets.user.td.columnwidget.client.mapping;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList;

View File

@ -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.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow; 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.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.CellData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;