Fixed filename on export
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-json-export-widget@102050 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
62f2b7b275
commit
d7c15ee316
|
@ -5,15 +5,22 @@ package org.gcube.portlets.user.td.jsonexportwidget.client;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.destination.FileDestination;
|
import org.gcube.portlets.user.td.gwtservice.shared.destination.FileDestination;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.destination.WorkspaceDestination;
|
import org.gcube.portlets.user.td.gwtservice.shared.destination.WorkspaceDestination;
|
||||||
|
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.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
import com.google.gwt.user.client.Command;
|
import com.google.gwt.user.client.Command;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.HasValue;
|
import com.google.gwt.user.client.ui.HasValue;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.sencha.gxt.core.client.util.ToggleGroup;
|
import com.sencha.gxt.core.client.util.ToggleGroup;
|
||||||
|
@ -40,6 +47,11 @@ public class DestinationSelectionCard extends WizardCard {
|
||||||
// Default
|
// Default
|
||||||
exportSession.setDestination(workspaceDestination);
|
exportSession.setDestination(workspaceDestination);
|
||||||
|
|
||||||
|
retrieveTabularResource();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void create(){
|
||||||
VerticalPanel destinationSelectionPanel = new VerticalPanel();
|
VerticalPanel destinationSelectionPanel = new VerticalPanel();
|
||||||
destinationSelectionPanel.setStylePrimaryName(res.wizardCSS()
|
destinationSelectionPanel.setStylePrimaryName(res.wizardCSS()
|
||||||
.getImportSelectionSources());
|
.getImportSelectionSources());
|
||||||
|
@ -100,8 +112,48 @@ public class DestinationSelectionCard extends WizardCard {
|
||||||
});
|
});
|
||||||
|
|
||||||
setContent(destinationSelectionPanel);
|
setContent(destinationSelectionPanel);
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void retrieveTabularResource() {
|
||||||
|
TDGWTServiceAsync.INSTANCE
|
||||||
|
.getTabResourceInformation(new AsyncCallback<TabResource>() {
|
||||||
|
|
||||||
|
public void onSuccess(TabResource result) {
|
||||||
|
Log.info("Retrived TR: " + result.getTrId());
|
||||||
|
exportSession.setTabResource(result);
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
getEventBus()
|
||||||
|
.fireEvent(
|
||||||
|
new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
showErrorAndHide("Error Locked",
|
||||||
|
caught.getLocalizedMessage(), "",
|
||||||
|
caught);
|
||||||
|
} else {
|
||||||
|
showErrorAndHide(
|
||||||
|
"Error",
|
||||||
|
"Error retrienving tabular resource info: ",
|
||||||
|
caught.getLocalizedMessage(), caught);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
|
|
@ -57,10 +57,18 @@ public class JSONWorkSpaceSelectionCard extends WizardCard {
|
||||||
p = new VerticalLayoutContainer();
|
p = new VerticalLayoutContainer();
|
||||||
formPanel.setWidget(p);
|
formPanel.setWidget(p);
|
||||||
|
|
||||||
|
String fileN = "Name";
|
||||||
|
if (exportSession.getTabResource() != null
|
||||||
|
&& exportSession.getTabResource().getName() != null &&
|
||||||
|
!exportSession.getTabResource().getName().isEmpty()) {
|
||||||
|
fileN=exportSession.getTabResource().getName();
|
||||||
|
fileN=fileN.trim();
|
||||||
|
}
|
||||||
|
|
||||||
fileName = new TextField();
|
fileName = new TextField();
|
||||||
fileName.setAllowBlank(false);
|
fileName.setAllowBlank(false);
|
||||||
fileName.setWidth("410px");
|
fileName.setWidth("410px");
|
||||||
fileName.setValue("filename.json");
|
fileName.setValue(fileN+".json");
|
||||||
p.add(new FieldLabel(fileName, "File Name"), new VerticalLayoutData(-1,
|
p.add(new FieldLabel(fileName, "File Name"), new VerticalLayoutData(-1,
|
||||||
-1));
|
-1));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue