ref 9114: DataMiner - Add pagination to Workspace Explorer

https://support.d4science.org/issues/9114

Added pagination to Workspace Explorer 

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@151145 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-07-18 15:30:55 +00:00
parent 79e0df3def
commit 70f484c387
6 changed files with 192 additions and 237 deletions

View File

@ -59,7 +59,7 @@ public class ComputationsExecutedPanel extends FramedPanel {
private Item selectedItem; private Item selectedItem;
private MultipleDNDUpload dnd; private MultipleDNDUpload dnd;
//private WorkspaceResourcesExplorerPanel ; // private WorkspaceResourcesExplorerPanel ;
private WorkspaceResourcesExplorerPanelPaginated wsResourcesExplorerPanel; private WorkspaceResourcesExplorerPanelPaginated wsResourcesExplorerPanel;
private TextButton btnShow; private TextButton btnShow;
private TextButton btnDownload; private TextButton btnDownload;
@ -94,15 +94,14 @@ public class ComputationsExecutedPanel extends FramedPanel {
private void bindToEvents() { private void bindToEvents() {
EventBusProvider.INSTANCE.addHandler(UIStateEvent.TYPE, EventBusProvider.INSTANCE.addHandler(UIStateEvent.TYPE, new UIStateEvent.UIStateEventHandler() {
new UIStateEvent.UIStateEventHandler() {
@Override @Override
public void onChange(UIStateEvent event) { public void onChange(UIStateEvent event) {
manageStateEvents(event); manageStateEvents(event);
} }
}); });
EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaEvent.TYPE, EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaEvent.TYPE,
new DataMinerWorkAreaEvent.DataMinerWorkAreaEventHandler() { new DataMinerWorkAreaEvent.DataMinerWorkAreaEventHandler() {
@ -115,19 +114,16 @@ public class ComputationsExecutedPanel extends FramedPanel {
}); });
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.addHandler(RefreshDataMinerWorkAreaEvent.TYPE,
.addHandler( new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() {
RefreshDataMinerWorkAreaEvent.TYPE,
new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() {
@Override @Override
public void onRefresh( public void onRefresh(RefreshDataMinerWorkAreaEvent event) {
RefreshDataMinerWorkAreaEvent event) { manageRefreshDataMinerWorkAreaEvents(event);
manageRefreshDataMinerWorkAreaEvents(event);
} }
}); });
} }
@ -152,8 +148,7 @@ public class ComputationsExecutedPanel extends FramedPanel {
private void manageDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) { private void manageDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
Log.debug("ComputationsExecutedPanel recieved DataMinerWorkAreaEvent: " Log.debug("ComputationsExecutedPanel recieved DataMinerWorkAreaEvent: " + event);
+ event);
if (event == null) { if (event == null) {
Log.error("DataMinerWorkAreaEvent null"); Log.error("DataMinerWorkAreaEvent null");
return; return;
@ -183,10 +178,8 @@ public class ComputationsExecutedPanel extends FramedPanel {
} }
private void manageRefreshDataMinerWorkAreaEvents( private void manageRefreshDataMinerWorkAreaEvents(RefreshDataMinerWorkAreaEvent event) {
RefreshDataMinerWorkAreaEvent event) { Log.debug("ComputationsExecutedPanel recieved RefreshDataMinerWorkAreaEvent: " + event);
Log.debug("ComputationsExecutedPanel recieved RefreshDataMinerWorkAreaEvent: "
+ event);
if (event == null) { if (event == null) {
Log.error("RefreshDataMinerWorkAreaEvent null"); Log.error("RefreshDataMinerWorkAreaEvent null");
return; return;
@ -206,17 +199,14 @@ public class ComputationsExecutedPanel extends FramedPanel {
} }
private void create(DataMinerWorkAreaEvent event) { private void create(DataMinerWorkAreaEvent event) {
Log.debug("Create ComputationsExecutedPanel");
try { try {
if (event == null if (event == null || event.getDataMinerWorkArea() == null
|| event.getDataMinerWorkArea() == null
|| event.getDataMinerWorkArea().getComputations() == null || event.getDataMinerWorkArea().getComputations() == null
|| event.getDataMinerWorkArea().getComputations() || event.getDataMinerWorkArea().getComputations().getFolder() == null
.getFolder() == null || event.getDataMinerWorkArea().getComputations().getFolder().getId() == null
|| event.getDataMinerWorkArea().getComputations() || event.getDataMinerWorkArea().getComputations().getFolder().getId().isEmpty()) {
.getFolder().getId() == null
|| event.getDataMinerWorkArea().getComputations()
.getFolder().getId().isEmpty()) {
if (v != null) { if (v != null) {
remove(v); remove(v);
forceLayout(); forceLayout();
@ -226,23 +216,27 @@ public class ComputationsExecutedPanel extends FramedPanel {
} }
List<String> showProperties = new ArrayList<String>(); List<String> showProperties = new ArrayList<String>();
for (ComputationsPropertiesType computationsProperties : ComputationsPropertiesType for (ComputationsPropertiesType computationsProperties : ComputationsPropertiesType.values()) {
.values()) {
showProperties.add(computationsProperties.getLabel()); showProperties.add(computationsProperties.getLabel());
} }
FilterCriteria filterCriteria = new FilterCriteria(); FilterCriteria filterCriteria = new FilterCriteria();
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
filterCriteria.setRequiredProperties(map); filterCriteria.setRequiredProperties(map);
/*wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel( /*
event.getDataMinerWorkArea().getComputations().getFolder() * wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel(
.getId(), false, showProperties, filterCriteria, * event.getDataMinerWorkArea().getComputations().getFolder()
true, DISPLAY_FIELD.CREATION_DATE);*/ * .getId(), false, showProperties, filterCriteria, true,
* DISPLAY_FIELD.CREATION_DATE);
wsResourcesExplorerPanel=new WorkspaceResourcesExplorerPanelPaginated(event.getDataMinerWorkArea().getComputations().getFolder() */
.getId(), false, showProperties, filterCriteria, Log.debug("Create wsResourcesExplorerPanel for Computations: ["
true, DISPLAY_FIELD.CREATION_DATE); + event.getDataMinerWorkArea().getComputations().getFolder().getId() + ", false, " + showProperties
+ ", " + filterCriteria + ", true, " + DISPLAY_FIELD.CREATION_DATE + "]");
wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanelPaginated(
event.getDataMinerWorkArea().getComputations().getFolder().getId(), false, showProperties,
filterCriteria, true, DISPLAY_FIELD.CREATION_DATE);
Log.debug("Created wsResourcesExplorerPanel");
WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() { WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() {
@Override @Override
public void onSelectedItem(Item item) { public void onSelectedItem(Item item) {
@ -267,10 +261,10 @@ public class ComputationsExecutedPanel extends FramedPanel {
selectedItem = null; selectedItem = null;
} }
}; };
Log.debug("Add WorkspaceExplorerSelectNotificationListener");
wsResourcesExplorerPanel wsResourcesExplorerPanel.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener);
.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener); wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanelComputaions");
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel"); Log.debug("Set Height to internal SCROLL 300");
wsResourcesExplorerPanel.setHeightToInternalScroll(300); wsResourcesExplorerPanel.setHeightToInternalScroll(300);
/* /*
@ -280,18 +274,17 @@ public class ComputationsExecutedPanel extends FramedPanel {
* vResourcesExplorerContainer.add(wsResourcesExplorerPanel, new * vResourcesExplorerContainer.add(wsResourcesExplorerPanel, new
* VerticalLayoutData(1, -1, new Margins(0))); * VerticalLayoutData(1, -1, new Margins(0)));
*/ */
Log.debug("Define DND for Computations");
// DND // DND
dnd = new MultipleDNDUpload(); dnd = new MultipleDNDUpload();
dnd.setParameters(event.getDataMinerWorkArea().getComputations() dnd.setParameters(event.getDataMinerWorkArea().getComputations().getFolder().getId(), UPLOAD_TYPE.File);
.getFolder().getId(), UPLOAD_TYPE.File);
dnd.addUniqueContainer(wsResourcesExplorerPanel); dnd.addUniqueContainer(wsResourcesExplorerPanel);
WorskpaceUploadNotificationListener workspaceUploaderListener = new WorskpaceUploadNotificationListener() { WorskpaceUploadNotificationListener workspaceUploaderListener = new WorskpaceUploadNotificationListener() {
@Override @Override
public void onUploadCompleted(String parentId, String itemId) { public void onUploadCompleted(String parentId, String itemId) {
Log.debug("Upload completed: [parentID: " + parentId Log.debug("Upload completed: [parentID: " + parentId + ", itemId: " + itemId + "]");
+ ", itemId: " + itemId + "]");
wsResourcesExplorerPanel.refreshRootFolderView(); wsResourcesExplorerPanel.refreshRootFolderView();
forceLayout(); forceLayout();
@ -299,22 +292,18 @@ public class ComputationsExecutedPanel extends FramedPanel {
@Override @Override
public void onUploadAborted(String parentId, String itemId) { public void onUploadAborted(String parentId, String itemId) {
Log.debug("Upload Aborted: [parentID: " + parentId Log.debug("Upload Aborted: [parentID: " + parentId + ", itemId: " + itemId + "]");
+ ", itemId: " + itemId + "]");
} }
@Override @Override
public void onError(String parentId, String itemId, public void onError(String parentId, String itemId, Throwable throwable) {
Throwable throwable) { Log.debug("Upload Error: [parentID: " + parentId + ", itemId: " + itemId + "]");
Log.debug("Upload Error: [parentID: " + parentId
+ ", itemId: " + itemId + "]");
throwable.printStackTrace(); throwable.printStackTrace();
} }
@Override @Override
public void onOverwriteCompleted(String parentId, String itemId) { public void onOverwriteCompleted(String parentId, String itemId) {
Log.debug("Upload Override Completed: [parentID: " Log.debug("Upload Override Completed: [parentID: " + parentId + ", itemId: " + itemId + "]");
+ parentId + ", itemId: " + itemId + "]");
wsResourcesExplorerPanel.refreshRootFolderView(); wsResourcesExplorerPanel.refreshRootFolderView();
forceLayout(); forceLayout();
} }
@ -425,11 +414,9 @@ public class ComputationsExecutedPanel extends FramedPanel {
@Override @Override
public void onResize(ResizeEvent event) { public void onResize(ResizeEvent event) {
int scrollBarHeight = event.getHeight() int scrollBarHeight = event.getHeight() - toolBar.getElement().getHeight(false);
- toolBar.getElement().getHeight(false);
Log.debug("ScrollBarHeight: " + scrollBarHeight); Log.debug("ScrollBarHeight: " + scrollBarHeight);
wsResourcesExplorerPanel wsResourcesExplorerPanel.setHeightToInternalScroll(scrollBarHeight);
.setHeightToInternalScroll(scrollBarHeight);
forceLayout(); forceLayout();
} }
@ -437,7 +424,7 @@ public class ComputationsExecutedPanel extends FramedPanel {
forceLayout(); forceLayout();
} catch (Throwable e) { } catch (Throwable e) {
Log.error("Error opening wsResourceExplorerPanel: "+e.getLocalizedMessage(),e); Log.error("Error opening wsResourceExplorerPanel: " + e.getLocalizedMessage(), e);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -447,8 +434,8 @@ public class ComputationsExecutedPanel extends FramedPanel {
try { try {
wsResourcesExplorerPanel.hardRefresh(); wsResourcesExplorerPanel.hardRefresh();
} catch (Exception e) { } catch (Exception e) {
Log.error("Error retrieving data: "+e.getLocalizedMessage()); Log.error("Error retrieving data: " + e.getLocalizedMessage());
} }
} }
} }
@ -470,12 +457,10 @@ public class ComputationsExecutedPanel extends FramedPanel {
} }
private void deleteItem(SelectEvent event) { private void deleteItem(SelectEvent event) {
ItemDescription itemDescription = new ItemDescription( ItemDescription itemDescription = new ItemDescription(selectedItem.getId(), selectedItem.getName(),
selectedItem.getId(), selectedItem.getName(), selectedItem.getOwner(), selectedItem.getPath(), selectedItem.getType().name());
selectedItem.getOwner(), selectedItem.getPath(), selectedItem DeleteItemRequestEvent deleteItemEvent = new DeleteItemRequestEvent(DataMinerWorkAreaElementType.Computations,
.getType().name()); itemDescription);
DeleteItemRequestEvent deleteItemEvent = new DeleteItemRequestEvent(
DataMinerWorkAreaElementType.Computations, itemDescription);
EventBusProvider.INSTANCE.fireEvent(deleteItemEvent); EventBusProvider.INSTANCE.fireEvent(deleteItemEvent);
Log.debug("Fired: " + deleteItemEvent); Log.debug("Fired: " + deleteItemEvent);
} }
@ -483,13 +468,10 @@ public class ComputationsExecutedPanel extends FramedPanel {
private void showComputation() { private void showComputation() {
if (selectedItem != null) { if (selectedItem != null) {
final ItemDescription itemDescription = new ItemDescription( final ItemDescription itemDescription = new ItemDescription(selectedItem.getId(), selectedItem.getName(),
selectedItem.getId(), selectedItem.getName(), selectedItem.getOwner(), selectedItem.getPath(), selectedItem.getType().name());
selectedItem.getOwner(), selectedItem.getPath(),
selectedItem.getType().name());
ComputationDataRequestEvent event = new ComputationDataRequestEvent( ComputationDataRequestEvent event = new ComputationDataRequestEvent(itemDescription);
itemDescription);
EventBusProvider.INSTANCE.fireEvent(event); EventBusProvider.INSTANCE.fireEvent(event);
} else { } else {
@ -503,53 +485,41 @@ public class ComputationsExecutedPanel extends FramedPanel {
if (selectedItem.isFolder()) { if (selectedItem.isFolder()) {
StringBuilder actionUrl = new StringBuilder(); StringBuilder actionUrl = new StringBuilder();
actionUrl.append(GWT.getModuleBaseURL()); actionUrl.append(GWT.getModuleBaseURL());
actionUrl actionUrl.append(Constants.DOWNLOAD_FOLDER_SERVLET + "?"
.append(Constants.DOWNLOAD_FOLDER_SERVLET + Constants.DOWNLOAD_FOLDER_SERVLET_ITEM_ID_PARAMETER + "=" + selectedItem.getId() + "&"
+ "?" + Constants.DOWNLOAD_FOLDER_SERVLET_FOLDER_NAME_PARAMETER + "=" + selectedItem.getName() + "&"
+ Constants.DOWNLOAD_FOLDER_SERVLET_ITEM_ID_PARAMETER + Constants.CURR_GROUP_ID + "=" + GCubeClientContext.getCurrentContextId());
+ "="
+ selectedItem.getId()
+ "&"
+ Constants.DOWNLOAD_FOLDER_SERVLET_FOLDER_NAME_PARAMETER
+ "=" + selectedItem.getName() + "&"
+ Constants.CURR_GROUP_ID + "="
+ GCubeClientContext.getCurrentContextId());
Log.debug("Retrieved link: " + actionUrl); Log.debug("Retrieved link: " + actionUrl);
Window.open(actionUrl.toString(), selectedItem.getName(), ""); Window.open(actionUrl.toString(), selectedItem.getName(), "");
} else { } else {
final ItemDescription itemDescription = new ItemDescription( final ItemDescription itemDescription = new ItemDescription(selectedItem.getId(),
selectedItem.getId(), selectedItem.getName(), selectedItem.getName(), selectedItem.getOwner(), selectedItem.getPath(),
selectedItem.getOwner(), selectedItem.getPath(),
selectedItem.getType().name()); selectedItem.getType().name());
DataMinerPortletServiceAsync.INSTANCE.getPublicLink( DataMinerPortletServiceAsync.INSTANCE.getPublicLink(itemDescription, new AsyncCallback<String>() {
itemDescription, new AsyncCallback<String>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) { if (caught instanceof SessionExpiredServiceException) {
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
.fireEvent(new SessionExpiredEvent()); } else {
} else { Log.error("Error open file: " + caught.getLocalizedMessage());
Log.error("Error open file: " UtilsGXT3.alert("Error", caught.getLocalizedMessage());
+ caught.getLocalizedMessage()); }
UtilsGXT3.alert("Error", caught.printStackTrace();
caught.getLocalizedMessage());
}
caught.printStackTrace();
} }
@Override @Override
public void onSuccess(String link) { public void onSuccess(String link) {
Log.debug("Retrieved link: " + link); Log.debug("Retrieved link: " + link);
Window.open(link, itemDescription.getName(), ""); Window.open(link, itemDescription.getName(), "");
} }
}); });
} }
} else { } else {
UtilsGXT3.info("Attention", "Select a file!"); UtilsGXT3.info("Attention", "Select a file!");
@ -559,10 +529,8 @@ public class ComputationsExecutedPanel extends FramedPanel {
private void cancelComputation() { private void cancelComputation() {
if (selectedItem != null) { if (selectedItem != null) {
ItemDescription itemDescription = new ItemDescription( ItemDescription itemDescription = new ItemDescription(selectedItem.getId(), selectedItem.getName(),
selectedItem.getId(), selectedItem.getName(), selectedItem.getOwner(), selectedItem.getPath(), selectedItem.getType().name());
selectedItem.getOwner(), selectedItem.getPath(),
selectedItem.getType().name());
CancelExecutionFromComputationsRequestEvent cancelComputationEvent = new CancelExecutionFromComputationsRequestEvent( CancelExecutionFromComputationsRequestEvent cancelComputationEvent = new CancelExecutionFromComputationsRequestEvent(
itemDescription); itemDescription);
EventBusProvider.INSTANCE.fireEvent(cancelComputationEvent); EventBusProvider.INSTANCE.fireEvent(cancelComputationEvent);
@ -574,10 +542,8 @@ public class ComputationsExecutedPanel extends FramedPanel {
private void resubmitComputation() { private void resubmitComputation() {
if (selectedItem != null) { if (selectedItem != null) {
ItemDescription itemDescription = new ItemDescription( ItemDescription itemDescription = new ItemDescription(selectedItem.getId(), selectedItem.getName(),
selectedItem.getId(), selectedItem.getName(), selectedItem.getOwner(), selectedItem.getPath(), selectedItem.getType().name());
selectedItem.getOwner(), selectedItem.getPath(),
selectedItem.getType().name());
ResubmitComputationExecutionRequestEvent resubmitComputationEvent = new ResubmitComputationExecutionRequestEvent( ResubmitComputationExecutionRequestEvent resubmitComputationEvent = new ResubmitComputationExecutionRequestEvent(
itemDescription); itemDescription);
EventBusProvider.INSTANCE.fireEvent(resubmitComputationEvent); EventBusProvider.INSTANCE.fireEvent(resubmitComputationEvent);

View File

@ -190,6 +190,7 @@ public class InputDataSetsPanel extends FramedPanel {
} }
private void create(DataMinerWorkAreaEvent event) { private void create(DataMinerWorkAreaEvent event) {
Log.debug("Create InputDataSetsPanel");
try { try {
if (event == null || event.getDataMinerWorkArea() == null if (event == null || event.getDataMinerWorkArea() == null
@ -213,6 +214,10 @@ public class InputDataSetsPanel extends FramedPanel {
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
filterCriteria.setRequiredProperties(map); filterCriteria.setRequiredProperties(map);
Log.debug("Create wsResourcesExplorerPanel for Input: ["
+ event.getDataMinerWorkArea().getInputDataSets().getFolder().getId() + ", false, "
+ showProperties+", "+ filterCriteria + ", true, " + DISPLAY_FIELD.CREATION_DATE + "]");
wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanelPaginated( wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanelPaginated(
event.getDataMinerWorkArea().getInputDataSets().getFolder().getId(), false, showProperties, event.getDataMinerWorkArea().getInputDataSets().getFolder().getId(), false, showProperties,
filterCriteria, true, DISPLAY_FIELD.CREATION_DATE); filterCriteria, true, DISPLAY_FIELD.CREATION_DATE);
@ -242,9 +247,11 @@ public class InputDataSetsPanel extends FramedPanel {
}; };
wsResourcesExplorerPanel.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener); wsResourcesExplorerPanel.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener);
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel"); wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanelForInput");
wsResourcesExplorerPanel.setHeightToInternalScroll(300); wsResourcesExplorerPanel.setHeightToInternalScroll(300);
Log.debug("Define DND for InputDataSetsPanel");
// DND // DND
dnd = new MultipleDNDUpload(); dnd = new MultipleDNDUpload();
@ -350,7 +357,7 @@ public class InputDataSetsPanel extends FramedPanel {
forceLayout(); forceLayout();
} catch (Throwable e) { } catch (Throwable e) {
Log.error("Error opening wsResourceExplorerPanel: "+e.getLocalizedMessage(),e); Log.error("Error opening wsResourceExplorerPanel: " + e.getLocalizedMessage(), e);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -384,12 +391,18 @@ public class InputDataSetsPanel extends FramedPanel {
} }
private void deleteItem(SelectEvent event) { private void deleteItem(SelectEvent event) {
ItemDescription itemDescription = new ItemDescription(selectedItem.getId(), selectedItem.getName(), Log.debug("Selected Item: " + selectedItem);
selectedItem.getOwner(), selectedItem.getPath(), selectedItem.getType().name()); if (selectedItem != null) {
DeleteItemRequestEvent deleteItemEvent = new DeleteItemRequestEvent(DataMinerWorkAreaElementType.InputDataSets,
itemDescription); ItemDescription itemDescription = new ItemDescription(selectedItem.getId(), selectedItem.getName(),
EventBusProvider.INSTANCE.fireEvent(deleteItemEvent); selectedItem.getOwner(), selectedItem.getPath(), selectedItem.getType().name());
Log.debug("Fired: " + deleteItemEvent); DeleteItemRequestEvent deleteItemEvent = new DeleteItemRequestEvent(
DataMinerWorkAreaElementType.InputDataSets, itemDescription);
EventBusProvider.INSTANCE.fireEvent(deleteItemEvent);
Log.debug("Fired: " + deleteItemEvent);
} else {
UtilsGXT3.info("Attention", "Select a item!");
}
} }
private void downloadFile() { private void downloadFile() {

View File

@ -86,15 +86,14 @@ public class OutputDataSetsPanel extends FramedPanel {
private void bindToEvents() { private void bindToEvents() {
EventBusProvider.INSTANCE.addHandler(UIStateEvent.TYPE, EventBusProvider.INSTANCE.addHandler(UIStateEvent.TYPE, new UIStateEvent.UIStateEventHandler() {
new UIStateEvent.UIStateEventHandler() {
@Override @Override
public void onChange(UIStateEvent event) { public void onChange(UIStateEvent event) {
manageStateEvents(event); manageStateEvents(event);
} }
}); });
EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaEvent.TYPE, EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaEvent.TYPE,
new DataMinerWorkAreaEvent.DataMinerWorkAreaEventHandler() { new DataMinerWorkAreaEvent.DataMinerWorkAreaEventHandler() {
@ -107,19 +106,16 @@ public class OutputDataSetsPanel extends FramedPanel {
}); });
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.addHandler(RefreshDataMinerWorkAreaEvent.TYPE,
.addHandler( new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() {
RefreshDataMinerWorkAreaEvent.TYPE,
new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() {
@Override @Override
public void onRefresh( public void onRefresh(RefreshDataMinerWorkAreaEvent event) {
RefreshDataMinerWorkAreaEvent event) { manageRefreshDataMinerWorkAreaEvents(event);
manageRefreshDataMinerWorkAreaEvents(event);
} }
}); });
} }
@ -142,8 +138,7 @@ public class OutputDataSetsPanel extends FramedPanel {
} }
private void manageDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) { private void manageDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
Log.debug("OutputDataSetsPanel recieved DataMinerWorkAreaEvent: " Log.debug("OutputDataSetsPanel recieved DataMinerWorkAreaEvent: " + event);
+ event);
if (event == null) { if (event == null) {
Log.error("DataMinerWorkAreaEvent"); Log.error("DataMinerWorkAreaEvent");
return; return;
@ -172,10 +167,8 @@ public class OutputDataSetsPanel extends FramedPanel {
} }
private void manageRefreshDataMinerWorkAreaEvents( private void manageRefreshDataMinerWorkAreaEvents(RefreshDataMinerWorkAreaEvent event) {
RefreshDataMinerWorkAreaEvent event) { Log.debug("OutputDataSetsPanel recieved RefreshDataMinerWorkAreaEvent: " + event);
Log.debug("OutputDataSetsPanel recieved RefreshDataMinerWorkAreaEvent: "
+ event);
if (event == null) { if (event == null) {
Log.error("RefreshDataMinerWorkAreaEvent"); Log.error("RefreshDataMinerWorkAreaEvent");
return; return;
@ -195,17 +188,14 @@ public class OutputDataSetsPanel extends FramedPanel {
} }
private void create(DataMinerWorkAreaEvent event) { private void create(DataMinerWorkAreaEvent event) {
Log.debug("Create OutputDataSetsPanel");
try { try {
if (event == null if (event == null || event.getDataMinerWorkArea() == null
|| event.getDataMinerWorkArea() == null
|| event.getDataMinerWorkArea().getOutputDataSets() == null || event.getDataMinerWorkArea().getOutputDataSets() == null
|| event.getDataMinerWorkArea().getOutputDataSets() || event.getDataMinerWorkArea().getOutputDataSets().getFolder() == null
.getFolder() == null || event.getDataMinerWorkArea().getOutputDataSets().getFolder().getId() == null
|| event.getDataMinerWorkArea().getOutputDataSets() || event.getDataMinerWorkArea().getOutputDataSets().getFolder().getId().isEmpty()) {
.getFolder().getId() == null
|| event.getDataMinerWorkArea().getOutputDataSets()
.getFolder().getId().isEmpty()) {
if (v != null) { if (v != null) {
remove(v); remove(v);
forceLayout(); forceLayout();
@ -215,17 +205,18 @@ public class OutputDataSetsPanel extends FramedPanel {
} }
List<String> showProperties = new ArrayList<String>(); List<String> showProperties = new ArrayList<String>();
for (DataSpacePropertiesType dataSpaceProperties : DataSpacePropertiesType for (DataSpacePropertiesType dataSpaceProperties : DataSpacePropertiesType.values()) {
.values()) {
showProperties.add(dataSpaceProperties.getLabel()); showProperties.add(dataSpaceProperties.getLabel());
} }
FilterCriteria filterCriteria = new FilterCriteria(); FilterCriteria filterCriteria = new FilterCriteria();
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
filterCriteria.setRequiredProperties(map); filterCriteria.setRequiredProperties(map);
Log.debug("Create wsResourcesExplorerPanel for Output: ["
+ event.getDataMinerWorkArea().getOutputDataSets().getFolder().getId() + ", false, "
+ showProperties + ", " + filterCriteria + ", true, " + DISPLAY_FIELD.CREATION_DATE + "]");
wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanelPaginated( wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanelPaginated(
event.getDataMinerWorkArea().getOutputDataSets() event.getDataMinerWorkArea().getOutputDataSets().getFolder().getId(), false, showProperties,
.getFolder().getId(), false, showProperties,
filterCriteria, true, DISPLAY_FIELD.CREATION_DATE); filterCriteria, true, DISPLAY_FIELD.CREATION_DATE);
WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() { WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() {
@ -253,23 +244,22 @@ public class OutputDataSetsPanel extends FramedPanel {
} }
}; };
wsResourcesExplorerPanel wsResourcesExplorerPanel.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener);
.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener); wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanelForOutput");
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel");
wsResourcesExplorerPanel.setHeightToInternalScroll(300); wsResourcesExplorerPanel.setHeightToInternalScroll(300);
Log.debug("Define DND for InputDataSetsPanel");
// DND // DND
dnd = new MultipleDNDUpload(); dnd = new MultipleDNDUpload();
dnd.setParameters(event.getDataMinerWorkArea().getOutputDataSets() dnd.setParameters(event.getDataMinerWorkArea().getOutputDataSets().getFolder().getId(), UPLOAD_TYPE.File);
.getFolder().getId(), UPLOAD_TYPE.File);
dnd.addUniqueContainer(wsResourcesExplorerPanel); dnd.addUniqueContainer(wsResourcesExplorerPanel);
WorskpaceUploadNotificationListener workspaceUploaderListener = new WorskpaceUploadNotificationListener() { WorskpaceUploadNotificationListener workspaceUploaderListener = new WorskpaceUploadNotificationListener() {
@Override @Override
public void onUploadCompleted(String parentId, String itemId) { public void onUploadCompleted(String parentId, String itemId) {
Log.debug("Upload completed: [parentID: " + parentId Log.debug("Upload completed: [parentID: " + parentId + ", itemId: " + itemId + "]");
+ ", itemId: " + itemId + "]");
wsResourcesExplorerPanel.refreshRootFolderView(); wsResourcesExplorerPanel.refreshRootFolderView();
forceLayout(); forceLayout();
@ -277,22 +267,18 @@ public class OutputDataSetsPanel extends FramedPanel {
@Override @Override
public void onUploadAborted(String parentId, String itemId) { public void onUploadAborted(String parentId, String itemId) {
Log.debug("Upload Aborted: [parentID: " + parentId Log.debug("Upload Aborted: [parentID: " + parentId + ", itemId: " + itemId + "]");
+ ", itemId: " + itemId + "]");
} }
@Override @Override
public void onError(String parentId, String itemId, public void onError(String parentId, String itemId, Throwable throwable) {
Throwable throwable) { Log.debug("Upload Error: [parentID: " + parentId + ", itemId: " + itemId + "]");
Log.debug("Upload Error: [parentID: " + parentId
+ ", itemId: " + itemId + "]");
throwable.printStackTrace(); throwable.printStackTrace();
} }
@Override @Override
public void onOverwriteCompleted(String parentId, String itemId) { public void onOverwriteCompleted(String parentId, String itemId) {
Log.debug("Upload Override Completed: [parentID: " Log.debug("Upload Override Completed: [parentID: " + parentId + ", itemId: " + itemId + "]");
+ parentId + ", itemId: " + itemId + "]");
wsResourcesExplorerPanel.refreshRootFolderView(); wsResourcesExplorerPanel.refreshRootFolderView();
forceLayout(); forceLayout();
} }
@ -358,11 +344,9 @@ public class OutputDataSetsPanel extends FramedPanel {
@Override @Override
public void onResize(ResizeEvent event) { public void onResize(ResizeEvent event) {
int scrollBarHeight = event.getHeight() int scrollBarHeight = event.getHeight() - toolBar.getElement().getHeight(false);
- toolBar.getElement().getHeight(false);
Log.debug("ScrollBarHeight: " + scrollBarHeight); Log.debug("ScrollBarHeight: " + scrollBarHeight);
wsResourcesExplorerPanel wsResourcesExplorerPanel.setHeightToInternalScroll(scrollBarHeight);
.setHeightToInternalScroll(scrollBarHeight);
forceLayout(); forceLayout();
} }
@ -370,7 +354,7 @@ public class OutputDataSetsPanel extends FramedPanel {
forceLayout(); forceLayout();
} catch (Throwable e) { } catch (Throwable e) {
Log.error("Error opening wsResourceExplorerPanel: "+e.getLocalizedMessage(),e); Log.error("Error opening wsResourceExplorerPanel: " + e.getLocalizedMessage(), e);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -398,21 +382,24 @@ public class OutputDataSetsPanel extends FramedPanel {
} }
} catch (Throwable e) { } catch (Throwable e) {
Log.error("Error in OutputDataSetsPanel: " Log.error("Error in OutputDataSetsPanel: " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
private void deleteItem(SelectEvent event) { private void deleteItem(SelectEvent event) {
ItemDescription itemDescription = new ItemDescription( Log.debug("Selected Item: " + selectedItem);
selectedItem.getId(), selectedItem.getName(), if (selectedItem != null) {
selectedItem.getOwner(), selectedItem.getPath(), selectedItem
.getType().name()); ItemDescription itemDescription = new ItemDescription(selectedItem.getId(), selectedItem.getName(),
DeleteItemRequestEvent deleteItemEvent = new DeleteItemRequestEvent( selectedItem.getOwner(), selectedItem.getPath(), selectedItem.getType().name());
DataMinerWorkAreaElementType.OutputDataSets, itemDescription); DeleteItemRequestEvent deleteItemEvent = new DeleteItemRequestEvent(
EventBusProvider.INSTANCE.fireEvent(deleteItemEvent); DataMinerWorkAreaElementType.OutputDataSets, itemDescription);
Log.debug("Fired: " + deleteItemEvent); EventBusProvider.INSTANCE.fireEvent(deleteItemEvent);
Log.debug("Fired: " + deleteItemEvent);
} else {
UtilsGXT3.info("Attention", "Select a item!");
}
} }
private void downloadFile() { private void downloadFile() {
@ -420,51 +407,39 @@ public class OutputDataSetsPanel extends FramedPanel {
if (selectedItem.isFolder()) { if (selectedItem.isFolder()) {
StringBuilder actionUrl = new StringBuilder(); StringBuilder actionUrl = new StringBuilder();
actionUrl.append(GWT.getModuleBaseURL()); actionUrl.append(GWT.getModuleBaseURL());
actionUrl actionUrl.append(Constants.DOWNLOAD_FOLDER_SERVLET + "?"
.append(Constants.DOWNLOAD_FOLDER_SERVLET + Constants.DOWNLOAD_FOLDER_SERVLET_ITEM_ID_PARAMETER + "=" + selectedItem.getId() + "&"
+ "?" + Constants.DOWNLOAD_FOLDER_SERVLET_FOLDER_NAME_PARAMETER + "=" + selectedItem.getName() + "&"
+ Constants.DOWNLOAD_FOLDER_SERVLET_ITEM_ID_PARAMETER + Constants.CURR_GROUP_ID + "=" + GCubeClientContext.getCurrentContextId());
+ "="
+ selectedItem.getId()
+ "&"
+ Constants.DOWNLOAD_FOLDER_SERVLET_FOLDER_NAME_PARAMETER
+ "=" + selectedItem.getName() + "&"
+ Constants.CURR_GROUP_ID + "="
+ GCubeClientContext.getCurrentContextId());
Log.debug("Retrieved link: " + actionUrl); Log.debug("Retrieved link: " + actionUrl);
Window.open(actionUrl.toString(), selectedItem.getName(), ""); Window.open(actionUrl.toString(), selectedItem.getName(), "");
} else { } else {
final ItemDescription itemDescription = new ItemDescription( final ItemDescription itemDescription = new ItemDescription(selectedItem.getId(),
selectedItem.getId(), selectedItem.getName(), selectedItem.getName(), selectedItem.getOwner(), selectedItem.getPath(),
selectedItem.getOwner(), selectedItem.getPath(),
selectedItem.getType().name()); selectedItem.getType().name());
DataMinerPortletServiceAsync.INSTANCE.getPublicLink( DataMinerPortletServiceAsync.INSTANCE.getPublicLink(itemDescription, new AsyncCallback<String>() {
itemDescription, new AsyncCallback<String>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) { if (caught instanceof SessionExpiredServiceException) {
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
.fireEvent(new SessionExpiredEvent()); } else {
} else { Log.error("Error open file: " + caught.getLocalizedMessage());
Log.error("Error open file: " UtilsGXT3.alert("Error", caught.getLocalizedMessage());
+ caught.getLocalizedMessage()); }
UtilsGXT3.alert("Error", caught.printStackTrace();
caught.getLocalizedMessage());
}
caught.printStackTrace();
} }
@Override @Override
public void onSuccess(String link) { public void onSuccess(String link) {
Log.debug("Retrieved link: " + link); Log.debug("Retrieved link: " + link);
Window.open(link, itemDescription.getName(), ""); Window.open(link, itemDescription.getName(), "");
} }
}); });
} }
} else { } else {

View File

@ -31,17 +31,17 @@
<entry-point <entry-point
class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' /> class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' />
<!--
<set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property <set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger" name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED" value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
/> --> />
<!--
<set-property name="log_ConsoleLogger" value="DISABLED" /> <set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" /> <set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_GWTLogger" value="DISABLED" /> <set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" /> <set-property name="log_SystemLogger" value="DISABLED" /> -->

View File

@ -7,7 +7,7 @@ package org.gcube.portlets.user.dataminermanager.shared;
* *
*/ */
public class Constants { public class Constants {
public static final boolean DEBUG_MODE = false; public static final boolean DEBUG_MODE = true;
public static final boolean TEST_ENABLE = false; public static final boolean TEST_ENABLE = false;
public static final String APPLICATION_ID = "org.gcube.portlets.user.dataminermanager.portlet.DataMinerManager"; public static final String APPLICATION_ID = "org.gcube.portlets.user.dataminermanager.portlet.DataMinerManager";

View File

@ -31,17 +31,18 @@
<entry-point <entry-point
class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' /> class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' />
<!--
<set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property <set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger" name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED" value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
/> --> />
<!--
<set-property name="log_ConsoleLogger" value="DISABLED" /> <set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" /> <set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_GWTLogger" value="DISABLED" /> <set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" /> <set-property name="log_SystemLogger" value="DISABLED" />
-->
<source path='client' /> <source path='client' />
<source path='shared' /> <source path='shared' />