Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@97890 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-06-27 10:15:54 +00:00
parent f0204e2478
commit 6c74b412fe
4 changed files with 157 additions and 21 deletions

View File

@ -4,6 +4,10 @@ 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;
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPropertiesCombo;
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataTypeProperties;
@ -73,7 +77,7 @@ import com.sencha.gxt.widget.core.client.info.Info;
*
*/
public class ChangeColumnTypePanel extends FramedPanel implements
CodelistSelectionListener {
CodelistSelectionListener, ColumnMappingListener {
protected String WIDTH = "640px";
protected String HEIGHT = "520px";
protected EventBus eventBus;
@ -97,7 +101,11 @@ public class ChangeColumnTypePanel extends FramedPanel implements
protected ComboBox<ColumnData> comboColumnReferenceType = null;
protected FieldLabel comboColumnReferenceTypeLabel;
protected ListStore<ColumnData> storeComboColumnReferenceType;
protected ComboBox<ColumnMappingList> comboColumnMapping = null;
protected FieldLabel comboColumnMappingLabel;
protected ListStore<ColumnMappingList> storeComboColumnMapping;
protected ComboBox<TimeDimensionTypeElement> comboTimeDimensionType = null;
protected FieldLabel comboTimeDimensionTypeLabel;
@ -309,6 +317,28 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceTypeLabel = new FieldLabel(
comboColumnReferenceType, "Column");
//TODO
// ColumnMapping
ColumnMappingListProperties propsColumnMapping = GWT
.create(ColumnMappingListProperties.class);
storeComboColumnMapping = new ListStore<ColumnMappingList>(
propsColumnMapping.id());
comboColumnMapping = new ComboBox<ColumnMappingList>(
storeComboColumnMapping, propsColumnMapping.name());
Log.trace("ComboColumnMapping created");
addHandlersForComboColumnMapping(propsColumnMapping.name());
comboColumnMapping.setEmptyText("Select optional mapping...");
comboColumnMapping.setWidth(191);
comboColumnMapping.setEditable(false);
comboColumnMapping.setTriggerAction(TriggerAction.ALL);
comboColumnMappingLabel = new FieldLabel(
comboColumnMapping, "Mapping");
// comboTimeDimensionType
TimeDimensionTypeProperties propsTimeDimensionType = GWT
.create(TimeDimensionTypeProperties.class);
@ -364,6 +394,8 @@ public class ChangeColumnTypePanel extends FramedPanel implements
new Margins(1)));
v.add(comboColumnReferenceTypeLabel, new VerticalLayoutData(1, -1,
new Margins(1)));
v.add(comboColumnMappingLabel, new VerticalLayoutData(1, -1,
new Margins(1)));
v.add(comboTimeDimensionTypeLabel, new VerticalLayoutData(1, -1,
new Margins(1)));
v.add(change, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
@ -373,6 +405,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboAttributeTypeLabel.setVisible(false);
comboDimensionTypeLabel.setVisible(false);
comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false);
comboTimeDimensionTypeLabel.setVisible(false);
comboLocaleTypeLabel.setVisible(false);
@ -526,6 +559,24 @@ public class ChangeColumnTypePanel extends FramedPanel implements
});
}
protected void addHandlersForComboColumnMapping(
final LabelProvider<ColumnMappingList> labelProvider) {
comboColumnMapping.addTriggerClickHandler(new TriggerClickHandler() {
@Override
public void onTriggerClick(TriggerClickEvent event) {
Log.debug("ComboColumnMapping TriggerClickEvent");
callColumnMappingDialog();
comboColumnMapping.collapse();
}
});
}
protected void addHandlersForComboTimeDimensionType(
final LabelProvider<TimeDimensionTypeElement> labelProvider) {
@ -559,6 +610,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboAttributeTypeLabel.setVisible(false);
comboDimensionTypeLabel.setVisible(false);
comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false);
comboTimeDimensionTypeLabel.setVisible(false);
break;
case ATTRIBUTE:
@ -567,6 +619,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboAttributeTypeLabel.setVisible(true);
comboDimensionTypeLabel.setVisible(false);
comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false);
comboTimeDimensionTypeLabel.setVisible(false);
break;
case DIMENSION:
@ -575,6 +628,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboAttributeTypeLabel.setVisible(false);
comboDimensionTypeLabel.setVisible(true);
comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false);
comboTimeDimensionTypeLabel.setVisible(false);
break;
case MEASURE:
@ -583,6 +637,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboAttributeTypeLabel.setVisible(false);
comboDimensionTypeLabel.setVisible(false);
comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false);
comboTimeDimensionTypeLabel.setVisible(false);
break;
case TIMEDIMENSION:
@ -591,6 +646,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboAttributeTypeLabel.setVisible(false);
comboDimensionTypeLabel.setVisible(false);
comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false);
comboTimeDimensionTypeLabel.setVisible(true);
break;
default:
@ -599,6 +655,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboAttributeTypeLabel.setVisible(false);
comboDimensionTypeLabel.setVisible(false);
comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false);
comboTimeDimensionTypeLabel.setVisible(false);
break;
}
@ -873,7 +930,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
@Override
public void selected(TabResource tabResource) {
Log.debug("Selected Codelist: " + tabResource);
comboDimensionType.setValue(tabResource);
comboDimensionType.setValue(tabResource,true);
retrieveColumnData(tabResource);
}
@ -963,5 +1020,39 @@ public class ChangeColumnTypePanel extends FramedPanel implements
}
}
}
//TODO
protected void callColumnMappingDialog() {
ColumnData referenceColumn=comboColumnReferenceType.getCurrentValue();
if(referenceColumn==null){
}
/*ColumnMappingDialog columnMappingDialog = new ColumnMappingDialog(
eventBus);
columnMappingDialog.addColumnMappingListener(this);
columnMappingDialog.show();*/
}
@Override
public void selectedColumnMapping(ColumnMappingList columnMappingList) {
Log.debug("Selected ColumnMapping: " + columnMappingList);
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);
}
}

View File

@ -5,30 +5,49 @@ import java.util.ArrayList;
/**
*
* @author "Giancarlo Panichi"
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
* @author "Giancarlo Panichi" email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ColumnMappingList implements Serializable{
public class ColumnMappingList implements Serializable {
private static final long serialVersionUID = 733237646914552402L;
protected String id;
protected String name;
protected ArrayList<ColumnMappingData> mapping;
/**
*
*/
public ColumnMappingList(){
public ColumnMappingList() {
}
/**
*
* @param mapping
*/
public ColumnMappingList(ArrayList<ColumnMappingData> mapping){
this.mapping=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() {
@ -41,10 +60,8 @@ public class ColumnMappingList implements Serializable{
@Override
public String toString() {
return "ColumnMappingList [mapping=" + mapping + "]";
return "ColumnMappingList [id=" + id + ", name=" + name + ", mapping="
+ mapping + "]";
}
}

View File

@ -0,0 +1,28 @@
/**
*
*/
package org.gcube.portlets.user.td.columnwidget.client.mapping;
import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow;
import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.data.shared.LabelProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface ColumnMappingListProperties extends PropertyAccess<DimensionRow> {
@Path("id")
ModelKeyProvider<ColumnMappingList> id();
LabelProvider<ColumnMappingList> name();
}

View File

@ -183,7 +183,7 @@ public class ColumnMappingPanel extends FramedPanel {
}
}
if(mapping.size()>0){
columnMappingList=new ColumnMappingList(mapping);
columnMappingList=new ColumnMappingList("1","Mapping", mapping);
if(parent!=null){
parent.saveMapping(columnMappingList);
}