From b9bf1a758b2e978984b81a76a09ddce5477e0fe5 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 25 Jan 2016 16:21:48 +0000 Subject: [PATCH] 1452: Implement a GUI for StatMan Algorithms Importer Task-Url: https://support.d4science.org/issues/1452 Added Monitor on Open and Create project git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@122495 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/project/ProjectManager.java | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/project/ProjectManager.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/project/ProjectManager.java index a649b61..8c3158c 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/project/ProjectManager.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/project/ProjectManager.java @@ -193,7 +193,8 @@ public class ProjectManager { wselectDialog.show(); } - protected void addResourceToProject(Item item) { + private void addResourceToProject(Item item) { + final StatAlgoImporterMonitor monitor=new StatAlgoImporterMonitor(); Log.debug("Add Resource To Project Item selected: " + item); ItemDescription itemDescription = new ItemDescription(item.getId(), item.getName(), item.getOwner(), item.getPath(), item.getType() @@ -203,11 +204,13 @@ public class ProjectManager { @Override public void onSuccess(Void result) { + monitor.hide(); fireProjectStatusAddResourceEvent(); } @Override public void onFailure(Throwable caught) { + monitor.hide(); if (caught instanceof StatAlgoImporterSessionExpiredException) { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); @@ -224,7 +227,8 @@ public class ProjectManager { } - protected void createProjectOnServer(Item item) { + private void createProjectOnServer(Item item) { + final StatAlgoImporterMonitor monitor=new StatAlgoImporterMonitor(); Log.debug("Create Project Item selected: " + item); final ItemDescription newProjectFolder = new ItemDescription( item.getId(), item.getName(), item.getOwner(), item.getPath(), @@ -234,6 +238,7 @@ public class ProjectManager { @Override public void onSuccess(Void result) { + monitor.hide(); project = new Project(new ProjectFolder( newProjectFolder)); fireProjectStatusOpenEvent(); @@ -241,6 +246,7 @@ public class ProjectManager { @Override public void onFailure(Throwable caught) { + monitor.hide(); if (caught instanceof StatAlgoImporterSessionExpiredException) { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); @@ -257,6 +263,8 @@ public class ProjectManager { } protected void openProjectOnServer(Item item) { + final StatAlgoImporterMonitor monitor=new StatAlgoImporterMonitor(); + Log.debug("Open Project Item selected: " + item); final ItemDescription newProjectFolder = new ItemDescription( item.getId(), item.getName(), item.getOwner(), item.getPath(), @@ -267,6 +275,7 @@ public class ProjectManager { @Override public void onSuccess(Project projectOpened) { Log.debug("Open: " + projectOpened); + monitor.hide(); project = projectOpened; fireProjectStatusOpenEvent(); @@ -274,6 +283,7 @@ public class ProjectManager { @Override public void onFailure(Throwable caught) { + monitor.hide(); if (caught instanceof StatAlgoImporterSessionExpiredException) { eventBus.fireEvent(new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); @@ -542,7 +552,7 @@ public class ProjectManager { fireProjectStatusStartEvent(); } - protected void fireProjectStatusOpenEvent() { + private void fireProjectStatusOpenEvent() { ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEventType.OPEN, project); eventBus.fireEvent(projectStatusEvent); @@ -550,56 +560,59 @@ public class ProjectManager { } - protected void fireProjectStatusSaveProjectEvent() { + + @SuppressWarnings("unused") + private void fireProjectStatusSaveProjectEvent() { ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEventType.SAVE, project); eventBus.fireEvent(projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); } - protected void fireProjectStatusAddResourceEvent() { + private void fireProjectStatusAddResourceEvent() { ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEventType.ADD_RESOURCE, project); eventBus.fireEvent(projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); } - protected void fireProjectStatusDeleteEvent() { + private void fireProjectStatusDeleteEvent() { ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEventType.DELETE_RESOURCE, project); eventBus.fireEvent(projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); } - protected void fireProjectStatusDeleteMainCodeEvent() { + private void fireProjectStatusDeleteMainCodeEvent() { ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEventType.DELETE_MAIN_CODE, project); eventBus.fireEvent(projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); } - protected void fireProjectStatusUpdateEvent() { + @SuppressWarnings("unused") + private void fireProjectStatusUpdateEvent() { ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEventType.UPDATE, project); eventBus.fireEvent(projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); } - protected void fireProjectStatusMainCodeSetEvent() { + private void fireProjectStatusMainCodeSetEvent() { ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEventType.MAIN_CODE_SET, project); eventBus.fireEvent(projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); } - protected void fireProjectStatusSoftwareCreatedEvent() { + private void fireProjectStatusSoftwareCreatedEvent() { ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEventType.SOFTWARE_CREATED, project); eventBus.fireEvent(projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); } - protected void fireProjectStatusStartEvent() { + private void fireProjectStatusStartEvent() { ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEventType.START, project); eventBus.fireEvent(projectStatusEvent);