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.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;
@ -317,7 +317,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceTypeLabel = new FieldLabel(
comboColumnReferenceType, "Column");
//TODO
// TODO
// ColumnMapping
ColumnMappingListProperties propsColumnMapping = GWT
.create(ColumnMappingListProperties.class);
@ -328,7 +328,6 @@ public class ChangeColumnTypePanel extends FramedPanel implements
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,6 +551,11 @@ public class ChangeColumnTypePanel extends FramedPanel implements
+ "!"));
Log.debug("ComboColumnReferenceType selected: "
+ 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(
final LabelProvider<TimeDimensionTypeElement> labelProvider) {
comboTimeDimensionType
@ -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);
}
@ -1021,24 +1029,36 @@ 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!");
}
TabResource dimensionTR = comboDimensionType.getCurrentValue();
if (dimensionTR == null) {
UtilsGXT3.alert("Attention",
"Codelist not selected!");
}
/*ColumnMappingDialog columnMappingDialog = new ColumnMappingDialog(
eventBus);
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);
}
@ -1050,9 +1070,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
@Override
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.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<ColumnMappingListener> 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<ColumnMappingListener>();
@ -49,7 +58,7 @@ public class ColumnMappingDialog extends Window {
initWindow();
ColumnMappingPanel columnMappingPanel = new ColumnMappingPanel(this,
trId, selectedColumn,
dimensionTR, columnReference,
dimensionTR, referenceColumn,
eventBus);
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.column.mapping.ColumnMappingList;
import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.data.shared.LabelProvider;

View File

@ -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;

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.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;