Fixed resource id

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-resources-widget@147142 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-04-26 09:48:43 +00:00
parent 1a33a672c3
commit e6b7d8c1a9
4 changed files with 68 additions and 41 deletions

View File

@ -840,7 +840,7 @@ public class ResourcesListViewPanel extends FramedPanel {
protected void requestOpen(ResourceTDDescriptor resourceTDDescriptor) {
switch (resourceTDDescriptor.getResourceType()) {
case CHART:
repquestOpenChart(resourceTDDescriptor);
requestOpenChart(resourceTDDescriptor);
break;
case CODELIST:
break;
@ -867,7 +867,7 @@ public class ResourcesListViewPanel extends FramedPanel {
}
private void repquestOpenChart(ResourceTDDescriptor resourceTDDescriptor) {
private void requestOpenChart(ResourceTDDescriptor resourceTDDescriptor) {
ChartViewerDialog chartDialog = new ChartViewerDialog(
resourceTDDescriptor, trId, eventBus);
chartDialog.show();

View File

@ -80,8 +80,9 @@ public class ChartViewerPanel extends FramedPanel {
private static final int IMAGE_HEIGHT = 768;
// private static final String RETRIEVE_CHART_FILE_SERVLET =
// "RetrieveChartFileServlet";
//private static final String RETRIEVE_FILE_AND_DISCOVER_MIME_TYPE_SERVLET = "RetrieveFileAndDiscoverMimeTypeServlet";
//private static final String ATTRIBUTE_STORAGE_URI = "storageURI";
// private static final String RETRIEVE_FILE_AND_DISCOVER_MIME_TYPE_SERVLET
// = "RetrieveFileAndDiscoverMimeTypeServlet";
// private static final String ATTRIBUTE_STORAGE_URI = "storageURI";
private static final String WIDTH = "810px";
private static final String HEIGHT = "440px";
@ -165,11 +166,11 @@ public class ChartViewerPanel extends FramedPanel {
}
protected void initMessages(){
protected void initMessages() {
msgs = GWT.create(ChartViewerMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
public static String encodeUrlDelimiters(String s) {
if (s == null) {
return null;
@ -205,47 +206,59 @@ public class ChartViewerPanel extends FramedPanel {
}
protected void retrieveUrlFromResolver() {
String name=resourceTDDescriptor.getName();
MimeTypeSupport mts=MimeTypeSupport.getMimeTypeSupportFromMimeName(internalURITD.getMimeType());
if(mts!=null){
name=name+mts.getExtension();
}
UriResolverSession uriResolverSession = new UriResolverSession(
internalURITD.getId(), ApplicationType.SMP_ID,
name, internalURITD.getMimeType());
Log.debug("UriResolverSession: "+uriResolverSession);
TDGWTServiceAsync.INSTANCE.getUriFromResolver(uriResolverSession,
new AsyncCallback<String>() {
String name = resourceTDDescriptor.getName();
MimeTypeSupport mts = MimeTypeSupport
.getMimeTypeSupportFromMimeName(internalURITD.getMimeType());
if (mts != null) {
name = name + mts.getExtension();
}
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorRetrievingUriFromResolverFixed()
+ caught.getLocalizedMessage());
if (internalURITD.getId() != null
&& !internalURITD.getId().isEmpty()
&& (internalURITD.getId().startsWith("http:") || internalURITD
.getId().startsWith("https:"))) {
Log.debug("Use direct link: " + internalURITD.getId());
chartLink = internalURITD.getId();
createChartImageResource();
} else {
UriResolverSession uriResolverSession = new UriResolverSession(
internalURITD.getId(), ApplicationType.SMP_ID, name,
internalURITD.getMimeType());
Log.debug("UriResolverSession: " + uriResolverSession);
TDGWTServiceAsync.INSTANCE.getUriFromResolver(uriResolverSession,
new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error with uri resolver: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert(
msgsCommon.error(),
msgs.errorRetrievingUriFromResolverFixed()
+ caught.getLocalizedMessage());
}
}
}
public void onSuccess(String link) {
Log.debug("Retrieved link: " + link);
chartLink = link;
createChartImageResource();
}
});
public void onSuccess(String link) {
Log.debug("Retrieved link: " + link);
chartLink = link;
createChartImageResource();
}
});
}
}
protected void createChartImageResource() {
/*final String path = GWT.getModuleBaseURL()
+ RETRIEVE_FILE_AND_DISCOVER_MIME_TYPE_SERVLET;*/
/*
* final String path = GWT.getModuleBaseURL() +
* RETRIEVE_FILE_AND_DISCOVER_MIME_TYPE_SERVLET;
*/
chartImageResource = new ImageResource() {

View File

@ -1,8 +1,10 @@
package org.gcube.portlets.user.td.resourceswidget.client.save;
import org.gcube.portlets.user.td.gwtservice.shared.destination.WorkspaceDestination;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.SaveResourceSession;
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
import com.allen_sauer.gwt.log.client.Log;
import com.google.web.bindery.event.shared.EventBus;
/**
@ -26,10 +28,22 @@ public class SaveResourceWizard extends WizardWindow {
super(title, eventBus);
setWidth(WIZARDWIDTH);
/*
Log.info("NextCard DestinationSelectionCard");
DestinationSelectionCard destinationSelectionCard = new DestinationSelectionCard(
saveResourceSession);
addCard(destinationSelectionCard);
destinationSelectionCard.setup();
*/
Log.info("NextCard WorkspaceSelectionCard");
WorkspaceDestination workspaceDestination = WorkspaceDestination.INSTANCE;
saveResourceSession.setDestination(workspaceDestination);
WorkSpaceSelectionCard workspaceSelectionCard = new WorkSpaceSelectionCard(
saveResourceSession);
addCard(workspaceSelectionCard);
workspaceSelectionCard.setup();
}

View File

@ -208,8 +208,8 @@ public class WorkSpaceSelectionCard extends WizardCard {
};
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
setBackButtonVisible(true);
setEnableBackButton(true);
setBackButtonVisible(false);
setEnableBackButton(false);
setEnableNextButton(true);
}