From 915eca534495d29c0b3ff9378d8fcbf326fc022a Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 20 May 2014 16:54:30 +0000 Subject: [PATCH] Updated for curation on validations git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@95872 82a268e6-3cf1-43bd-a215-b396298e98cf --- .gwt/.gwt-log | 96 +++++++++++++++++++ .../client/batch/ReplaceBatchDialog.java | 18 +++- .../client/batch/ReplaceBatchPanel.java | 92 +++++++++++++++++- 3 files changed, 204 insertions(+), 2 deletions(-) diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index 2a3b253..7d4f8df 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -3450,3 +3450,99 @@ 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... + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 70% complete (ETR: 2 seconds) + 80% complete (ETR: 1 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 10.68 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 +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 60% complete (ETR: 3 seconds) + 70% complete (ETR: 2 seconds) + 80% complete (ETR: 1 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 10.13 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 +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 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 14.71 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/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchDialog.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchDialog.java index 4d81e2f..9614eae 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchDialog.java @@ -5,9 +5,11 @@ import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; 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.RefColumn; import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnSession; 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.shared.RequestProperties; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -28,8 +30,9 @@ public class ReplaceBatchDialog extends Window { protected String HEIGHT = "530px"; protected TRId trId; protected String columnName = null; + protected RequestProperties requestProperties; protected EventBus eventBus; - + public ReplaceBatchDialog(TRId trId, String columnName, EventBus eventBus) { this.trId = trId; this.columnName = columnName; @@ -39,6 +42,19 @@ public class ReplaceBatchDialog extends Window { columnName, eventBus); add(batchRepalcePanel); } + + public ReplaceBatchDialog(TRId trId, + RequestProperties requestProperties, EventBus eventBus) { + this.trId = trId; + this.requestProperties=requestProperties; + this.eventBus = eventBus; + initWindow(); + ReplaceBatchPanel batchRepalcePanel = new ReplaceBatchPanel(this, trId, + requestProperties, eventBus); + add(batchRepalcePanel); + } + + protected void initWindow() { setWidth(WIDTH); diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java index d690e75..d9dbc22 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java @@ -14,9 +14,11 @@ import org.gcube.portlets.user.td.columnwidget.client.store.ShowOccurrencesTypeE import org.gcube.portlets.user.td.columnwidget.client.store.ShowOccurrencesTypeStore; import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.Constants; 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.DimensionRow; +import org.gcube.portlets.user.td.gwtservice.shared.tr.RefColumn; import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurrences; import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.OccurrencesForReplaceBatchColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnSession; @@ -25,6 +27,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ShowOccurrencesType 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.shared.CellData; +import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestProperties; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -94,6 +97,11 @@ public class ReplaceBatchPanel extends FramedPanel implements protected TextField label = null; protected TRId trId; protected String columnName; + + protected RefColumn refColumn; + protected String columnId; + protected RequestProperties requestProperties; + protected ColumnData column; protected boolean hasValidationColumns; protected ShowOccurrencesType showOccurencesType; @@ -123,7 +131,25 @@ public class ReplaceBatchPanel extends FramedPanel implements protected TextButton btnDisconnect; private boolean simpleReplace; - + + public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId, + RequestProperties requestProperties, EventBus eventBus){ + this.parent = parent; + this.trId = trId; + this.requestProperties=requestProperties; + this.eventBus = eventBus; + columnId=(String)requestProperties.getMap().get(Constants.REQUEST_PROPERTIES_COLUMNID); + refColumn=(RefColumn)requestProperties.getMap().get(Constants.REQUEST_PROPERTIES_REFCOLUMN); + + connection = null; + hasValidationColumns = false; + Log.debug("Create BatchReplacePanel(): [" + trId.toString() + + " , columnName:" + columnName + "]"); + init(); + retrieveConnection(); + + } + public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId, String columnName, EventBus eventBus) { this.parent = parent; @@ -392,6 +418,16 @@ public class ReplaceBatchPanel extends FramedPanel implements if (!column.isViewColumn()) { connectionField.setVisible(false); btnDisconnect.setVisible(false); + } else { + if(connection!=null){ + Log.debug("Selected connection: " + connection); + connectionField.setValue(connection.getLabel()); + connectionField.setVisible(true); + btnDisconnect.setVisible(true); + btnConnect.setVisible(false); + btnConnect.enable(); + toolBarHead.forceLayout(); + } } } @@ -419,6 +455,34 @@ public class ReplaceBatchPanel extends FramedPanel implements }); } + + protected void retrieveColumnByColumnId() { + TDGWTServiceAsync.INSTANCE.getColumn(columnId,trId, + new AsyncCallback() { + + public void onFailure(Throwable caught) { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("load column failure:" + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error retrieving column", + "Error retrieving column"); + } + } + + public void onSuccess(ColumnData result) { + Log.debug("Column: " + result); + column = result; + columnName=result.getName(); + retriveValidationColumn(); + } + + }); + } + + protected void retriveValidationColumn() { TDGWTServiceAsync.INSTANCE.getValidationColumns(trId, columnName, @@ -742,5 +806,31 @@ public class ReplaceBatchPanel extends FramedPanel implements btnConnect.enable(); } + + protected void retrieveConnection(){ + TDGWTServiceAsync.INSTANCE.getConnection(refColumn, + new AsyncCallback() { + + public void onFailure(Throwable caught) { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("load column failure:" + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error retrieving connection", + "Error retrieving connection column"); + } + } + + public void onSuccess(ColumnData result) { + Log.debug("Column: " + result); + connection = result; + retrieveColumnByColumnId(); + } + + }); + + } }