From 41fecb19941512443cbcf882b72ce801856ddcd2 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 30 Jul 2014 10:59:26 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@99094 82a268e6-3cf1-43bd-a215-b396298e98cf --- .gwt/.gwt-log | 64 +++++++++++ .../client/batch/ReplaceBatchPanel.java | 100 ++++++++++++++---- .../DimensionRowSelectionDialog.java | 13 ++- 3 files changed, 153 insertions(+), 24 deletions(-) diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index 28a156a..22fec81 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -5530,3 +5530,67 @@ 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: 6 seconds) + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 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 13.24 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... + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 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 13.86 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/ReplaceBatchPanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java index a4074ad..b17251d 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 @@ -18,6 +18,7 @@ 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.task.InvocationS; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnViewData; import org.gcube.portlets.user.td.gwtservice.shared.tr.ConditionCode; import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow; import org.gcube.portlets.user.td.gwtservice.shared.tr.RefColumn; @@ -124,6 +125,7 @@ public class ReplaceBatchPanel extends FramedPanel implements private ToolBar toolBarHead; private ComboBox comboShowOccurrencesType = null; + private ListStore storeShowOccurrencesType; private TextButton btnConnect; private TextButton btnDisconnect; @@ -200,11 +202,10 @@ public class ReplaceBatchPanel extends FramedPanel implements // Create Combo Show ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT .create(ShowOccurrencesTypeProperties.class); - ListStore storeShowOccurrencesType = new ListStore( + storeShowOccurrencesType = new ListStore( propsShowOccurrencesType.id()); - storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore - .getShowOccurrencesType()); - + + comboShowOccurrencesType = new ComboBox( storeShowOccurrencesType, propsShowOccurrencesType.label()); Log.trace("ComboMeasureType created"); @@ -261,6 +262,9 @@ public class ReplaceBatchPanel extends FramedPanel implements connectionField = new TextField(); toolBarHead.add(connectionField); + } else { + connectionField = new TextField(); + toolBarHead.add(connectionField); } // Create Grid @@ -434,17 +438,8 @@ public class ReplaceBatchPanel extends FramedPanel implements new Margins(5, 2, 5, 2))); add(v); - if (!column.isViewColumn()) { - Log.debug("Not Is View Column"); - connectionField.setVisible(false); - btnDisconnect.setVisible(false); - - } else { - Log.debug("Is View Column"); - - } - if (curation) { + storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore.getShowOccurrencesType()); if (connection != null) { Log.debug("Selected connection: " + connection); connectionField.setValue(connection.getLabel()); @@ -452,8 +447,29 @@ public class ReplaceBatchPanel extends FramedPanel implements btnDisconnect.setVisible(true); btnConnect.setVisible(false); btnConnect.enable(); + + } else { + + } + toolBarHead.forceLayout(); + } else { + if (column.isViewColumn()) { + Log.debug("Is View Column"); + storeShowOccurrencesType + .add(ShowOccurrencesTypeStore.onlyErrorsElement); + ColumnViewData cViewData = column.getColumnViewData(); + RefColumn refCol = new RefColumn(String.valueOf(cViewData + .getTargetTableId()), + cViewData.getTargetTableColumnId()); + retrieveConnectionForViewColumn(refCol); + } else { + storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore.getShowOccurrencesType()); + Log.debug("Not Is View Column"); + connectionField.setVisible(false); + btnDisconnect.setVisible(false); toolBarHead.forceLayout(); } + } } @@ -569,11 +585,20 @@ public class ReplaceBatchPanel extends FramedPanel implements }); } + /** + * + * @param showType + */ protected void updateShowType(ShowOccurrencesTypeElement showType) { showOccurencesType = showType.getType(); loader.load(); } + /** + * + * @param loadConfig + * @param callback + */ protected void loadData(ListLoadConfig loadConfig, final AsyncCallback> callback) { @@ -792,7 +817,7 @@ public class ReplaceBatchPanel extends FramedPanel implements connection.getName(), connection.getColumnId(), connection.getLabel(), currentReplaceEntry.getRowId(), 0, 0); DimensionRowSelectionDialog dialogDimensionRowSelection = new DimensionRowSelectionDialog( - connection, cellData, eventBus); + connection, cellData, true, eventBus); dialogDimensionRowSelection.addListener(this); dialogDimensionRowSelection.show(); } @@ -819,13 +844,14 @@ public class ReplaceBatchPanel extends FramedPanel implements } Log.debug("Col: " + col + ", CellData:" + cellData); DimensionRowSelectionDialog dialogDimensionRowSelection; - - switch (conditionCode){ + + switch (conditionCode) { case AllowedColumnType: break; case AmbiguousValueOnExternalReference: dialogDimensionRowSelection = new DimensionRowSelectionDialog( - col, cellData, workOnTable, true, true, true, false, eventBus); + col, cellData, workOnTable, true, true, true, false, + eventBus); dialogDimensionRowSelection.addListener(this); dialogDimensionRowSelection.show(); break; @@ -867,9 +893,9 @@ public class ReplaceBatchPanel extends FramedPanel implements dialogDimensionRowSelection.addListener(this); dialogDimensionRowSelection.show(); break; - + } - + } else { cellData = new CellData(currentReplaceEntry.getValue(), column.getName(), column.getColumnId(), column.getLabel(), @@ -1005,4 +1031,38 @@ public class ReplaceBatchPanel extends FramedPanel implements } + protected void retrieveConnectionForViewColumn(RefColumn refCol) { + Log.debug("Retrieve Connection For View Column: " + refCol); + TDGWTServiceAsync.INSTANCE.getConnection(refCol, + 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; + setConnectionForViewColumn(); + } + + }); + + } + + protected void setConnectionForViewColumn() { + Log.debug("Selected connection: " + connection); + connectionField.setValue(connection.getLabel()); + connectionField.setVisible(true); + toolBarHead.forceLayout(); + } + } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/dimension/DimensionRowSelectionDialog.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/dimension/DimensionRowSelectionDialog.java index e9e8b9f..cd1586e 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/dimension/DimensionRowSelectionDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/dimension/DimensionRowSelectionDialog.java @@ -101,8 +101,7 @@ public class DimensionRowSelectionDialog extends Window { protected void config(ColumnData column, CellData cellData, EventBus eventBus) { - Log.debug("DimensionRowSelectionDialog: column:" + column + " cellData" - + cellData); + Log.debug("DimensionRowSelectionDialog: " + column + ", " + cellData); this.column = column; this.eventBus = eventBus; this.cellData = cellData; @@ -169,16 +168,18 @@ public class DimensionRowSelectionDialog extends Window { gridPanel.setVisibleOnlyColumn(column.getRelationship() .getTargetColumnId()); } else { + UtilsGXT3 .alert("Attention", "No valid view column associated with this column!"); + hide(); return; + } } } } - - + if (showValue) { v.add(new FieldLabel(value, "Value"), new VerticalLayoutData(1, -1)); } @@ -224,6 +225,7 @@ public class DimensionRowSelectionDialog extends Window { UtilsGXT3 .alert("Attention", "No valid view column associated with this column!"); + hide(); return; } } @@ -255,9 +257,12 @@ public class DimensionRowSelectionDialog extends Window { tableId = Long.valueOf(column.getRelationship() .getTargetTableId()); } else { + UtilsGXT3.alert("Attention", "No valid table associated with this column!"); + hide(); return; + } } }