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
This commit is contained in:
Giancarlo Panichi 2016-01-25 16:21:48 +00:00
parent 84e0f110ed
commit b9bf1a758b
1 changed files with 24 additions and 11 deletions

View File

@ -193,7 +193,8 @@ public class ProjectManager {
wselectDialog.show(); 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); Log.debug("Add Resource To Project Item selected: " + item);
ItemDescription itemDescription = new ItemDescription(item.getId(), ItemDescription itemDescription = new ItemDescription(item.getId(),
item.getName(), item.getOwner(), item.getPath(), item.getType() item.getName(), item.getOwner(), item.getPath(), item.getType()
@ -203,11 +204,13 @@ public class ProjectManager {
@Override @Override
public void onSuccess(Void result) { public void onSuccess(Void result) {
monitor.hide();
fireProjectStatusAddResourceEvent(); fireProjectStatusAddResourceEvent();
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
monitor.hide();
if (caught instanceof StatAlgoImporterSessionExpiredException) { if (caught instanceof StatAlgoImporterSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); 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); Log.debug("Create Project Item selected: " + item);
final ItemDescription newProjectFolder = new ItemDescription( final ItemDescription newProjectFolder = new ItemDescription(
item.getId(), item.getName(), item.getOwner(), item.getPath(), item.getId(), item.getName(), item.getOwner(), item.getPath(),
@ -234,6 +238,7 @@ public class ProjectManager {
@Override @Override
public void onSuccess(Void result) { public void onSuccess(Void result) {
monitor.hide();
project = new Project(new ProjectFolder( project = new Project(new ProjectFolder(
newProjectFolder)); newProjectFolder));
fireProjectStatusOpenEvent(); fireProjectStatusOpenEvent();
@ -241,6 +246,7 @@ public class ProjectManager {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
monitor.hide();
if (caught instanceof StatAlgoImporterSessionExpiredException) { if (caught instanceof StatAlgoImporterSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
@ -257,6 +263,8 @@ public class ProjectManager {
} }
protected void openProjectOnServer(Item item) { protected void openProjectOnServer(Item item) {
final StatAlgoImporterMonitor monitor=new StatAlgoImporterMonitor();
Log.debug("Open Project Item selected: " + item); Log.debug("Open Project Item selected: " + item);
final ItemDescription newProjectFolder = new ItemDescription( final ItemDescription newProjectFolder = new ItemDescription(
item.getId(), item.getName(), item.getOwner(), item.getPath(), item.getId(), item.getName(), item.getOwner(), item.getPath(),
@ -267,6 +275,7 @@ public class ProjectManager {
@Override @Override
public void onSuccess(Project projectOpened) { public void onSuccess(Project projectOpened) {
Log.debug("Open: " + projectOpened); Log.debug("Open: " + projectOpened);
monitor.hide();
project = projectOpened; project = projectOpened;
fireProjectStatusOpenEvent(); fireProjectStatusOpenEvent();
@ -274,6 +283,7 @@ public class ProjectManager {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
monitor.hide();
if (caught instanceof StatAlgoImporterSessionExpiredException) { if (caught instanceof StatAlgoImporterSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
@ -542,7 +552,7 @@ public class ProjectManager {
fireProjectStatusStartEvent(); fireProjectStatusStartEvent();
} }
protected void fireProjectStatusOpenEvent() { private void fireProjectStatusOpenEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
ProjectStatusEventType.OPEN, project); ProjectStatusEventType.OPEN, project);
eventBus.fireEvent(projectStatusEvent); eventBus.fireEvent(projectStatusEvent);
@ -550,56 +560,59 @@ public class ProjectManager {
} }
protected void fireProjectStatusSaveProjectEvent() {
@SuppressWarnings("unused")
private void fireProjectStatusSaveProjectEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
ProjectStatusEventType.SAVE, project); ProjectStatusEventType.SAVE, project);
eventBus.fireEvent(projectStatusEvent); eventBus.fireEvent(projectStatusEvent);
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
} }
protected void fireProjectStatusAddResourceEvent() { private void fireProjectStatusAddResourceEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
ProjectStatusEventType.ADD_RESOURCE, project); ProjectStatusEventType.ADD_RESOURCE, project);
eventBus.fireEvent(projectStatusEvent); eventBus.fireEvent(projectStatusEvent);
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
} }
protected void fireProjectStatusDeleteEvent() { private void fireProjectStatusDeleteEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
ProjectStatusEventType.DELETE_RESOURCE, project); ProjectStatusEventType.DELETE_RESOURCE, project);
eventBus.fireEvent(projectStatusEvent); eventBus.fireEvent(projectStatusEvent);
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
} }
protected void fireProjectStatusDeleteMainCodeEvent() { private void fireProjectStatusDeleteMainCodeEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
ProjectStatusEventType.DELETE_MAIN_CODE, project); ProjectStatusEventType.DELETE_MAIN_CODE, project);
eventBus.fireEvent(projectStatusEvent); eventBus.fireEvent(projectStatusEvent);
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
} }
protected void fireProjectStatusUpdateEvent() { @SuppressWarnings("unused")
private void fireProjectStatusUpdateEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
ProjectStatusEventType.UPDATE, project); ProjectStatusEventType.UPDATE, project);
eventBus.fireEvent(projectStatusEvent); eventBus.fireEvent(projectStatusEvent);
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
} }
protected void fireProjectStatusMainCodeSetEvent() { private void fireProjectStatusMainCodeSetEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
ProjectStatusEventType.MAIN_CODE_SET, project); ProjectStatusEventType.MAIN_CODE_SET, project);
eventBus.fireEvent(projectStatusEvent); eventBus.fireEvent(projectStatusEvent);
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
} }
protected void fireProjectStatusSoftwareCreatedEvent() { private void fireProjectStatusSoftwareCreatedEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
ProjectStatusEventType.SOFTWARE_CREATED, project); ProjectStatusEventType.SOFTWARE_CREATED, project);
eventBus.fireEvent(projectStatusEvent); eventBus.fireEvent(projectStatusEvent);
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent); Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
} }
protected void fireProjectStatusStartEvent() { private void fireProjectStatusStartEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent( ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
ProjectStatusEventType.START, project); ProjectStatusEventType.START, project);
eventBus.fireEvent(projectStatusEvent); eventBus.fireEvent(projectStatusEvent);