From 60c933b91a89407a3937b86fa29d4e8969ea7d5c Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 26 Jun 2014 13:23:40 +0000 Subject: [PATCH] Updated ColumnMapping git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@97860 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 6 +- .gwt/.gwt-log | 32 +++ pom.xml | 4 +- .../client/mapping/ColumnMappingDialog.java | 6 + .../client/mapping/ColumnMappingList.java | 10 +- .../client/mapping/ColumnMappingPanel.java | 237 +++++++++++++----- templates/changelog.xml | 5 + 7 files changed, 229 insertions(+), 71 deletions(-) diff --git a/.classpath b/.classpath index f38296c..b6d48f0 100644 --- a/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ - + - + @@ -44,5 +44,5 @@ - + diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index 0d38626..c46d7b8 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -4666,3 +4666,35 @@ Compiling... Compilation completed in 0.00 seconds Removing invalidated units Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 50% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 60% complete (ETR: 4 seconds) + 70% complete (ETR: 3 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 12.77 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes diff --git a/pom.xml b/pom.xml index 9789925..a0fb3e5 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 4.0.0 org.gcube.portlets.user tabular-data-column-widget - 1.2.0-SNAPSHOT + 1.3.0-SNAPSHOT tabular-data-column-widget @@ -38,7 +38,7 @@ ${project.basedir}/distro ${project.build.directory}/${project.build.finalName} - 2014-06-05 + 2014-07-04 templates distro config 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 80e0e4c..7639007 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 @@ -13,6 +13,12 @@ import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; +/** + * + * @author "Giancarlo Panichi" + * email: g.panichi@isti.cnr.it + * + */ public class ColumnMappingDialog extends Window { protected String WIDTH = "650px"; protected String HEIGHT = "530px"; 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 index 5d29982..adaf4d0 100644 --- 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 @@ -3,8 +3,6 @@ package org.gcube.portlets.user.td.columnwidget.client.mapping; import java.io.Serializable; import java.util.ArrayList; -import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow; - /** * * @author "Giancarlo Panichi" @@ -15,7 +13,7 @@ public class ColumnMappingList implements Serializable{ private static final long serialVersionUID = 733237646914552402L; - protected ArrayList mapping; + protected ArrayList mapping; /** * @@ -28,16 +26,16 @@ public class ColumnMappingList implements Serializable{ * * @param mapping */ - public ColumnMappingList(ArrayList mapping){ + public ColumnMappingList(ArrayList mapping){ this.mapping=mapping; } - public ArrayList getMapping() { + public ArrayList getMapping() { return mapping; } - public void setMapping(ArrayList mapping) { + public void setMapping(ArrayList mapping) { this.mapping = mapping; } 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 5316b46..b970343 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 @@ -1,51 +1,67 @@ package org.gcube.portlets.user.td.columnwidget.client.mapping; +import java.util.ArrayList; + import org.gcube.portlets.user.td.columnwidget.client.custom.IconButton; +import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog; import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener; +import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowsProperties; 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.DimensionRow; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; +import org.gcube.portlets.user.td.widgetcommonevent.shared.CellData; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.web.bindery.event.shared.EventBus; +import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction; import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode; +import com.sencha.gxt.core.client.util.Margins; +import com.sencha.gxt.data.shared.ListStore; import com.sencha.gxt.widget.core.client.FramedPanel; +import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData; +import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack; import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer; +import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; -import com.sencha.gxt.widget.core.client.form.TextField; +import com.sencha.gxt.widget.core.client.event.TriggerClickEvent; +import com.sencha.gxt.widget.core.client.event.TriggerClickEvent.TriggerClickHandler; +import com.sencha.gxt.widget.core.client.form.ComboBox; /** * - * @author "Giancarlo Panichi" - * email: g.panichi@isti.cnr.it - * + * @author "Giancarlo Panichi" email: g.panichi@isti.cnr.it + * */ -public class ColumnMappingPanel extends FramedPanel implements - DimensionRowSelectionListener { - protected String WIDTH = "560px"; - protected String HEIGHT = "520px"; +public class ColumnMappingPanel extends FramedPanel { + protected static final String WIDTH = "560px"; + protected static final String HEIGHT = "520px"; + protected static final String COMBOWIDTH ="120px"; + protected ColumnMappingPanel thisPanel; - + protected ColumnMappingDialog parent; protected TRId trId; protected ColumnData selectedColumn; protected TabResource dimensionTR; - protected ColumnData columnReference; + protected ColumnData referenceColumn; protected EventBus eventBus; - + protected VerticalLayoutContainer vert; protected String itemIdSourceValueArg; protected String itemIdTargetValueArg; protected String itemIdBtnAdd; protected String itemIdBtnDel; - + protected ColumnMappingList columnMappingList; - + protected ArrayList mapping; + /** * * @@ -53,50 +69,162 @@ public class ColumnMappingPanel extends FramedPanel implements * @param trId * @param selectedColumn * @param dimensionTR - * @param columnReference + * @param referenceColumn * @param eventBus */ public ColumnMappingPanel(ColumnMappingDialog parent, TRId trId, ColumnData selectedColumn, TabResource dimensionTR, - ColumnData columnReference, EventBus eventBus) { + ColumnData referenceColumn, EventBus eventBus) { this.parent = parent; this.trId = trId; this.selectedColumn = selectedColumn; this.dimensionTR = dimensionTR; - this.columnReference = columnReference; + this.referenceColumn = referenceColumn; this.eventBus = eventBus; - thisPanel=this; + thisPanel = this; Log.debug("ColumnMappingPanel: [parent:" + parent + " , trId:" + trId + ", selectedColumn:" + selectedColumn + ", dimensionTR:" - + dimensionTR + ", columnReference:" + columnReference - + ", eventBus:" + eventBus - + "]"); - columnMappingList=new ColumnMappingList(); - - + + dimensionTR + ", columnReference:" + referenceColumn + + ", eventBus:" + eventBus + "]"); + columnMappingList = new ColumnMappingList(); + mapping = new ArrayList(); } - - - protected void setup(){ + + protected void setup() { itemIdSourceValueArg = "SourceArg" + selectedColumn.getName(); itemIdTargetValueArg = "TargetArg" + selectedColumn.getName(); - - + vert = new VerticalLayoutContainer(); vert.setScrollMode(ScrollMode.AUTO); vert.setAdjustForScroll(true); - + final HBoxLayoutContainer horiz = new HBoxLayoutContainer(); + + // Source Combo + DimensionRowsProperties propsSource = GWT + .create(DimensionRowsProperties.class); + ListStore storeComboSourceValue = new ListStore( + propsSource.rowId()); + + final ComboBox comboSourceValue = new ComboBox( + storeComboSourceValue, propsSource.value()); + comboSourceValue.setItemId(itemIdSourceValueArg); + + Log.debug("ComboSourceValue created"); + + final DimensionRowSelectionListener sourceValueSelectedListener = new DimensionRowSelectionListener() { + + @Override + public void selectedDimensionRow(DimensionRow dimensionRow) { + Log.debug("Source DimensionRow selected: " + dimensionRow); + comboSourceValue.setValue(dimensionRow, true); + + } + + @Override + public void abortedDimensionRowSelection() { + Log.debug("Source DimensionRow selection aborted"); + + } + + @Override + public void failedDimensionRowSelection(String reason, String detail) { + Log.error("Source DimensionRow selection error: " + reason); + + } + + }; + + comboSourceValue.addTriggerClickHandler(new TriggerClickHandler() { + + @Override + public void onTriggerClick(TriggerClickEvent event) { + Log.debug("ComboSourceValue TriggerClickEvent"); + comboSourceValue.collapse(); + + CellData cellData = new CellData("", selectedColumn.getName(), + selectedColumn.getColumnId(), + selectedColumn.getLabel(), null, 0, 0); + + DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog( + selectedColumn, cellData, false, eventBus); + dimensionRowSelectionDialog + .addListener(sourceValueSelectedListener); + dimensionRowSelectionDialog.show(); + + } + + }); + + comboSourceValue.setEmptyText("Select a source..."); + comboSourceValue.setWidth(COMBOWIDTH); + comboSourceValue.setEditable(false); + comboSourceValue.setTriggerAction(TriggerAction.ALL); + + //Target Combo + DimensionRowsProperties propsTarget = GWT + .create(DimensionRowsProperties.class); + ListStore storeComboTargetValue = new ListStore( + propsTarget.rowId()); + + final ComboBox comboTargetValue = new ComboBox( + storeComboTargetValue, propsTarget.value()); + comboTargetValue.setItemId(itemIdTargetValueArg); + + Log.debug("ComboTargetValue created"); + + final DimensionRowSelectionListener targetValueSelectedListener = new DimensionRowSelectionListener() { + + @Override + public void selectedDimensionRow(DimensionRow dimensionRow) { + Log.debug("Target DimensionRow selected: " + dimensionRow); + comboTargetValue.setValue(dimensionRow, true); + + } + + @Override + public void abortedDimensionRowSelection() { + Log.debug("Target DimensionRow selection aborted"); + + } + + @Override + public void failedDimensionRowSelection(String reason, String detail) { + Log.error("Target DimensionRow selection error: " + reason); + + } + + }; + + comboTargetValue.addTriggerClickHandler(new TriggerClickHandler() { + + @Override + public void onTriggerClick(TriggerClickEvent event) { + Log.debug("ComboTargetValue TriggerClickEvent"); + comboTargetValue.collapse(); + + CellData cellData = new CellData("", referenceColumn.getName(), + referenceColumn.getColumnId(), + referenceColumn.getLabel(), null, 0, 0); + + DimensionRowSelectionDialog dimensionRowSelectionDialog = new DimensionRowSelectionDialog( + referenceColumn, cellData, true, eventBus); + dimensionRowSelectionDialog + .addListener(targetValueSelectedListener); + dimensionRowSelectionDialog.show(); + + } + + }); + + comboTargetValue.setEmptyText("Select a target..."); + comboTargetValue.setWidth(COMBOWIDTH); + comboTargetValue.setEditable(false); + comboTargetValue.setTriggerAction(TriggerAction.ALL); + - final TextField sourceValueArg = new TextField(); - sourceValueArg.setItemId(itemIdSourceValueArg); - - - final TextField targetValueArg = new TextField(); - targetValueArg.setItemId(itemIdTargetValueArg); - final IconButton btnAdd = new IconButton(); btnAdd.setItemId(itemIdBtnAdd); btnAdd.setIcon(ResourceBundle.INSTANCE.add()); @@ -110,7 +238,7 @@ public class ColumnMappingPanel extends FramedPanel implements } }); - btnAdd.setVisible(false); + btnAdd.setVisible(true); final IconButton btnDel = new IconButton(); btnDel.setItemId(itemIdBtnDel); @@ -123,7 +251,7 @@ public class ColumnMappingPanel extends FramedPanel implements if (vert.getWidgetCount() == 0) { setup(); } else { - + } thisPanel.forceLayout(); vert.forceLayout(); @@ -133,32 +261,21 @@ public class ColumnMappingPanel extends FramedPanel implements btnDel.setVisible(false); + + horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); + horiz.setPack(BoxLayoutPack.START); + + horiz.add(comboSourceValue, new BoxLayoutData(new Margins(2, 4, 2, 4))); + horiz.add(comboTargetValue, new BoxLayoutData(new Margins(2, 4, 2, 4))); + horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 4, 2, 4))); + horiz.add(btnDel, new BoxLayoutData(new Margins(2, 4, 2, 4))); + + vert.add(horiz); add(vert); } - - protected void addColumnMappingData(){ - - } - - @Override - public void selectedDimensionRow(DimensionRow dimensionRow) { - // TODO Auto-generated method stub + protected void addColumnMappingData() { } - @Override - public void abortedDimensionRowSelection() { - // TODO Auto-generated method stub - - } - - @Override - public void failedDimensionRowSelection(String reason, String detail) { - // TODO Auto-generated method stub - - } - - - } diff --git a/templates/changelog.xml b/templates/changelog.xml index 598c63e..8d39f9f 100644 --- a/templates/changelog.xml +++ b/templates/changelog.xml @@ -1,4 +1,9 @@ + + Added Column Mapping + Fixed Replace + Added Replace Batch