2016-04-06 18:28:32 +02:00
|
|
|
package org.gcube.portlets.user.dataminermanager.client.dataspace;
|
|
|
|
|
2016-05-05 18:54:15 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
|
|
|
|
import org.gcube.portlets.user.dataminermanager.client.events.DataMinerWorkAreaEvent;
|
2016-04-22 15:49:49 +02:00
|
|
|
import org.gcube.portlets.user.dataminermanager.client.events.DeleteItemRequestEvent;
|
2016-04-26 18:27:28 +02:00
|
|
|
import org.gcube.portlets.user.dataminermanager.client.events.RefreshDataMinerWorkAreaEvent;
|
2016-04-06 18:28:32 +02:00
|
|
|
import org.gcube.portlets.user.dataminermanager.client.events.SessionExpiredEvent;
|
|
|
|
import org.gcube.portlets.user.dataminermanager.client.events.UIStateEvent;
|
|
|
|
import org.gcube.portlets.user.dataminermanager.client.rpc.DataMinerPortletServiceAsync;
|
2016-04-22 15:49:49 +02:00
|
|
|
import org.gcube.portlets.user.dataminermanager.client.type.DataMinerWorkAreaElementType;
|
2016-04-06 18:28:32 +02:00
|
|
|
import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
|
|
|
|
import org.gcube.portlets.user.dataminermanager.shared.exception.ExpiredSessionServiceException;
|
|
|
|
import org.gcube.portlets.user.dataminermanager.shared.workspace.ItemDescription;
|
|
|
|
import org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
|
|
|
|
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE;
|
|
|
|
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
|
|
|
|
import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel;
|
|
|
|
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
2016-05-05 18:54:15 +02:00
|
|
|
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
2016-04-06 18:28:32 +02:00
|
|
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
|
|
|
|
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
|
|
|
import com.google.gwt.user.client.Window;
|
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
|
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
|
|
|
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
|
|
|
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
|
|
|
import com.sencha.gxt.core.client.util.Margins;
|
2016-05-18 17:32:11 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
2016-04-06 18:28:32 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
|
|
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
|
|
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
|
|
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
|
|
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
|
|
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|
|
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @author Giancarlo Panichi email: <a
|
|
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
|
|
*
|
|
|
|
*/
|
2016-05-18 17:32:11 +02:00
|
|
|
public class OutputDataSetsPanel extends FramedPanel {
|
2016-04-20 18:14:20 +02:00
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
private Item selectedItem;
|
|
|
|
private MultipleDNDUpload dnd;
|
|
|
|
private WorkspaceResourcesExplorerPanel wsResourcesExplorerPanel;
|
2016-05-17 18:42:32 +02:00
|
|
|
private TextButton btnDownload;
|
2016-04-06 18:28:32 +02:00
|
|
|
private TextButton btnDelete;
|
2016-04-26 18:27:28 +02:00
|
|
|
private TextButton btnRefresh;
|
2016-04-06 18:28:32 +02:00
|
|
|
private VerticalLayoutContainer v;
|
|
|
|
|
2016-04-20 18:14:20 +02:00
|
|
|
public OutputDataSetsPanel() {
|
2016-04-06 18:28:32 +02:00
|
|
|
super();
|
2016-04-20 18:14:20 +02:00
|
|
|
Log.debug("OutputDataSetsPanel");
|
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
// msgs = GWT.create(ServiceCategoryMessages.class);
|
|
|
|
init();
|
|
|
|
bindToEvents();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void init() {
|
2016-04-20 18:14:20 +02:00
|
|
|
setId("OutputDataSetsPanel");
|
2016-04-06 18:28:32 +02:00
|
|
|
forceLayoutOnResize = true;
|
2016-04-26 18:27:28 +02:00
|
|
|
setBodyBorder(false);
|
|
|
|
setBorders(false);
|
2016-05-18 17:32:11 +02:00
|
|
|
setHeaderVisible(false);
|
2016-04-06 18:28:32 +02:00
|
|
|
setResize(true);
|
|
|
|
setAnimCollapse(false);
|
2016-04-20 18:14:20 +02:00
|
|
|
setHeadingText("Output Data Sets");
|
2016-05-18 17:32:11 +02:00
|
|
|
setBodyStyle("backgroundColor:white;");
|
2016-04-06 18:28:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void bindToEvents() {
|
|
|
|
|
|
|
|
EventBusProvider.INSTANCE.addHandler(UIStateEvent.TYPE,
|
|
|
|
new UIStateEvent.UIStateEventHandler() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onChange(UIStateEvent event) {
|
|
|
|
manageStateEvents(event);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaEvent.TYPE,
|
|
|
|
new DataMinerWorkAreaEvent.DataMinerWorkAreaEventHandler() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onChange(DataMinerWorkAreaEvent event) {
|
|
|
|
manageDataMinerWorkAreaEvents(event);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2016-05-05 18:54:15 +02:00
|
|
|
|
2016-04-26 18:27:28 +02:00
|
|
|
EventBusProvider.INSTANCE
|
2016-05-05 18:54:15 +02:00
|
|
|
.addHandler(
|
|
|
|
RefreshDataMinerWorkAreaEvent.TYPE,
|
|
|
|
new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() {
|
2016-04-26 18:27:28 +02:00
|
|
|
|
2016-05-05 18:54:15 +02:00
|
|
|
@Override
|
|
|
|
public void onRefresh(
|
|
|
|
RefreshDataMinerWorkAreaEvent event) {
|
|
|
|
manageRefreshDataMinerWorkAreaEvents(event);
|
2016-04-26 18:27:28 +02:00
|
|
|
|
2016-05-05 18:54:15 +02:00
|
|
|
}
|
2016-04-26 18:27:28 +02:00
|
|
|
|
2016-05-05 18:54:15 +02:00
|
|
|
});
|
2016-04-06 18:28:32 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void manageStateEvents(UIStateEvent event) {
|
2016-05-17 18:42:32 +02:00
|
|
|
Log.debug("OutputDataSetsPanel recieved UIStateEvent: " + event);
|
|
|
|
if (event == null) {
|
|
|
|
Log.error("UIStateEvent");
|
|
|
|
return;
|
|
|
|
}
|
2016-04-06 18:28:32 +02:00
|
|
|
switch (event.getUiStateType()) {
|
|
|
|
case START:
|
|
|
|
break;
|
|
|
|
case WAITING:
|
|
|
|
break;
|
|
|
|
case UPDATE:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void manageDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
|
2016-05-17 18:42:32 +02:00
|
|
|
Log.debug("OutputDataSetsPanel recieved DataMinerWorkAreaEvent: "
|
|
|
|
+ event);
|
|
|
|
if (event == null) {
|
|
|
|
Log.error("DataMinerWorkAreaEvent");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (event.getDataMinerWorkAreaRegionType()) {
|
|
|
|
case Computations:
|
|
|
|
break;
|
|
|
|
case DataSets:
|
|
|
|
manageMyDataMinerWorkAreaEvents(event);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2016-04-20 18:14:20 +02:00
|
|
|
|
2016-05-17 18:42:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void manageMyDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
|
2016-04-06 18:28:32 +02:00
|
|
|
switch (event.getDataMinerWorkAreaEventType()) {
|
|
|
|
case OPEN:
|
|
|
|
case UPDATE:
|
2016-04-26 18:27:28 +02:00
|
|
|
refreshWSResourceExplorerPanel(event);
|
2016-04-06 18:28:32 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-05-05 18:54:15 +02:00
|
|
|
|
2016-04-26 18:27:28 +02:00
|
|
|
private void manageRefreshDataMinerWorkAreaEvents(
|
|
|
|
RefreshDataMinerWorkAreaEvent event) {
|
2016-05-17 18:42:32 +02:00
|
|
|
Log.debug("OutputDataSetsPanel recieved RefreshDataMinerWorkAreaEvent: "
|
|
|
|
+ event);
|
|
|
|
if (event == null) {
|
|
|
|
Log.error("RefreshDataMinerWorkAreaEvent");
|
|
|
|
return;
|
|
|
|
}
|
2016-04-26 18:27:28 +02:00
|
|
|
switch (event.getDataMinerWorkAreaElementType()) {
|
|
|
|
case Computations:
|
|
|
|
break;
|
|
|
|
case InputDataSets:
|
|
|
|
break;
|
|
|
|
case OutputDataSets:
|
|
|
|
refreshWSResourceExplorerPanel();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2016-04-06 18:28:32 +02:00
|
|
|
|
2016-04-26 18:27:28 +02:00
|
|
|
}
|
2016-05-05 18:54:15 +02:00
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
private void create(DataMinerWorkAreaEvent event) {
|
|
|
|
try {
|
2016-04-20 18:14:20 +02:00
|
|
|
|
|
|
|
if (event == null
|
|
|
|
|| event.getDataMinerWorkArea() == null
|
|
|
|
|| event.getDataMinerWorkArea().getOutputDataSets() == null
|
|
|
|
|| event.getDataMinerWorkArea().getOutputDataSets()
|
|
|
|
.getFolder() == null
|
|
|
|
|| event.getDataMinerWorkArea().getOutputDataSets()
|
|
|
|
.getFolder().getId() == null
|
|
|
|
|| event.getDataMinerWorkArea().getOutputDataSets()
|
|
|
|
.getFolder().getId().isEmpty()) {
|
|
|
|
if (v != null) {
|
2016-04-06 18:28:32 +02:00
|
|
|
remove(v);
|
|
|
|
forceLayout();
|
|
|
|
}
|
|
|
|
return;
|
2016-04-20 18:14:20 +02:00
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
}
|
|
|
|
|
2016-05-05 18:54:15 +02:00
|
|
|
List<String> showProperties = new ArrayList<String>();
|
2016-05-13 11:11:09 +02:00
|
|
|
for (DataSpacePropertiesType dataSpaceProperties : DataSpacePropertiesType
|
|
|
|
.values()) {
|
|
|
|
showProperties.add(dataSpaceProperties.getLabel());
|
|
|
|
}
|
2016-05-05 18:54:15 +02:00
|
|
|
FilterCriteria filterCriteria = new FilterCriteria();
|
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
|
filterCriteria.setRequiredProperties(map);
|
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel(
|
2016-04-20 18:14:20 +02:00
|
|
|
event.getDataMinerWorkArea().getOutputDataSets()
|
2016-05-05 18:54:15 +02:00
|
|
|
.getFolder().getId(), false, showProperties,
|
2016-05-18 17:32:11 +02:00
|
|
|
filterCriteria, true);
|
2016-04-06 18:28:32 +02:00
|
|
|
|
|
|
|
WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() {
|
|
|
|
@Override
|
|
|
|
public void onSelectedItem(Item item) {
|
|
|
|
Log.debug("Listener Selected Item " + item);
|
|
|
|
selectedItem = item;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailed(Throwable throwable) {
|
|
|
|
Log.error(throwable.getLocalizedMessage());
|
|
|
|
throwable.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onAborted() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNotValidSelection() {
|
|
|
|
selectedItem = null;
|
|
|
|
}
|
|
|
|
};
|
2016-04-22 15:49:49 +02:00
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
wsResourcesExplorerPanel
|
|
|
|
.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener);
|
|
|
|
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel");
|
|
|
|
|
|
|
|
VerticalLayoutContainer vResourcesExplorerContainer = new VerticalLayoutContainer();
|
|
|
|
vResourcesExplorerContainer.setScrollMode(ScrollMode.AUTO);
|
|
|
|
vResourcesExplorerContainer.add(wsResourcesExplorerPanel,
|
|
|
|
new VerticalLayoutData(1, -1, new Margins(0)));
|
|
|
|
|
|
|
|
// DND
|
|
|
|
|
|
|
|
dnd = new MultipleDNDUpload();
|
2016-04-20 18:14:20 +02:00
|
|
|
dnd.setParameters(event.getDataMinerWorkArea().getOutputDataSets()
|
|
|
|
.getFolder().getId(), UPLOAD_TYPE.File);
|
2016-04-06 18:28:32 +02:00
|
|
|
dnd.addUniqueContainer(vResourcesExplorerContainer);
|
|
|
|
WorskpaceUploadNotificationListener workspaceUploaderListener = new WorskpaceUploadNotificationListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onUploadCompleted(String parentId, String itemId) {
|
|
|
|
Log.debug("Upload completed: [parentID: " + parentId
|
|
|
|
+ ", itemId: " + itemId + "]");
|
|
|
|
wsResourcesExplorerPanel.refreshRootFolderView();
|
|
|
|
forceLayout();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onUploadAborted(String parentId, String itemId) {
|
|
|
|
Log.debug("Upload Aborted: [parentID: " + parentId
|
|
|
|
+ ", itemId: " + itemId + "]");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onError(String parentId, String itemId,
|
|
|
|
Throwable throwable) {
|
|
|
|
Log.debug("Upload Error: [parentID: " + parentId
|
|
|
|
+ ", itemId: " + itemId + "]");
|
|
|
|
throwable.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onOverwriteCompleted(String parentId, String itemId) {
|
|
|
|
Log.debug("Upload Override Completed: [parentID: "
|
|
|
|
+ parentId + ", itemId: " + itemId + "]");
|
|
|
|
wsResourcesExplorerPanel.refreshRootFolderView();
|
|
|
|
forceLayout();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
dnd.addWorkspaceUploadNotificationListener(workspaceUploaderListener);
|
2016-04-22 15:49:49 +02:00
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
// ToolBar
|
2016-05-17 18:42:32 +02:00
|
|
|
btnDownload = new TextButton("Download");
|
2016-04-06 18:28:32 +02:00
|
|
|
// btnOpen.setIcon(StatAlgoImporterResources.INSTANCE.download16());
|
2016-05-17 18:42:32 +02:00
|
|
|
btnDownload.setScale(ButtonScale.SMALL);
|
|
|
|
btnDownload.setIconAlign(IconAlign.LEFT);
|
|
|
|
btnDownload.setToolTip("Download");
|
|
|
|
btnDownload.addSelectHandler(new SelectHandler() {
|
2016-04-06 18:28:32 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSelect(SelectEvent event) {
|
2016-05-17 18:42:32 +02:00
|
|
|
downloadFile();
|
2016-04-06 18:28:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2016-04-22 15:49:49 +02:00
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
btnDelete = new TextButton("Delete");
|
|
|
|
// btnDelete.setIcon(StatAlgoImporterResources.INSTANCE.delete16());
|
|
|
|
btnDelete.setScale(ButtonScale.SMALL);
|
|
|
|
btnDelete.setIconAlign(IconAlign.LEFT);
|
|
|
|
btnDelete.setToolTip("Delete");
|
|
|
|
btnDelete.addSelectHandler(new SelectHandler() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSelect(SelectEvent event) {
|
|
|
|
deleteItem(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2016-04-26 18:27:28 +02:00
|
|
|
btnRefresh = new TextButton("Refresh");
|
|
|
|
// btnRefresh.setIcon(StatAlgoImporterResources.INSTANCE.reload16());
|
|
|
|
btnRefresh.setScale(ButtonScale.SMALL);
|
|
|
|
btnRefresh.setIconAlign(IconAlign.LEFT);
|
|
|
|
btnRefresh.setToolTip("Refresh");
|
|
|
|
btnRefresh.addSelectHandler(new SelectHandler() {
|
2016-04-06 18:28:32 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSelect(SelectEvent event) {
|
2016-04-26 18:27:28 +02:00
|
|
|
refreshWSResourceExplorerPanel();
|
2016-04-06 18:28:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
ToolBar toolBar = new ToolBar();
|
2016-05-17 18:42:32 +02:00
|
|
|
toolBar.add(btnDownload, new BoxLayoutData(new Margins(0)));
|
2016-04-06 18:28:32 +02:00
|
|
|
toolBar.add(btnDelete, new BoxLayoutData(new Margins(0)));
|
2016-04-26 18:27:28 +02:00
|
|
|
toolBar.add(btnRefresh, new BoxLayoutData(new Margins(0)));
|
2016-04-06 18:28:32 +02:00
|
|
|
|
|
|
|
v = new VerticalLayoutContainer();
|
|
|
|
|
|
|
|
v.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
|
|
|
v.add(dnd, new VerticalLayoutData(1, 1, new Margins(0)));
|
|
|
|
add(v);
|
|
|
|
forceLayout();
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
Log.error("Error opening wsResourceExplorerPanel");
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
2016-04-20 18:14:20 +02:00
|
|
|
|
2016-04-26 18:27:28 +02:00
|
|
|
private void refreshWSResourceExplorerPanel() {
|
2016-04-06 18:28:32 +02:00
|
|
|
if (wsResourcesExplorerPanel != null) {
|
|
|
|
wsResourcesExplorerPanel.refreshRootFolderView();
|
|
|
|
}
|
|
|
|
}
|
2016-04-20 18:14:20 +02:00
|
|
|
|
2016-04-26 18:27:28 +02:00
|
|
|
private void refreshWSResourceExplorerPanel(DataMinerWorkAreaEvent event) {
|
2016-04-20 18:14:20 +02:00
|
|
|
try {
|
|
|
|
|
|
|
|
if (v != null) {
|
|
|
|
remove(v);
|
|
|
|
create(event);
|
|
|
|
} else {
|
|
|
|
create(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Throwable e) {
|
2016-04-22 15:49:49 +02:00
|
|
|
Log.error("Error in OutputDataSetsPanel: "
|
|
|
|
+ e.getLocalizedMessage());
|
2016-04-20 18:14:20 +02:00
|
|
|
e.printStackTrace();
|
2016-04-06 18:28:32 +02:00
|
|
|
}
|
|
|
|
}
|
2016-04-20 18:14:20 +02:00
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
private void deleteItem(SelectEvent event) {
|
|
|
|
ItemDescription itemDescription = new ItemDescription(
|
|
|
|
selectedItem.getId(), selectedItem.getName(),
|
|
|
|
selectedItem.getOwner(), selectedItem.getPath(), selectedItem
|
|
|
|
.getType().name());
|
2016-04-22 15:49:49 +02:00
|
|
|
DeleteItemRequestEvent deleteItemEvent = new DeleteItemRequestEvent(
|
|
|
|
DataMinerWorkAreaElementType.OutputDataSets, itemDescription);
|
2016-04-06 18:28:32 +02:00
|
|
|
EventBusProvider.INSTANCE.fireEvent(deleteItemEvent);
|
|
|
|
Log.debug("Fired: " + deleteItemEvent);
|
|
|
|
}
|
|
|
|
|
2016-05-17 18:42:32 +02:00
|
|
|
private void downloadFile() {
|
2016-04-06 18:28:32 +02:00
|
|
|
if (selectedItem != null && !selectedItem.isFolder()) {
|
|
|
|
|
|
|
|
final ItemDescription itemDescription = new ItemDescription(
|
|
|
|
selectedItem.getId(), selectedItem.getName(),
|
|
|
|
selectedItem.getOwner(), selectedItem.getPath(),
|
|
|
|
selectedItem.getType().name());
|
|
|
|
|
|
|
|
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(
|
|
|
|
itemDescription, new AsyncCallback<String>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
if (caught instanceof ExpiredSessionServiceException) {
|
2016-04-20 18:14:20 +02:00
|
|
|
EventBusProvider.INSTANCE
|
|
|
|
.fireEvent(new SessionExpiredEvent());
|
2016-04-06 18:28:32 +02:00
|
|
|
} else {
|
|
|
|
Log.error("Error open file: "
|
|
|
|
+ caught.getLocalizedMessage());
|
|
|
|
UtilsGXT3.alert("Error",
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
}
|
|
|
|
caught.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(String link) {
|
|
|
|
Log.debug("Retrieved link: " + link);
|
|
|
|
Window.open(link, itemDescription.getName(), "");
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
UtilsGXT3.info("Attention", "Select a file!");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|