From 330c49acfec805fbad2d5aea7e6d4340c6aee72a Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 22 Oct 2014 08:26:35 +0000 Subject: [PATCH] Updated Detail Panel git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-map-widget@100835 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../mapwidget/client/MapWidgetDetailCard.java | 54 +++++++++++++++++-- templates/changelog.xml | 2 +- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetDetailCard.java b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetDetailCard.java index 028a735..c20e9d7 100644 --- a/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetDetailCard.java +++ b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetDetailCard.java @@ -6,9 +6,11 @@ package org.gcube.portlets.user.td.mapwidget.client; import java.util.ArrayList; 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.licenses.LicenceData; import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession; +import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; 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.wizardwidget.client.WizardCard; @@ -21,7 +23,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.VerticalPanel; import com.sencha.gxt.data.shared.loader.ListLoadConfig; import com.sencha.gxt.data.shared.loader.ListLoadResult; -import com.sencha.gxt.data.shared.loader.ListLoadResultBean; import com.sencha.gxt.data.shared.loader.ListLoader; import com.sencha.gxt.widget.core.client.FramedPanel; import com.sencha.gxt.widget.core.client.box.AlertMessageBox; @@ -99,6 +100,7 @@ public class MapWidgetDetailCard extends WizardCard { userName.setValue(mapCreationSession.getUsername()); p.add(new FieldLabel(userName, "User Name"), new VerticalLayoutData(1, -1)); + userName.setReadOnly(true); metaAbstract = new TextField(); metaAbstract.setAllowBlank(false); @@ -129,11 +131,14 @@ public class MapWidgetDetailCard extends WizardCard { 1, -1)); tableDetailPanel.add(form); - + setContent(tableDetailPanel); - + + retrieveInfo(); + } + /* protected void loadData(ListLoadConfig loadConfig, final AsyncCallback> callback) { TDGWTServiceAsync.INSTANCE @@ -164,7 +169,50 @@ public class MapWidgetDetailCard extends WizardCard { }); } + */ + protected void updateInfo(TabResource tabResource){ + name.setValue(tabResource.getName()); + metaAbstract.setValue(tabResource.getDescription()); + forceLayout(); + } + + protected void retrieveInfo() { + + TDGWTServiceAsync.INSTANCE.getTabResourceInformation(mapCreationSession.getTrId(), new AsyncCallback() { + public void onFailure(Throwable caught) { + if (caught instanceof TDGWTSessionExpiredException) { + getEventBus() + .fireEvent( + new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + if (caught instanceof TDGWTIsLockedException) { + Log.error("Error: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + caught.getLocalizedMessage()); + } else { + Log.error("Error retrieving tabular resource information:" + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrieving tabular resource information"); + } + } + + } + + public void onSuccess(TabResource result) { + Log.debug("Retrieved: "+result); + updateInfo(result); + } + + }); + + } + + + @Override public void setup() { Command sayNextCard = new Command() { diff --git a/templates/changelog.xml b/templates/changelog.xml index 07cb684..0ff1c39 100644 --- a/templates/changelog.xml +++ b/templates/changelog.xml @@ -1,6 +1,6 @@ + date="2014-10-31"> First Release \ No newline at end of file