diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/EditRowPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/EditRowPanel.java index 08225ce..978b1f9 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/EditRowPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/EditRowPanel.java @@ -8,6 +8,8 @@ import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSele 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.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; 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; @@ -208,10 +210,16 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.error("load columns failure:" - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error retrieving columns", - "Error retrieving columns"); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Locked", + caught.getLocalizedMessage()); + } else { + Log.error("load columns failure:" + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error retrieving columns", + "Error retrieving columns"); + } } } @@ -565,8 +573,10 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener { maps.put(columnId, val); } else { UtilsGXT3 - .alert("Attentions","The value of "+ - colCurrent.getLabel() + .alert("Attentions", + "The value of " + + colCurrent + .getLabel() + " is not a valid text representation for geometry type ( e.g. POINT(34 56) or LINESTRING(65 34, 56.43 78.65)!"); btnSave.enable(); return; @@ -661,8 +671,20 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - UtilsGXT3.alert("Error", - "Error in operation invocation!"); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Locked", + caught.getLocalizedMessage()); + } else { + if (caught instanceof TDGWTIsFinalException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Final", + caught.getLocalizedMessage()); + } else { + UtilsGXT3.alert("Error", + "Error in operation invocation!"); + } + } } } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTablePanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTablePanel.java index 0372954..d433542 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTablePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTablePanel.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations; @@ -194,11 +195,17 @@ public class ValidationsTablePanel extends FramedPanel { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.error("Load validations metadata failure: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert( - "Error retrieving validations metadata", - "Error retrieving validations metadata"); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Locked", + caught.getLocalizedMessage()); + } else { + Log.error("Load validations metadata failure: " + + caught.getLocalizedMessage()); + UtilsGXT3 + .alert("Error retrieving validations metadata", + "Error retrieving validations metadata"); + } } callback.onFailure(caught); } @@ -241,10 +248,16 @@ public class ValidationsTablePanel extends FramedPanel { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.error("Error retrieving current TRId: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error", - "Error retrieving current tabular resource id"); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Locked", + caught.getLocalizedMessage()); + } else { + Log.error("Error retrieving current TRId: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrieving current tabular resource id"); + } } } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java index a0d29c9..046ada4 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java @@ -7,6 +7,8 @@ import java.util.List; 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.OperationsId; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; 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.task.TaskResumeSession; @@ -76,7 +78,7 @@ import com.sencha.gxt.widget.core.client.treegrid.TreeGrid; * */ public class ValidationsTasksPanel extends FramedPanel implements -MonitorDialogListener { + MonitorDialogListener { protected String WIDTH = "298px"; protected String HEIGHT = "520px"; protected ValidationsTasksPanel thisPanel; @@ -94,15 +96,14 @@ MonitorDialogListener { protected TreeStore store; protected TreeGrid tree; private boolean updateTR; - - + class KeyProvider implements ModelKeyProvider { @Override public String getKey(BaseDto item) { return (item instanceof FolderDto ? "f-" : "v-") + item.getId(); } } - + /** * * @param eventBus @@ -113,12 +114,12 @@ MonitorDialogListener { this.eventBus = eventBus; this.thisPanel = this; forceLayoutOnResize = true; - updateTR=false; + updateTR = false; init(); retrieveCurrentTR(); } - + /** * * @param trId @@ -131,35 +132,32 @@ MonitorDialogListener { this.eventBus = eventBus; this.thisPanel = this; forceLayoutOnResize = true; - updateTR=false; + updateTR = false; init(); retrieveValidations(); } - - protected void init() { setWidth(WIDTH); setHeight(HEIGHT); setHeaderVisible(false); setBodyBorder(false); - + } protected void createTreeData() { - if(updateTR){ + if (updateTR) { store.clear(); store.commitChanges(); addChildrensToStore(); - + } else { create(); } store.commitChanges(); tree.expandAll(); forceLayout(); - - + } protected void create() { @@ -167,9 +165,9 @@ MonitorDialogListener { con.setScrollMode(ScrollMode.AUTO); store = new TreeStore(new KeyProvider()); - + addChildrensToStore(); - + ColumnConfig cc1 = new ColumnConfig( new ToStringValueProvider("task"), 168, "Task"); cc1.setHeader("Task"); @@ -224,7 +222,7 @@ MonitorDialogListener { tree.getView().setAutoFill(true); tree.setBorders(false); tree.setLoadMask(true); - tree.setColumnResize(true); + tree.setColumnResize(true); tree.setAutoExpand(true); tree.getView().setAutoExpandColumn(cc1); @@ -305,12 +303,10 @@ MonitorDialogListener { add(con, new MarginData(0)); } - - - + private void addChildrensToStore() { gen = new TreeDataGenerator(validationsTasksMetadata); - + FolderDto root = gen.getRoot(); for (BaseDto base : root.getChildrens()) { store.add(base); @@ -318,8 +314,7 @@ MonitorDialogListener { processFolder(store, (FolderDto) base); } } - - + } protected void requestSolution(Context context) { @@ -505,11 +500,17 @@ MonitorDialogListener { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.error("Load validations metadata failure: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert( - "Error retrieving validations metadata", - "Error retrieving validations metadata"); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Locked", + caught.getLocalizedMessage()); + } else { + Log.error("Load validations metadata failure: " + + caught.getLocalizedMessage()); + UtilsGXT3 + .alert("Error retrieving validations metadata", + "Error retrieving validations metadata"); + } } } @@ -525,13 +526,13 @@ MonitorDialogListener { } public void update() { - updateTR=true; + updateTR = true; retrieveCurrentTR(); } public void update(TRId trId) { this.trId = trId; - updateTR=true; + updateTR = true; retrieveValidations(); } @@ -543,10 +544,16 @@ MonitorDialogListener { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.error("Error retrieving current TRId: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error", - "Error retrieving current tabular resource id"); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Locked", + caught.getLocalizedMessage()); + } else { + Log.error("Error retrieving current TRId: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrieving current tabular resource id"); + } } } @@ -580,9 +587,21 @@ MonitorDialogListener { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.debug(caught.getLocalizedMessage()); - UtilsGXT3.alert("Error in Resume", - caught.getLocalizedMessage()); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Locked", + caught.getLocalizedMessage()); + } else { + if (caught instanceof TDGWTIsFinalException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Final", + caught.getLocalizedMessage()); + } else { + Log.debug(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error in Resume", + caught.getLocalizedMessage()); + } + } } } @@ -590,18 +609,16 @@ MonitorDialogListener { @Override public void onSuccess(String taskId) { openMonitorDialog(taskId); - + } }); } - - protected void close() { - /*if (parent != null) { - parent.close(); - }*/ + /* + * if (parent != null) { parent.close(); } + */ } // / @@ -648,7 +665,6 @@ MonitorDialogListener { close(); } - // @SuppressWarnings("rawtypes") // protected AbstractCell actionButton = new AbstractCell() {