From a6fb69823a684de97df0f552c33c56bea0068f61 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 30 Sep 2014 10:42:05 +0000 Subject: [PATCH] Fixed Final and Lock error git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-information-widget@100280 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/TabularResourceProperties.java | 84 +++++++++++++------ 1 file changed, 57 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java b/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java index 3953a90..7d246ec 100644 --- a/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java +++ b/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java @@ -6,6 +6,8 @@ import java.util.HashMap; import java.util.List; 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.licenses.LicenceData; import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts; @@ -117,9 +119,7 @@ public class TabularResourceProperties extends FramedPanel { retrieveLicencesList(); } - - - + public void addTabularResource() { trFieldSet = new FieldSet(); trFieldSet.setHeadingText("Tabular Resource"); @@ -180,7 +180,6 @@ public class TabularResourceProperties extends FramedPanel { storeCombo = new ListStore(propsLicenceData.id()); storeCombo.addAll(licencesList); - comboLicences = new ComboBox(storeCombo, propsLicenceData.licence()); comboLicences.setMinListWidth(250); @@ -292,6 +291,7 @@ public class TabularResourceProperties extends FramedPanel { UtilsGXT3.alert("Error", "Error retrieving licences."); } + } public void onSuccess(ArrayList result) { @@ -313,7 +313,7 @@ public class TabularResourceProperties extends FramedPanel { dateField.setValue(tabResource.getDate()); typeField.setValue(tabResource.getTrId().getTabularResourceType()); rightField.setValue(tabResource.getRight()); - + validFromField.clear(); if (tabResource.getValidFrom() == null || tabResource.getValidFrom().isEmpty()) { @@ -329,7 +329,7 @@ public class TabularResourceProperties extends FramedPanel { e.printStackTrace(); } } - + validUntilToField.clear(); if (tabResource.getValidUntilTo() == null || tabResource.getValidUntilTo().isEmpty()) { @@ -452,12 +452,18 @@ public class TabularResourceProperties extends FramedPanel { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.error("Error retrienving properties: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert( - "Error", - "Error retrienving properties: " - + caught.getLocalizedMessage()); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Locked", + caught.getLocalizedMessage()); + } else { + Log.error("Error retrienving properties: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrienving properties: " + + caught.getLocalizedMessage()); + } + } } @@ -480,11 +486,17 @@ public class TabularResourceProperties extends FramedPanel { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.error("Error retrienving Share Informations: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error", - "Error retrienving Share Informations: " - + caught.getLocalizedMessage()); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Locked", + caught.getLocalizedMessage()); + } else { + Log.error("Error retrienving Share Informations: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrienving Share Informations: " + + caught.getLocalizedMessage()); + } } } @@ -506,12 +518,17 @@ public class TabularResourceProperties extends FramedPanel { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.error("Error retrienving Last Table: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert( - "Error", - "Error retrienving Last Table: " - + caught.getLocalizedMessage()); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Locked", + caught.getLocalizedMessage()); + } else { + Log.error("Error retrienving Last Table: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrienving Last Table: " + + caught.getLocalizedMessage()); + } } } @@ -581,11 +598,24 @@ public class TabularResourceProperties extends FramedPanel { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.error("Error Setting Tabular Resoruce Properties: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error", - "Error setting tabular resource properties: " + 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.error("Error Setting Tabular Resoruce Properties: " + caught.getLocalizedMessage()); + UtilsGXT3 + .alert("Error", + "Error setting tabular resource properties: " + + caught.getLocalizedMessage()); + } + } } }