From 51e1c223e030acf1ade5c2acb07f38e7fbb9214a Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 8 May 2018 08:56:35 +0000 Subject: [PATCH] ref 11741: DataMiner - Add refresh button in operators panel https://support.d4science.org/issues/11741 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@167358 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 1 + .../client/DataMinerManagerController.java | 677 ++++++++---------- .../events/OperatorsClassificationEvent.java | 55 +- .../OperatorsClassificationRequestEvent.java | 49 +- .../client/experiments/OperatorsPanel.java | 119 +-- .../client/rpc/DataMinerPortletService.java | 2 +- .../rpc/DataMinerPortletServiceAsync.java | 36 +- .../dataminermanager/dataminermanager.gwt.xml | 2 - .../server/DataMinerManagerServiceImpl.java | 4 +- .../dataminermanager/shared/Constants.java | 14 +- .../dataminermanager/dataminermanager.gwt.xml | 3 - 11 files changed, 433 insertions(+), 529 deletions(-) diff --git a/distro/changelog.xml b/distro/changelog.xml index a3d2b5e..2344218 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -3,6 +3,7 @@ date="2018-04-03"> Integrated DataMiner CL for simplify integration with new StorageHub[ticket #11720] + Added refresh button in operators panel[ticket #11741] diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManagerController.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManagerController.java index 9a1eadd..1ad739a 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManagerController.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/DataMinerManagerController.java @@ -5,6 +5,7 @@ import java.util.List; import org.gcube.data.analysis.dataminermanagercl.shared.data.OutputData; import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationData; import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId; +import org.gcube.data.analysis.dataminermanagercl.shared.perspective.PerspectiveType; import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification; import org.gcube.data.analysis.dataminermanagercl.shared.workspace.DataMinerWorkArea; import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription; @@ -39,7 +40,6 @@ import org.gcube.portlets.user.dataminermanager.shared.Constants; import org.gcube.portlets.user.dataminermanager.shared.exception.SessionExpiredServiceException; import org.gcube.portlets.user.dataminermanager.shared.session.UserInfo; - import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.user.client.rpc.AsyncCallback; import com.sencha.gxt.widget.core.client.event.HideEvent; @@ -69,8 +69,8 @@ public class DataMinerManagerController { public DataMinerWorkArea getDataMinerWorkArea() { return dataMinerWorkArea; } - - public String getOperatorId(){ + + public String getOperatorId() { return operatorId; } @@ -84,11 +84,11 @@ public class DataMinerManagerController { private void checkSession() { // if you do not need to something when the session expire - //CheckSession.getInstance().startPolling(); + // CheckSession.getInstance().startPolling(); } private void sessionExpiredShow() { - //CheckSession.showLogoutDialog(); + // CheckSession.showLogoutDialog(); } /* @@ -115,78 +115,61 @@ public class DataMinerManagerController { } }); - EventBusProvider.INSTANCE.addHandler(MenuEvent.TYPE, - new MenuEvent.MenuEventHandler() { + EventBusProvider.INSTANCE.addHandler(MenuEvent.TYPE, new MenuEvent.MenuEventHandler() { + + @Override + public void onSelect(MenuEvent event) { + Log.debug("Catch MenuEvent:" + event); + manageMenuEvent(event); + + } + }); + + EventBusProvider.INSTANCE.addHandler(StartComputationExecutionRequestEvent.TYPE, + new StartComputationExecutionRequestEvent.StartComputationExecutionRequestEventHandler() { @Override - public void onSelect(MenuEvent event) { - Log.debug("Catch MenuEvent:" + event); - manageMenuEvent(event); + public void onStart(StartComputationExecutionRequestEvent event) { + Log.debug("Catch StartComputationExecutionRequestEvent: " + event); + startComputationRequest(event); } }); - EventBusProvider.INSTANCE - .addHandler( - StartComputationExecutionRequestEvent.TYPE, - new StartComputationExecutionRequestEvent.StartComputationExecutionRequestEventHandler() { + EventBusProvider.INSTANCE.addHandler(CancelComputationExecutionRequestEvent.TYPE, + new CancelComputationExecutionRequestEvent.CancelComputationExecutionRequestEventHandler() { - @Override - public void onStart( - StartComputationExecutionRequestEvent event) { - Log.debug("Catch StartComputationExecutionRequestEvent: " - + event); - startComputationRequest(event); + @Override + public void onCancel(CancelComputationExecutionRequestEvent event) { + Log.debug("Catch CancelComputationRequestEvent: " + event); + cancelComputationRequest(event); - } - }); + } + }); - EventBusProvider.INSTANCE - .addHandler( - CancelComputationExecutionRequestEvent.TYPE, - new CancelComputationExecutionRequestEvent.CancelComputationExecutionRequestEventHandler() { + EventBusProvider.INSTANCE.addHandler(CancelExecutionFromComputationsRequestEvent.TYPE, + new CancelExecutionFromComputationsRequestEvent.CancelExecutionFromComputationsRequestEventHandler() { - @Override - public void onCancel( - CancelComputationExecutionRequestEvent event) { - Log.debug("Catch CancelComputationRequestEvent: " - + event); - cancelComputationRequest(event); + @Override + public void onCancel(CancelExecutionFromComputationsRequestEvent event) { + Log.debug("Catch CancelExecutionFromComputationsRequestEvent: " + event); + cancelExecutionFromComputationsRequest(event); - } - }); + } - EventBusProvider.INSTANCE - .addHandler( - CancelExecutionFromComputationsRequestEvent.TYPE, - new CancelExecutionFromComputationsRequestEvent.CancelExecutionFromComputationsRequestEventHandler() { + }); - @Override - public void onCancel( - CancelExecutionFromComputationsRequestEvent event) { - Log.debug("Catch CancelExecutionFromComputationsRequestEvent: " - + event); - cancelExecutionFromComputationsRequest(event); + EventBusProvider.INSTANCE.addHandler(ResubmitComputationExecutionRequestEvent.TYPE, + new ResubmitComputationExecutionRequestEvent.ResubmitComputationExecutionRequestEventHandler() { - } + @Override + public void onResubmit(ResubmitComputationExecutionRequestEvent event) { + Log.debug("Catch ResubmitComputationExecutionRequestEvent: " + event); + resubmitComputationRequest(event); - }); + } - EventBusProvider.INSTANCE - .addHandler( - ResubmitComputationExecutionRequestEvent.TYPE, - new ResubmitComputationExecutionRequestEvent.ResubmitComputationExecutionRequestEventHandler() { - - @Override - public void onResubmit( - ResubmitComputationExecutionRequestEvent event) { - Log.debug("Catch ResubmitComputationExecutionRequestEvent: " - + event); - resubmitComputationRequest(event); - - } - - }); + }); EventBusProvider.INSTANCE.addHandler(OutputDataRequestEvent.TYPE, new OutputDataRequestEvent.OutputDataRequestEventHandler() { @@ -200,37 +183,29 @@ public class DataMinerManagerController { }); - EventBusProvider.INSTANCE - .addHandler( - ComputationDataRequestEvent.TYPE, - new ComputationDataRequestEvent.ComputationDataRequestEventHandler() { + EventBusProvider.INSTANCE.addHandler(ComputationDataRequestEvent.TYPE, + new ComputationDataRequestEvent.ComputationDataRequestEventHandler() { - @Override - public void onComputationDataRequest( - ComputationDataRequestEvent event) { - Log.debug("Catch ComputationDataRequestEvent: " - + event); - manageComputationDataRequestEvent(event); + @Override + public void onComputationDataRequest(ComputationDataRequestEvent event) { + Log.debug("Catch ComputationDataRequestEvent: " + event); + manageComputationDataRequestEvent(event); - } + } - }); + }); - EventBusProvider.INSTANCE - .addHandler( - OperatorsClassificationRequestEvent.TYPE, - new OperatorsClassificationRequestEvent.OperatorsClassificationRequestEventHandler() { + EventBusProvider.INSTANCE.addHandler(OperatorsClassificationRequestEvent.TYPE, + new OperatorsClassificationRequestEvent.OperatorsClassificationRequestEventHandler() { - @Override - public void onRequest( - OperatorsClassificationRequestEvent event) { - Log.debug("Catch OperatorsClassificationRequestEvent: " - + event); - operatorsClassificationRequest(event); + @Override + public void onRequest(OperatorsClassificationRequestEvent event) { + Log.debug("Catch OperatorsClassificationRequestEvent: " + event); + operatorsClassificationRequest(event); - } + } - }); + }); EventBusProvider.INSTANCE.addHandler(DeleteItemRequestEvent.TYPE, new DeleteItemRequestEvent.DeleteItemRequestEventHandler() { @@ -244,314 +219,266 @@ public class DataMinerManagerController { }); - EventBusProvider.INSTANCE - .addHandler( - DataMinerWorkAreaRequestEvent.TYPE, - new DataMinerWorkAreaRequestEvent.DataMinerWorkAreaRequestEventHandler() { + EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaRequestEvent.TYPE, + new DataMinerWorkAreaRequestEvent.DataMinerWorkAreaRequestEventHandler() { - @Override - public void onRequest( - DataMinerWorkAreaRequestEvent event) { - Log.debug("Catch DataMinerWorkAreaRequestEvent: " - + event); - retrieveDataMinerWorkArea(event); + @Override + public void onRequest(DataMinerWorkAreaRequestEvent event) { + Log.debug("Catch DataMinerWorkAreaRequestEvent: " + event); + retrieveDataMinerWorkArea(event); - } + } - }); + }); } private void restoreUISession() { // checkLocale(); - operatorId = com.google.gwt.user.client.Window.Location - .getParameter(Constants.DATA_MINER_OPERATOR_ID); + operatorId = com.google.gwt.user.client.Window.Location.getParameter(Constants.DATA_MINER_OPERATOR_ID); } - - private void callHello() { - DataMinerPortletServiceAsync.INSTANCE - .hello(new AsyncCallback() { + DataMinerPortletServiceAsync.INSTANCE.hello(new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - if (caught instanceof SessionExpiredServiceException) { - UtilsGXT3.alert("Error", "Expired Session!"); - EventBusProvider.INSTANCE - .fireEvent(new SessionExpiredEvent()); - } else { - UtilsGXT3.alert( - "Error", - "No user found: " - + caught.getLocalizedMessage()); - } - } + @Override + public void onFailure(Throwable caught) { + if (caught instanceof SessionExpiredServiceException) { + UtilsGXT3.alert("Error", "Expired Session!"); + EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent()); + } else { + UtilsGXT3.alert("Error", "No user found: " + caught.getLocalizedMessage()); + } + } - @Override - public void onSuccess(UserInfo result) { - userInfo = result; - Log.info("Hello: " + userInfo.getUsername()); - } + @Override + public void onSuccess(UserInfo result) { + userInfo = result; + Log.info("Hello: " + userInfo.getUsername()); + } - }); + }); } private void manageMenuEvent(MenuEvent event) { Log.debug("CurrentVisualization=" + currentVisualization); - if (event == null - || event.getMenuType() == null - || (currentVisualization == null && event.getMenuType() - .compareTo(MenuType.HOME) == 0) - || (currentVisualization != null && event.getMenuType() - .compareTo(currentVisualization) == 0)) { + if (event == null || event.getMenuType() == null + || (currentVisualization == null && event.getMenuType().compareTo(MenuType.HOME) == 0) + || (currentVisualization != null && event.getMenuType().compareTo(currentVisualization) == 0)) { return; } currentVisualization = event.getMenuType(); - MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent( - event.getMenuType()); + MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent(event.getMenuType()); EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent); } - private void startComputationRequest( - final StartComputationExecutionRequestEvent event) { - DataMinerPortletServiceAsync.INSTANCE.startComputation(event.getOp(), - new AsyncCallback() { + private void startComputationRequest(final StartComputationExecutionRequestEvent event) { + DataMinerPortletServiceAsync.INSTANCE.startComputation(event.getOp(), new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - if (caught instanceof SessionExpiredServiceException) { - UtilsGXT3.alert("Error", "Expired Session!"); - EventBusProvider.INSTANCE - .fireEvent(new SessionExpiredEvent()); - } else { - UtilsGXT3.alert("Error", - "Failed start computation " - + event.getOp().getName() + "! " - + caught.getLocalizedMessage()); - caught.printStackTrace(); - } - } + @Override + public void onFailure(Throwable caught) { + if (caught instanceof SessionExpiredServiceException) { + UtilsGXT3.alert("Error", "Expired Session!"); + EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent()); + } else { + UtilsGXT3.alert("Error", "Failed start computation " + event.getOp().getName() + "! " + + caught.getLocalizedMessage()); + caught.printStackTrace(); + } + } - @Override - public void onSuccess(ComputationId computationId) { - if (computationId == null) - UtilsGXT3.alert("Error", - "Failed start computation " - + event.getOp().getName() - + ", the computation id is null!"); - else { - startComputation(computationId, - event.getComputationStatusPanelIndex()); - } - } - }); + @Override + public void onSuccess(ComputationId computationId) { + if (computationId == null) + UtilsGXT3.alert("Error", + "Failed start computation " + event.getOp().getName() + ", the computation id is null!"); + else { + startComputation(computationId, event.getComputationStatusPanelIndex()); + } + } + }); } - private void startComputation(ComputationId computationId, - int computationStatusPanelIndex) { - StartComputationExecutionEvent event = new StartComputationExecutionEvent( - computationId, computationStatusPanelIndex); + private void startComputation(ComputationId computationId, int computationStatusPanelIndex) { + StartComputationExecutionEvent event = new StartComputationExecutionEvent(computationId, + computationStatusPanelIndex); EventBusProvider.INSTANCE.fireEvent(event); } - private void cancelExecutionFromComputationsRequest( - CancelExecutionFromComputationsRequestEvent event) { + private void cancelExecutionFromComputationsRequest(CancelExecutionFromComputationsRequestEvent event) { final ItemDescription itemDescription = event.getItemDescription(); - DataMinerPortletServiceAsync.INSTANCE.cancelComputation( - itemDescription, new AsyncCallback() { + DataMinerPortletServiceAsync.INSTANCE.cancelComputation(itemDescription, new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - if (caught instanceof SessionExpiredServiceException) { - UtilsGXT3.alert("Error", "Expired Session!"); - EventBusProvider.INSTANCE - .fireEvent(new SessionExpiredEvent()); - } else { - Log.error("Error in cancenExecutionFromComputations:" - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error", - "Error in cancel computation " - + itemDescription.getName() + ": " - + caught.getLocalizedMessage()); - } + @Override + public void onFailure(Throwable caught) { + if (caught instanceof SessionExpiredServiceException) { + UtilsGXT3.alert("Error", "Expired Session!"); + EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent()); + } else { + Log.error("Error in cancenExecutionFromComputations:" + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", "Error in cancel computation " + itemDescription.getName() + ": " + + caught.getLocalizedMessage()); + } - } + } - @Override - public void onSuccess(String result) { - Log.debug("Computation Cancelled!"); - final InfoMessageBox d = new InfoMessageBox("Info", - "Computation cancellation request has been accepted!"); - d.addHideHandler(new HideHandler() { - - public void onHide(HideEvent event) { - fireRefreshDataMinerWorkAreaEvent(DataMinerWorkAreaElementType.Computations); - } - }); - d.show(); + @Override + public void onSuccess(String result) { + Log.debug("Computation Cancelled!"); + final InfoMessageBox d = new InfoMessageBox("Info", + "Computation cancellation request has been accepted!"); + d.addHideHandler(new HideHandler() { + public void onHide(HideEvent event) { + fireRefreshDataMinerWorkAreaEvent(DataMinerWorkAreaElementType.Computations); } }); + d.show(); + + } + }); } - private void cancelComputationRequest( - CancelComputationExecutionRequestEvent event) { + private void cancelComputationRequest(CancelComputationExecutionRequestEvent event) { final ComputationId computationId = event.getComputationId(); - DataMinerPortletServiceAsync.INSTANCE.cancelComputation(computationId, - new AsyncCallback() { + DataMinerPortletServiceAsync.INSTANCE.cancelComputation(computationId, new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - if (caught instanceof SessionExpiredServiceException) { - UtilsGXT3.alert("Error", "Expired Session!"); - EventBusProvider.INSTANCE - .fireEvent(new SessionExpiredEvent()); - } else { - UtilsGXT3.alert("Error", - "Error in cancel computation " - + computationId.getId() + ": " - + caught.getLocalizedMessage()); - } + @Override + public void onFailure(Throwable caught) { + if (caught instanceof SessionExpiredServiceException) { + UtilsGXT3.alert("Error", "Expired Session!"); + EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent()); + } else { + UtilsGXT3.alert("Error", "Error in cancel computation " + computationId.getId() + ": " + + caught.getLocalizedMessage()); + } - } + } - @Override - public void onSuccess(String result) { - Log.debug("Computation Cancelled!"); + @Override + public void onSuccess(String result) { + Log.debug("Computation Cancelled!"); - } - }); + } + }); } - private void resubmitComputationRequest( - final ResubmitComputationExecutionRequestEvent event) { + private void resubmitComputationRequest(final ResubmitComputationExecutionRequestEvent event) { currentVisualization = MenuType.EXPERIMENT; - MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent( - MenuType.EXPERIMENT); + MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent(MenuType.EXPERIMENT); EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent); - DataMinerPortletServiceAsync.INSTANCE.resubmit( - event.getItemDescription(), new AsyncCallback() { + DataMinerPortletServiceAsync.INSTANCE.resubmit(event.getItemDescription(), new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - if (caught instanceof SessionExpiredServiceException) { - UtilsGXT3.alert("Error", "Expired Session!"); - EventBusProvider.INSTANCE - .fireEvent(new SessionExpiredEvent()); - } else { - UtilsGXT3.alert( - "Error", - "Failed to resubmit computation: " - + caught.getMessage()); - } - } + @Override + public void onFailure(Throwable caught) { + if (caught instanceof SessionExpiredServiceException) { + UtilsGXT3.alert("Error", "Expired Session!"); + EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent()); + } else { + UtilsGXT3.alert("Error", "Failed to resubmit computation: " + caught.getMessage()); + } + } - @Override - public void onSuccess(ComputationId result) { - if (result == null) - UtilsGXT3 - .alert("Error", - "Failed to resubmit computation, the computation id is null!"); - else { - resubmitComputation(result); - } + @Override + public void onSuccess(ComputationId result) { + if (result == null) + UtilsGXT3.alert("Error", "Failed to resubmit computation, the computation id is null!"); + else { + resubmitComputation(result); + } - } - }); + } + }); } private void resubmitComputation(ComputationId computationId) { - ResubmitComputationExecutionEvent event = new ResubmitComputationExecutionEvent( - computationId); + ResubmitComputationExecutionEvent event = new ResubmitComputationExecutionEvent(computationId); EventBusProvider.INSTANCE.fireEvent(event); } - private void operatorsClassificationRequest( - OperatorsClassificationRequestEvent event) { + private void operatorsClassificationRequest(OperatorsClassificationRequestEvent event) { if (operatorsClassifications == null) { getOperatorsClassifications(event); } else { - if (event.getOperatorsClassificationRequestType() == null) { - return; + if (event.isRefresh()) { + getOperatorsClassifications(event); + } else { + organizesOperatorsClassification(event); } - switch (event.getOperatorsClassificationRequestType()) { - case ByName: - getOperatorsClassificationByName(event); - break; - case Default: - getOperatorsClassificationDefault(event); - break; - default: - break; - - } - } } - private void getOperatorsClassifications( - final OperatorsClassificationRequestEvent event) { - DataMinerPortletServiceAsync.INSTANCE - .getOperatorsClassifications(new AsyncCallback>() { + private void organizesOperatorsClassification(OperatorsClassificationRequestEvent event) { + if (event.getOperatorsClassificationRequestType() == null) { + return; + } + switch (event.getOperatorsClassificationRequestType()) { + case ByName: + getOperatorsClassificationByName(event); + break; + case Default: + getOperatorsClassificationDefault(event); + break; + default: + break; + + } + } + + private void getOperatorsClassifications(final OperatorsClassificationRequestEvent event) { + DataMinerPortletServiceAsync.INSTANCE.getOperatorsClassifications(event.isRefresh(), + new AsyncCallback>() { @Override public void onSuccess(List result) { operatorsClassifications = result; - operatorsClassificationRequest(event); + organizesOperatorsClassification(event); } @Override public void onFailure(Throwable caught) { if (caught instanceof SessionExpiredServiceException) { UtilsGXT3.alert("Error", "Expired Session"); - EventBusProvider.INSTANCE - .fireEvent(new SessionExpiredEvent()); + EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent()); } else { UtilsGXT3.alert("Error", - "Error retrieving operators classification! " - + caught.getLocalizedMessage()); - Log.error("Error retrieving operators classification: " - + caught.getLocalizedMessage()); + "Error retrieving operators classification! " + caught.getLocalizedMessage()); + Log.error("Error retrieving operators classification: " + caught.getLocalizedMessage()); caught.printStackTrace(); } } }); } - private void getOperatorsClassificationDefault( - OperatorsClassificationRequestEvent event) { + private void getOperatorsClassificationDefault(OperatorsClassificationRequestEvent event) { OperatorsClassification find = null; for (OperatorsClassification oc : operatorsClassifications) { - if (oc.getName().equals(Constants.UserClassificationName)) { + if (oc.getName().equals(PerspectiveType.User.getPerspective())) { find = oc; break; } } - + OperatorsClassificationEvent ocEvent; - if(event.isOperatorId()){ - ocEvent = new OperatorsClassificationEvent( - find, operatorId); + if (event.isOperatorId()) { + ocEvent = new OperatorsClassificationEvent(find, operatorId, event.isRefresh()); } else { - ocEvent = new OperatorsClassificationEvent( - find); + ocEvent = new OperatorsClassificationEvent(find, event.isRefresh()); } EventBusProvider.INSTANCE.fireEvent(ocEvent); } - private void getOperatorsClassificationByName( - OperatorsClassificationRequestEvent event) { + private void getOperatorsClassificationByName(OperatorsClassificationRequestEvent event) { OperatorsClassification find = null; for (OperatorsClassification oc : operatorsClassifications) { - if (oc.getName().equals(event.getClassificationName())) { + if (oc.getName().equals(event.getPerspectiveType().getPerspective())) { find = oc; break; } @@ -559,101 +486,86 @@ public class DataMinerManagerController { if (find == null) { for (OperatorsClassification oc : operatorsClassifications) { - if (oc.getName().equals(Constants.UserClassificationName)) { + if (oc.getName().equals(PerspectiveType.User.getPerspective())) { find = oc; break; } } } - + OperatorsClassificationEvent ocEvent; - if(event.isOperatorId()){ - ocEvent = new OperatorsClassificationEvent( - event.getClassificationName(), find, operatorId); + if (event.isOperatorId()) { + ocEvent = new OperatorsClassificationEvent(event.getPerspectiveType(), find, operatorId, event.isRefresh()); } else { - ocEvent = new OperatorsClassificationEvent( - event.getClassificationName(), find); + ocEvent = new OperatorsClassificationEvent(event.getPerspectiveType(), find, event.isRefresh()); } EventBusProvider.INSTANCE.fireEvent(ocEvent); } - private void retrieveDataMinerWorkArea( - final DataMinerWorkAreaRequestEvent event) { + private void retrieveDataMinerWorkArea(final DataMinerWorkAreaRequestEvent event) { final StatusMonitor monitor = new StatusMonitor(); - DataMinerPortletServiceAsync.INSTANCE - .getDataMinerWorkArea(new AsyncCallback() { + DataMinerPortletServiceAsync.INSTANCE.getDataMinerWorkArea(new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - monitor.hide(); - if (caught instanceof SessionExpiredServiceException) { - UtilsGXT3.alert("Error", "Expired Session"); - EventBusProvider.INSTANCE - .fireEvent(new SessionExpiredEvent()); - } else { - UtilsGXT3.alert("Error", - "Error retrieving DataMiner work area info: " - + caught.getLocalizedMessage()); - } - } + @Override + public void onFailure(Throwable caught) { + monitor.hide(); + if (caught instanceof SessionExpiredServiceException) { + UtilsGXT3.alert("Error", "Expired Session"); + EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent()); + } else { + UtilsGXT3.alert("Error", + "Error retrieving DataMiner work area info: " + caught.getLocalizedMessage()); + } + } - @Override - public void onSuccess(DataMinerWorkArea result) { - monitor.hide(); - Log.debug("DataMinerWorkArea: " + result); - fireDataMinerWorkAreaEventRetrieved(event, result); + @Override + public void onSuccess(DataMinerWorkArea result) { + monitor.hide(); + Log.debug("DataMinerWorkArea: " + result); + fireDataMinerWorkAreaEventRetrieved(event, result); - } + } - }); + }); } - private void fireDataMinerWorkAreaEventRetrieved( - DataMinerWorkAreaRequestEvent event, DataMinerWorkArea result) { + private void fireDataMinerWorkAreaEventRetrieved(DataMinerWorkAreaRequestEvent event, DataMinerWorkArea result) { dataMinerWorkArea = result; - DataMinerWorkAreaEvent dataMinerWorkAreaEvent = new DataMinerWorkAreaEvent( - DataMinerWorkAreaEventType.OPEN, + DataMinerWorkAreaEvent dataMinerWorkAreaEvent = new DataMinerWorkAreaEvent(DataMinerWorkAreaEventType.OPEN, event.getDataMinerWorkAreaRegionType(), result); EventBusProvider.INSTANCE.fireEvent(dataMinerWorkAreaEvent); } private void deleteItemRequest(final DeleteItemRequestEvent event) { final StatusMonitor monitor = new StatusMonitor(); - DataMinerPortletServiceAsync.INSTANCE.deleteItem( - event.getItemDescription(), new AsyncCallback() { + DataMinerPortletServiceAsync.INSTANCE.deleteItem(event.getItemDescription(), new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - monitor.hide(); - if (caught instanceof SessionExpiredServiceException) { - UtilsGXT3.alert("Error", "Expired Session"); - EventBusProvider.INSTANCE - .fireEvent(new SessionExpiredEvent()); - } else { - UtilsGXT3.alert("Error", - "Error deleting item on workspace: " - + caught.getLocalizedMessage()); - } - } + @Override + public void onFailure(Throwable caught) { + monitor.hide(); + if (caught instanceof SessionExpiredServiceException) { + UtilsGXT3.alert("Error", "Expired Session"); + EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent()); + } else { + UtilsGXT3.alert("Error", "Error deleting item on workspace: " + caught.getLocalizedMessage()); + } + } - @Override - public void onSuccess(Void result) { - monitor.hide(); - Log.debug("Deleted Item!"); - fireRefreshDataMinerWorkAreaEvent(event - .getDataMinerWorkAreaElementType()); + @Override + public void onSuccess(Void result) { + monitor.hide(); + Log.debug("Deleted Item!"); + fireRefreshDataMinerWorkAreaEvent(event.getDataMinerWorkAreaElementType()); - } + } - }); + }); } - private void fireRefreshDataMinerWorkAreaEvent( - DataMinerWorkAreaElementType dataMinerWorkAreaElementType) { - RefreshDataMinerWorkAreaEvent refreshEvent = new RefreshDataMinerWorkAreaEvent( - dataMinerWorkAreaElementType); + private void fireRefreshDataMinerWorkAreaEvent(DataMinerWorkAreaElementType dataMinerWorkAreaElementType) { + RefreshDataMinerWorkAreaEvent refreshEvent = new RefreshDataMinerWorkAreaEvent(dataMinerWorkAreaElementType); EventBusProvider.INSTANCE.fireEvent(refreshEvent); } @@ -662,36 +574,28 @@ public class DataMinerManagerController { if (event == null) { UtilsGXT3.alert("Error", "Invalid output request!"); } else { - if (event.getComputationId() == null - || event.getComputationId().getId() == null + if (event.getComputationId() == null || event.getComputationId().getId() == null || event.getComputationId().getId().isEmpty()) { - UtilsGXT3.alert( - "Error", - "Invalid output request, computation id: " - + event.getComputationId()); + UtilsGXT3.alert("Error", "Invalid output request, computation id: " + event.getComputationId()); } else { final StatusMonitor monitor = new StatusMonitor(); - DataMinerPortletServiceAsync.INSTANCE - .getOutputDataByComputationId(event.getComputationId(), - new AsyncCallback() { - @Override - public void onSuccess(OutputData outputData) { - monitor.hide(); - fireOutputDataEvent(outputData); - } + DataMinerPortletServiceAsync.INSTANCE.getOutputDataByComputationId(event.getComputationId(), + new AsyncCallback() { + @Override + public void onSuccess(OutputData outputData) { + monitor.hide(); + fireOutputDataEvent(outputData); + } - @Override - public void onFailure(Throwable caught) { - monitor.hide(); - Log.error("Error in getResourceByComputationId: " - + caught.getLocalizedMessage()); - UtilsGXT3 - .alert("Error", - "Impossible to retrieve output info. " - + caught.getLocalizedMessage()); + @Override + public void onFailure(Throwable caught) { + monitor.hide(); + Log.error("Error in getResourceByComputationId: " + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Impossible to retrieve output info. " + caught.getLocalizedMessage()); - } - }); + } + }); } } } @@ -702,25 +606,20 @@ public class DataMinerManagerController { } - private void manageComputationDataRequestEvent( - ComputationDataRequestEvent event) { + private void manageComputationDataRequestEvent(ComputationDataRequestEvent event) { if (event == null) { UtilsGXT3.alert("Error", "Invalid computation info request!"); } else { - if (event.getItemDescription() == null - || event.getItemDescription().getId() == null + if (event.getItemDescription() == null || event.getItemDescription().getId() == null || event.getItemDescription().getId().isEmpty()) { UtilsGXT3.alert("Error", - "Invalid computation info request, item description: " - + event.getItemDescription()); + "Invalid computation info request, item description: " + event.getItemDescription()); } else { final StatusMonitor monitor = new StatusMonitor(); - DataMinerPortletServiceAsync.INSTANCE.getComputationData( - event.getItemDescription(), + DataMinerPortletServiceAsync.INSTANCE.getComputationData(event.getItemDescription(), new AsyncCallback() { @Override - public void onSuccess( - ComputationData computationData) { + public void onSuccess(ComputationData computationData) { monitor.hide(); fireComputationDataEvent(computationData); } @@ -728,12 +627,10 @@ public class DataMinerManagerController { @Override public void onFailure(Throwable caught) { monitor.hide(); - Log.error("Error in getComputationData: " - + caught.getLocalizedMessage()); + Log.error("Error in getComputationData: " + caught.getLocalizedMessage()); caught.printStackTrace(); UtilsGXT3.alert("Error", - "Impossible to retrieve computation info. " - + caught.getLocalizedMessage()); + "Impossible to retrieve computation info. " + caught.getLocalizedMessage()); } }); diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationEvent.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationEvent.java index 59d4022..3c59756 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationEvent.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationEvent.java @@ -1,6 +1,7 @@ package org.gcube.portlets.user.dataminermanager.client.events; import org.gcube.portlets.user.dataminermanager.client.type.OperatorsClassificationRequestType; +import org.gcube.data.analysis.dataminermanagercl.shared.perspective.PerspectiveType; import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification; import com.google.gwt.event.shared.EventHandler; @@ -17,52 +18,56 @@ import com.google.gwt.event.shared.HasHandlers; * */ public class OperatorsClassificationEvent - extends - GwtEvent { + extends GwtEvent { public static Type TYPE = new Type(); private OperatorsClassificationRequestType operatorsClassificationRequestType; - private String classificationName; + private PerspectiveType perspectiveType; private OperatorsClassification operatorsClassification; private String operatorId; + private boolean refresh; public interface OperatorsClassificationEventHandler extends EventHandler { void onOperatorsClassification(OperatorsClassificationEvent event); } public interface HasOperatorsClassificationEventHandler extends HasHandlers { - public HandlerRegistration addOperatorsClassificationEventHandler( - OperatorsClassificationEventHandler handler); + public HandlerRegistration addOperatorsClassificationEventHandler(OperatorsClassificationEventHandler handler); } - public OperatorsClassificationEvent( - OperatorsClassification operatorsClassification) { + public OperatorsClassificationEvent(OperatorsClassification operatorsClassification, boolean refresh) { this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default; this.operatorsClassification = operatorsClassification; this.operatorId = null; + this.perspectiveType = null; + this.refresh = refresh; } - public OperatorsClassificationEvent(String classificationName, - OperatorsClassification operatorsClassification) { + public OperatorsClassificationEvent(PerspectiveType perspectiveType, + OperatorsClassification operatorsClassification, boolean refresh) { this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName; - this.classificationName = classificationName; + this.perspectiveType = perspectiveType; this.operatorsClassification = operatorsClassification; this.operatorId = null; + this.refresh = refresh; } - public OperatorsClassificationEvent( - OperatorsClassification operatorsClassification, String operatorId) { + public OperatorsClassificationEvent(OperatorsClassification operatorsClassification, String operatorId, + boolean refresh) { this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default; this.operatorsClassification = operatorsClassification; this.operatorId = operatorId; + this.perspectiveType = null; + this.refresh = refresh; } - public OperatorsClassificationEvent(String classificationName, - OperatorsClassification operatorsClassification, String operatorId) { + public OperatorsClassificationEvent(PerspectiveType perspectiveType, + OperatorsClassification operatorsClassification, String operatorId, boolean refresh) { this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName; - this.classificationName = classificationName; + this.perspectiveType = perspectiveType; this.operatorsClassification = operatorsClassification; this.operatorId = operatorId; + this.refresh = refresh; } @Override @@ -79,8 +84,7 @@ public class OperatorsClassificationEvent return TYPE; } - public static void fire(HasHandlers source, - OperatorsClassificationEvent event) { + public static void fire(HasHandlers source, OperatorsClassificationEvent event) { source.fireEvent(event); } @@ -88,8 +92,8 @@ public class OperatorsClassificationEvent return operatorsClassificationRequestType; } - public String getClassificationName() { - return classificationName; + public PerspectiveType getPerspectiveType() { + return perspectiveType; } public OperatorsClassification getOperatorsClassification() { @@ -100,14 +104,15 @@ public class OperatorsClassificationEvent return operatorId; } + public boolean isRefresh() { + return refresh; + } + @Override public String toString() { - return "OperatorsClassificationEvent [operatorsClassificationRequestType=" - + operatorsClassificationRequestType - + ", classificationName=" - + classificationName - + ", operatorsClassification=" - + operatorsClassification + ", operatorId=" + operatorId + "]"; + return "OperatorsClassificationEvent [operatorsClassificationRequestType=" + operatorsClassificationRequestType + + ", perspectiveType=" + perspectiveType + ", operatorsClassification=" + operatorsClassification + + ", operatorId=" + operatorId + ", refresh=" + refresh + "]"; } } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationRequestEvent.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationRequestEvent.java index 8207006..f176e4a 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationRequestEvent.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/events/OperatorsClassificationRequestEvent.java @@ -1,5 +1,6 @@ package org.gcube.portlets.user.dataminermanager.client.events; +import org.gcube.data.analysis.dataminermanagercl.shared.perspective.PerspectiveType; import org.gcube.portlets.user.dataminermanager.client.type.OperatorsClassificationRequestType; import com.google.gwt.event.shared.EventHandler; @@ -16,43 +17,31 @@ import com.google.gwt.event.shared.HasHandlers; * */ public class OperatorsClassificationRequestEvent - extends - GwtEvent { + extends GwtEvent { public static Type TYPE = new Type(); private OperatorsClassificationRequestType operatorsClassificationRequestType; - private String classificationName; + private PerspectiveType perspectiveType; private boolean operatorId; + private boolean refresh; - public interface OperatorsClassificationRequestEventHandler extends - EventHandler { + public interface OperatorsClassificationRequestEventHandler extends EventHandler { void onRequest(OperatorsClassificationRequestEvent event); } - public interface HasOperatorsClassificationRequestEventHandler extends - HasHandlers { + public interface HasOperatorsClassificationRequestEventHandler extends HasHandlers { public HandlerRegistration addOperatorsClassificationRequestEventHandler( OperatorsClassificationRequestEventHandler handler); } - /*public OperatorsClassificationRequestEvent() { - this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default; - this.operatorId = false; - }*/ - - public OperatorsClassificationRequestEvent(String classificationName, - boolean operatorId) { - this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName; - this.classificationName = classificationName; + + public OperatorsClassificationRequestEvent(OperatorsClassificationRequestType operatorsClassificationRequestType, PerspectiveType perspectiveType, boolean operatorId, boolean refresh) { + this.operatorsClassificationRequestType = operatorsClassificationRequestType; + this.perspectiveType = perspectiveType; this.operatorId = operatorId; + this.refresh = refresh; } - /*public OperatorsClassificationRequestEvent(String classificationName) { - this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName; - this.classificationName = classificationName; - this.operatorId = false; - }*/ - @Override protected void dispatch(OperatorsClassificationRequestEventHandler handler) { handler.onRequest(this); @@ -67,8 +56,7 @@ public class OperatorsClassificationRequestEvent return TYPE; } - public static void fire(HasHandlers source, - OperatorsClassificationRequestEvent event) { + public static void fire(HasHandlers source, OperatorsClassificationRequestEvent event) { source.fireEvent(event); } @@ -76,20 +64,23 @@ public class OperatorsClassificationRequestEvent return operatorsClassificationRequestType; } - public String getClassificationName() { - return classificationName; + public PerspectiveType getPerspectiveType() { + return perspectiveType; } public boolean isOperatorId() { return operatorId; } + public boolean isRefresh() { + return refresh; + } + @Override public String toString() { return "OperatorsClassificationRequestEvent [operatorsClassificationRequestType=" - + operatorsClassificationRequestType - + ", classificationName=" - + classificationName + ", operatorId=" + operatorId + "]"; + + operatorsClassificationRequestType + ", perspectiveType=" + perspectiveType + ", operatorId=" + + operatorId + ", refresh=" + refresh + "]"; } } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorsPanel.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorsPanel.java index 10dca07..a0a5b3d 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorsPanel.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/OperatorsPanel.java @@ -8,15 +8,15 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.gcube.data.analysis.dataminermanagercl.shared.perspective.PerspectiveType; +import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator; +import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorCategory; +import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification; import org.gcube.portlets.user.dataminermanager.client.DataMinerManager; import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider; import org.gcube.portlets.user.dataminermanager.client.events.OperatorsClassificationEvent; import org.gcube.portlets.user.dataminermanager.client.events.OperatorsClassificationRequestEvent; import org.gcube.portlets.user.dataminermanager.client.type.OperatorsClassificationRequestType; -import org.gcube.portlets.user.dataminermanager.shared.Constants; -import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator; -import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorCategory; -import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.event.dom.client.KeyUpEvent; @@ -49,10 +49,10 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar; public class OperatorsPanel extends FramedPanel { private static final String LOADING_MESSAGE = "Loading Operators..."; - // private static final String ERROR_GET_OPERATORS = - // "Operators not loaded."; private static final String SHOW_ALL_OPERATORS_TOOLTIP = "Show all Operators without category classification."; private static final String SHOW_CATEGORIES_TOOLTIP = "Show Operators by Categories"; + private static final String REFRESH_OPERATORS_TOOLTIP = "Refresh Operators List"; + private OperatorsPanelHandler handler; private VerticalLayoutContainer topV; private ToolBar toolBar; @@ -60,15 +60,14 @@ public class OperatorsPanel extends FramedPanel { private OperatorsClassification operatorsClassification; private List operators; - // private ArrayList categoryPanels; - private Map> mapCategoriesPanels = new HashMap>(); + private Map> mapCategoriesPanels = new HashMap>(); private enum View { CATEGORIES, FILTER, ALL }; private View view = null; - private String currentClassificationName = Constants.UserClassificationName; + private PerspectiveType currentPerspectiveType = PerspectiveType.User; /** * @@ -105,10 +104,11 @@ public class OperatorsPanel extends FramedPanel { private void manageOperatorsClassificationEvent(OperatorsClassificationEvent event) { try { - + Log.debug("Manage Operators: " + event); if (event.getOperatorsClassificationRequestType() .compareTo(OperatorsClassificationRequestType.ByName) == 0) { - if (currentClassificationName.compareTo(event.getClassificationName()) == 0) { + Log.debug("Current classification name: " + currentPerspectiveType); + if (currentPerspectiveType.compareTo(event.getPerspectiveType()) == 0) { waitMessage(false); if (event.getOperatorsClassification() != null) { operatorsClassification = event.getOperatorsClassification(); @@ -117,15 +117,26 @@ public class OperatorsPanel extends FramedPanel { String operatorId = event.getOperatorId(); Log.debug("ShowCategoriesList"); - List categoryPanels = mapCategoriesPanels.get(currentClassificationName); - if (categoryPanels == null) { + List categoryPanels; + if (event.isRefresh()) { categoryPanels = new ArrayList(); if (operatorsClassification != null) { for (OperatorCategory cat : operatorsClassification.getOperatorCategories()) { categoryPanels.add(new OperatorCategoryPanel(handler, cat)); } } - mapCategoriesPanels.put(currentClassificationName, categoryPanels); + mapCategoriesPanels.put(currentPerspectiveType, categoryPanels); + } else { + categoryPanels = mapCategoriesPanels.get(currentPerspectiveType); + if (categoryPanels == null) { + categoryPanels = new ArrayList(); + if (operatorsClassification != null) { + for (OperatorCategory cat : operatorsClassification.getOperatorCategories()) { + categoryPanels.add(new OperatorCategoryPanel(handler, cat)); + } + } + mapCategoriesPanels.put(currentPerspectiveType, categoryPanels); + } } v.clear(); @@ -156,6 +167,7 @@ public class OperatorsPanel extends FramedPanel { } + Log.debug("Refresh OperatorsPanel"); forceLayout(); } @@ -180,7 +192,7 @@ public class OperatorsPanel extends FramedPanel { add(topV); waitMessage(true); OperatorsClassificationRequestEvent operatorsClassificationRequestEvent = new OperatorsClassificationRequestEvent( - currentClassificationName, true); + OperatorsClassificationRequestType.ByName, currentPerspectiveType, true, false); Log.debug("OperatorsPanel fire: " + operatorsClassificationRequestEvent); EventBusProvider.INSTANCE.fireEvent(operatorsClassificationRequestEvent); } @@ -218,18 +230,19 @@ public class OperatorsPanel extends FramedPanel { }); filterField.setWidth(100); - TextButton showAllOperatorsButton = new TextButton(); - showAllOperatorsButton.setIcon(DataMinerManager.resources.sortAscending()); - showAllOperatorsButton.addSelectHandler(new SelectEvent.SelectHandler() { + TextButton refreshOperatorsButton = new TextButton(); + refreshOperatorsButton.setIcon(DataMinerManager.resources.refresh()); + refreshOperatorsButton.addSelectHandler(new SelectEvent.SelectHandler() { @Override public void onSelect(SelectEvent event) { filterField.clear(); - showAllOperatorsList(); + refreshOperatorsList(); } }); - showAllOperatorsButton.setToolTip(SHOW_ALL_OPERATORS_TOOLTIP); + + refreshOperatorsButton.setToolTip(REFRESH_OPERATORS_TOOLTIP); TextButton showCategoriesButton = new TextButton(); showCategoriesButton.setIcon(DataMinerManager.resources.tree()); @@ -245,39 +258,53 @@ public class OperatorsPanel extends FramedPanel { showCategoriesButton.setToolTip(SHOW_CATEGORIES_TOOLTIP); - final TextButton btnMenuPerspective = new TextButton(currentClassificationName); - btnMenuPerspective.setIcon(DataMinerManager.resources.userPerspective()); + TextButton showAllOperatorsButton = new TextButton(); + showAllOperatorsButton.setIcon(DataMinerManager.resources.sortAscending()); + showAllOperatorsButton.addSelectHandler(new SelectEvent.SelectHandler() { + @Override + public void onSelect(SelectEvent event) { + filterField.clear(); + showAllOperatorsList(); + + } + }); + showAllOperatorsButton.setToolTip(SHOW_ALL_OPERATORS_TOOLTIP); + + final TextButton btnMenuPerspective = new TextButton(currentPerspectiveType.getLabel()); + btnMenuPerspective.setIcon(DataMinerManager.resources.userPerspective()); + btnMenuPerspective.setToolTip(currentPerspectiveType.getPerspective()); Menu menuPerspective = new Menu(); - for (final String perspectiveName : Constants.ClassificationNames) { - final ImageResource img = perspectiveName.equals(Constants.UserClassificationName) - ? DataMinerManager.resources.userPerspective() - : DataMinerManager.resources.computationPerspective(); - MenuItem perspectiveItem = new MenuItem(perspectiveName); - perspectiveItem.addSelectionHandler(new SelectionHandler() { + final ImageResource img = DataMinerManager.resources.userPerspective(); + MenuItem perspectiveItem = new MenuItem(PerspectiveType.User.getLabel()); + perspectiveItem.addSelectionHandler(new SelectionHandler() { - @Override - public void onSelection(SelectionEvent event) { - filterField.clear(); - currentClassificationName = perspectiveName; - btnMenuPerspective.setText(perspectiveName); - btnMenuPerspective.setIcon(img); - showCategoriesList(true); + @Override + public void onSelection(SelectionEvent event) { + filterField.clear(); + currentPerspectiveType = PerspectiveType.User; + btnMenuPerspective.setText(PerspectiveType.User.getLabel()); + btnMenuPerspective.setIcon(img); + btnMenuPerspective.setToolTip(PerspectiveType.User.getPerspective()); + showCategoriesList(true); - } - }); - perspectiveItem.setIcon(img); - menuPerspective.add(perspectiveItem); - } + } + }); + perspectiveItem.setIcon(img); + perspectiveItem.setToolTip(PerspectiveType.User.getPerspective()); + + menuPerspective.add(perspectiveItem); btnMenuPerspective.setMenu(menuPerspective); + toolBar.add(refreshOperatorsButton); toolBar.add(showCategoriesButton); toolBar.add(showAllOperatorsButton); toolBar.add(filterField); toolBar.add(btnMenuPerspective); return; + } private void waitMessage(boolean show) { @@ -312,12 +339,20 @@ public class OperatorsPanel extends FramedPanel { } + private void refreshOperatorsList() { + waitMessage(true); + OperatorsClassificationRequestEvent operatorsClassificationRequestEvent = new OperatorsClassificationRequestEvent( + OperatorsClassificationRequestType.ByName, currentPerspectiveType, true, true); + Log.debug("OperatorsPanel fire: " + operatorsClassificationRequestEvent); + EventBusProvider.INSTANCE.fireEvent(operatorsClassificationRequestEvent); + } + private void showCategoriesList(boolean force) { try { if (force || view != View.CATEGORIES) { Log.debug("ShowCategoriesList"); - List categoryPanels = mapCategoriesPanels.get(currentClassificationName); + List categoryPanels = mapCategoriesPanels.get(currentPerspectiveType); if (categoryPanels == null) { categoryPanels = new ArrayList(); if (operatorsClassification != null) { @@ -325,7 +360,7 @@ public class OperatorsPanel extends FramedPanel { categoryPanels.add(new OperatorCategoryPanel(handler, cat)); } } - mapCategoriesPanels.put(currentClassificationName, categoryPanels); + mapCategoriesPanels.put(currentPerspectiveType, categoryPanels); } v.clear(); diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/rpc/DataMinerPortletService.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/rpc/DataMinerPortletService.java index 73cda34..999017e 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/rpc/DataMinerPortletService.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/rpc/DataMinerPortletService.java @@ -27,7 +27,7 @@ public interface DataMinerPortletService extends RemoteService { public UserInfo hello() throws ServiceException; - public List getOperatorsClassifications() + public List getOperatorsClassifications(boolean refresh) throws ServiceException; public List getParameters(Operator operator) throws ServiceException; diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/rpc/DataMinerPortletServiceAsync.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/rpc/DataMinerPortletServiceAsync.java index b7ffc38..362fce8 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/rpc/DataMinerPortletServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/rpc/DataMinerPortletServiceAsync.java @@ -31,42 +31,30 @@ public interface DataMinerPortletServiceAsync { void hello(AsyncCallback callback); - void getOperatorsClassifications( - AsyncCallback> callback); + void getOperatorsClassifications(boolean refresh, AsyncCallback> callback); - void getParameters(Operator operator, - AsyncCallback> callback); + void getParameters(Operator operator, AsyncCallback> callback); - void startComputation(Operator op, - AsyncCallback asyncCallback); + void startComputation(Operator op, AsyncCallback asyncCallback); - void getComputationStatus(ComputationId computationId, - AsyncCallback asyncCallback); + void getComputationStatus(ComputationId computationId, AsyncCallback asyncCallback); - void resubmit(ItemDescription itemDescription, - AsyncCallback callback); + void resubmit(ItemDescription itemDescription, AsyncCallback callback); - void retrieveTableInformation(Item item, - AsyncCallback callback); + void retrieveTableInformation(Item item, AsyncCallback callback); void getDataMinerWorkArea(AsyncCallback asyncCallback); - void getPublicLink(ItemDescription itemDescription, - AsyncCallback callback); + void getPublicLink(ItemDescription itemDescription, AsyncCallback callback); - void cancelComputation(ComputationId computationId, - AsyncCallback asyncCallback); + void cancelComputation(ComputationId computationId, AsyncCallback asyncCallback); - void deleteItem(ItemDescription itemDescription, - AsyncCallback callback); + void deleteItem(ItemDescription itemDescription, AsyncCallback callback); - void getOutputDataByComputationId(ComputationId computationId, - AsyncCallback callback); + void getOutputDataByComputationId(ComputationId computationId, AsyncCallback callback); - void getComputationData(ItemDescription itemDescription, - AsyncCallback callback); + void getComputationData(ItemDescription itemDescription, AsyncCallback callback); - void cancelComputation(ItemDescription itemDescription, - AsyncCallback asyncCallback); + void cancelComputation(ItemDescription itemDescription, AsyncCallback asyncCallback); } diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/dataminermanager.gwt.xml b/src/main/java/org/gcube/portlets/user/dataminermanager/dataminermanager.gwt.xml index 2602154..1a7975b 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/dataminermanager.gwt.xml +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/dataminermanager.gwt.xml @@ -46,14 +46,12 @@ value="ENABLED" /> --> - - diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/server/DataMinerManagerServiceImpl.java b/src/main/java/org/gcube/portlets/user/dataminermanager/server/DataMinerManagerServiceImpl.java index 9b91ce7..580b22d 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/server/DataMinerManagerServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/server/DataMinerManagerServiceImpl.java @@ -80,13 +80,13 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements } @Override - public List getOperatorsClassifications() throws ServiceException { + public List getOperatorsClassifications(boolean refresh) throws ServiceException { try { HttpServletRequest httpRequest = this.getThreadLocalRequest(); ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(httpRequest); SClient smClient = SessionUtil.getSClient(httpRequest, serviceCredentials); - List list = smClient.getOperatorsClassifications(); + List list = smClient.getOperatorsClassifications(refresh); return list; } catch (ServiceException e) { logger.error(e.getLocalizedMessage(), e); diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/shared/Constants.java b/src/main/java/org/gcube/portlets/user/dataminermanager/shared/Constants.java index f302762..0c01a89 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/shared/Constants.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/shared/Constants.java @@ -21,10 +21,7 @@ public class Constants { public final static String DEFAULT_TOKEN = "ae1208f0-210d-47c9-9b24-d3f2dfcce05f-98187548"; public static final String DEFAULT_ROLE = "OrganizationMember"; - // public final static String DEFAULT_SCOPE = "/gcube/devNext"; - - public static final String SClientMap = "DataMinerClientMap"; public static final String DATA_MINER_SERVICE_NAME = "DataMiner"; public static final String DATAMINER_SERVICE_CATEGORY = "DataAnalysis"; @@ -34,12 +31,7 @@ public class Constants { public static final int TIME_UPDATE_COMPUTATION_STATUS_PANEL = 5 * 1000;// 7*1000; - public static final String[] ClassificationNames = { "User Perspective" }; - // "Computation Perspective"}; - public static final String UserClassificationName = ClassificationNames[0]; - // public final static String computationClassificationName = - // classificationNames[1]; - + // WPS Data Miner public static final String WPSServiceURL = "http://dataminer-d-d4s.d4science.org:80/wps/"; public static final String WPSWebProcessingService = "WebProcessingService"; @@ -47,8 +39,8 @@ public class Constants { public static final String WPSToken = "f0666597-4302-49ce-bea2-555b94e569cb"; public static final String WPSUser = "giancarlo.panichi"; public static final String WPSLanguage = "en-US"; - /*public static final String WPSToken = "4ccc2c35-60c9-4c9b-9800-616538d5d48b"; - public static final String WPSUser = "gianpaolo.coro";*/ + + /*public static final String WPSUser = "gianpaolo.coro";*/ //DownloadFolderServlet diff --git a/src/main/resources/org/gcube/portlets/user/dataminermanager/dataminermanager.gwt.xml b/src/main/resources/org/gcube/portlets/user/dataminermanager/dataminermanager.gwt.xml index 2602154..b9ccaba 100644 --- a/src/main/resources/org/gcube/portlets/user/dataminermanager/dataminermanager.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/dataminermanager/dataminermanager.gwt.xml @@ -46,14 +46,11 @@ value="ENABLED" /> --> - - -