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
This commit is contained in:
Giancarlo Panichi 2018-05-08 08:56:35 +00:00
parent edccff485d
commit 51e1c223e0
11 changed files with 433 additions and 529 deletions

View File

@ -3,6 +3,7 @@
date="2018-04-03"> date="2018-04-03">
<Change>Integrated DataMiner CL for simplify integration with new <Change>Integrated DataMiner CL for simplify integration with new
StorageHub[ticket #11720]</Change> StorageHub[ticket #11720]</Change>
<Change>Added refresh button in operators panel[ticket #11741]</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.portlets-user.data-miner-manager.1-6-0" <Changeset component="org.gcube.portlets-user.data-miner-manager.1-6-0"
date="2016-11-09"> date="2016-11-09">

View File

@ -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.OutputData;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationData; 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.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.process.OperatorsClassification;
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.DataMinerWorkArea; import org.gcube.data.analysis.dataminermanagercl.shared.workspace.DataMinerWorkArea;
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription; 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.exception.SessionExpiredServiceException;
import org.gcube.portlets.user.dataminermanager.shared.session.UserInfo; import org.gcube.portlets.user.dataminermanager.shared.session.UserInfo;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.widget.core.client.event.HideEvent; import com.sencha.gxt.widget.core.client.event.HideEvent;
@ -69,8 +69,8 @@ public class DataMinerManagerController {
public DataMinerWorkArea getDataMinerWorkArea() { public DataMinerWorkArea getDataMinerWorkArea() {
return dataMinerWorkArea; return dataMinerWorkArea;
} }
public String getOperatorId(){ public String getOperatorId() {
return operatorId; return operatorId;
} }
@ -84,11 +84,11 @@ public class DataMinerManagerController {
private void checkSession() { private void checkSession() {
// if you do not need to something when the session expire // if you do not need to something when the session expire
//CheckSession.getInstance().startPolling(); // CheckSession.getInstance().startPolling();
} }
private void sessionExpiredShow() { private void sessionExpiredShow() {
//CheckSession.showLogoutDialog(); // CheckSession.showLogoutDialog();
} }
/* /*
@ -115,78 +115,61 @@ public class DataMinerManagerController {
} }
}); });
EventBusProvider.INSTANCE.addHandler(MenuEvent.TYPE, EventBusProvider.INSTANCE.addHandler(MenuEvent.TYPE, new MenuEvent.MenuEventHandler() {
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 @Override
public void onSelect(MenuEvent event) { public void onStart(StartComputationExecutionRequestEvent event) {
Log.debug("Catch MenuEvent:" + event); Log.debug("Catch StartComputationExecutionRequestEvent: " + event);
manageMenuEvent(event); startComputationRequest(event);
} }
}); });
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.addHandler(CancelComputationExecutionRequestEvent.TYPE,
.addHandler( new CancelComputationExecutionRequestEvent.CancelComputationExecutionRequestEventHandler() {
StartComputationExecutionRequestEvent.TYPE,
new StartComputationExecutionRequestEvent.StartComputationExecutionRequestEventHandler() {
@Override @Override
public void onStart( public void onCancel(CancelComputationExecutionRequestEvent event) {
StartComputationExecutionRequestEvent event) { Log.debug("Catch CancelComputationRequestEvent: " + event);
Log.debug("Catch StartComputationExecutionRequestEvent: " cancelComputationRequest(event);
+ event);
startComputationRequest(event);
} }
}); });
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.addHandler(CancelExecutionFromComputationsRequestEvent.TYPE,
.addHandler( new CancelExecutionFromComputationsRequestEvent.CancelExecutionFromComputationsRequestEventHandler() {
CancelComputationExecutionRequestEvent.TYPE,
new CancelComputationExecutionRequestEvent.CancelComputationExecutionRequestEventHandler() {
@Override @Override
public void onCancel( public void onCancel(CancelExecutionFromComputationsRequestEvent event) {
CancelComputationExecutionRequestEvent event) { Log.debug("Catch CancelExecutionFromComputationsRequestEvent: " + event);
Log.debug("Catch CancelComputationRequestEvent: " cancelExecutionFromComputationsRequest(event);
+ event);
cancelComputationRequest(event);
} }
});
EventBusProvider.INSTANCE });
.addHandler(
CancelExecutionFromComputationsRequestEvent.TYPE,
new CancelExecutionFromComputationsRequestEvent.CancelExecutionFromComputationsRequestEventHandler() {
@Override EventBusProvider.INSTANCE.addHandler(ResubmitComputationExecutionRequestEvent.TYPE,
public void onCancel( new ResubmitComputationExecutionRequestEvent.ResubmitComputationExecutionRequestEventHandler() {
CancelExecutionFromComputationsRequestEvent event) {
Log.debug("Catch CancelExecutionFromComputationsRequestEvent: "
+ event);
cancelExecutionFromComputationsRequest(event);
} @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, EventBusProvider.INSTANCE.addHandler(OutputDataRequestEvent.TYPE,
new OutputDataRequestEvent.OutputDataRequestEventHandler() { new OutputDataRequestEvent.OutputDataRequestEventHandler() {
@ -200,37 +183,29 @@ public class DataMinerManagerController {
}); });
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.addHandler(ComputationDataRequestEvent.TYPE,
.addHandler( new ComputationDataRequestEvent.ComputationDataRequestEventHandler() {
ComputationDataRequestEvent.TYPE,
new ComputationDataRequestEvent.ComputationDataRequestEventHandler() {
@Override @Override
public void onComputationDataRequest( public void onComputationDataRequest(ComputationDataRequestEvent event) {
ComputationDataRequestEvent event) { Log.debug("Catch ComputationDataRequestEvent: " + event);
Log.debug("Catch ComputationDataRequestEvent: " manageComputationDataRequestEvent(event);
+ event);
manageComputationDataRequestEvent(event);
} }
}); });
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.addHandler(OperatorsClassificationRequestEvent.TYPE,
.addHandler( new OperatorsClassificationRequestEvent.OperatorsClassificationRequestEventHandler() {
OperatorsClassificationRequestEvent.TYPE,
new OperatorsClassificationRequestEvent.OperatorsClassificationRequestEventHandler() {
@Override @Override
public void onRequest( public void onRequest(OperatorsClassificationRequestEvent event) {
OperatorsClassificationRequestEvent event) { Log.debug("Catch OperatorsClassificationRequestEvent: " + event);
Log.debug("Catch OperatorsClassificationRequestEvent: " operatorsClassificationRequest(event);
+ event);
operatorsClassificationRequest(event);
} }
}); });
EventBusProvider.INSTANCE.addHandler(DeleteItemRequestEvent.TYPE, EventBusProvider.INSTANCE.addHandler(DeleteItemRequestEvent.TYPE,
new DeleteItemRequestEvent.DeleteItemRequestEventHandler() { new DeleteItemRequestEvent.DeleteItemRequestEventHandler() {
@ -244,314 +219,266 @@ public class DataMinerManagerController {
}); });
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaRequestEvent.TYPE,
.addHandler( new DataMinerWorkAreaRequestEvent.DataMinerWorkAreaRequestEventHandler() {
DataMinerWorkAreaRequestEvent.TYPE,
new DataMinerWorkAreaRequestEvent.DataMinerWorkAreaRequestEventHandler() {
@Override @Override
public void onRequest( public void onRequest(DataMinerWorkAreaRequestEvent event) {
DataMinerWorkAreaRequestEvent event) { Log.debug("Catch DataMinerWorkAreaRequestEvent: " + event);
Log.debug("Catch DataMinerWorkAreaRequestEvent: " retrieveDataMinerWorkArea(event);
+ event);
retrieveDataMinerWorkArea(event);
} }
}); });
} }
private void restoreUISession() { private void restoreUISession() {
// checkLocale(); // checkLocale();
operatorId = com.google.gwt.user.client.Window.Location operatorId = com.google.gwt.user.client.Window.Location.getParameter(Constants.DATA_MINER_OPERATOR_ID);
.getParameter(Constants.DATA_MINER_OPERATOR_ID);
} }
private void callHello() { private void callHello() {
DataMinerPortletServiceAsync.INSTANCE DataMinerPortletServiceAsync.INSTANCE.hello(new AsyncCallback<UserInfo>() {
.hello(new AsyncCallback<UserInfo>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) { if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session!"); UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
.fireEvent(new SessionExpiredEvent()); } else {
} else { UtilsGXT3.alert("Error", "No user found: " + caught.getLocalizedMessage());
UtilsGXT3.alert( }
"Error", }
"No user found: "
+ caught.getLocalizedMessage());
}
}
@Override @Override
public void onSuccess(UserInfo result) { public void onSuccess(UserInfo result) {
userInfo = result; userInfo = result;
Log.info("Hello: " + userInfo.getUsername()); Log.info("Hello: " + userInfo.getUsername());
} }
}); });
} }
private void manageMenuEvent(MenuEvent event) { private void manageMenuEvent(MenuEvent event) {
Log.debug("CurrentVisualization=" + currentVisualization); Log.debug("CurrentVisualization=" + currentVisualization);
if (event == null if (event == null || event.getMenuType() == null
|| event.getMenuType() == null || (currentVisualization == null && event.getMenuType().compareTo(MenuType.HOME) == 0)
|| (currentVisualization == null && event.getMenuType() || (currentVisualization != null && event.getMenuType().compareTo(currentVisualization) == 0)) {
.compareTo(MenuType.HOME) == 0)
|| (currentVisualization != null && event.getMenuType()
.compareTo(currentVisualization) == 0)) {
return; return;
} }
currentVisualization = event.getMenuType(); currentVisualization = event.getMenuType();
MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent( MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent(event.getMenuType());
event.getMenuType());
EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent); EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent);
} }
private void startComputationRequest( private void startComputationRequest(final StartComputationExecutionRequestEvent event) {
final StartComputationExecutionRequestEvent event) { DataMinerPortletServiceAsync.INSTANCE.startComputation(event.getOp(), new AsyncCallback<ComputationId>() {
DataMinerPortletServiceAsync.INSTANCE.startComputation(event.getOp(),
new AsyncCallback<ComputationId>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) { if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session!"); UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
.fireEvent(new SessionExpiredEvent()); } else {
} else { UtilsGXT3.alert("Error", "Failed start computation " + event.getOp().getName() + "! "
UtilsGXT3.alert("Error", + caught.getLocalizedMessage());
"Failed start computation " caught.printStackTrace();
+ event.getOp().getName() + "! " }
+ caught.getLocalizedMessage()); }
caught.printStackTrace();
}
}
@Override @Override
public void onSuccess(ComputationId computationId) { public void onSuccess(ComputationId computationId) {
if (computationId == null) if (computationId == null)
UtilsGXT3.alert("Error", UtilsGXT3.alert("Error",
"Failed start computation " "Failed start computation " + event.getOp().getName() + ", the computation id is null!");
+ event.getOp().getName() else {
+ ", the computation id is null!"); startComputation(computationId, event.getComputationStatusPanelIndex());
else { }
startComputation(computationId, }
event.getComputationStatusPanelIndex()); });
}
}
});
} }
private void startComputation(ComputationId computationId, private void startComputation(ComputationId computationId, int computationStatusPanelIndex) {
int computationStatusPanelIndex) { StartComputationExecutionEvent event = new StartComputationExecutionEvent(computationId,
StartComputationExecutionEvent event = new StartComputationExecutionEvent( computationStatusPanelIndex);
computationId, computationStatusPanelIndex);
EventBusProvider.INSTANCE.fireEvent(event); EventBusProvider.INSTANCE.fireEvent(event);
} }
private void cancelExecutionFromComputationsRequest( private void cancelExecutionFromComputationsRequest(CancelExecutionFromComputationsRequestEvent event) {
CancelExecutionFromComputationsRequestEvent event) {
final ItemDescription itemDescription = event.getItemDescription(); final ItemDescription itemDescription = event.getItemDescription();
DataMinerPortletServiceAsync.INSTANCE.cancelComputation( DataMinerPortletServiceAsync.INSTANCE.cancelComputation(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) {
UtilsGXT3.alert("Error", "Expired Session!"); UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
.fireEvent(new SessionExpiredEvent()); } else {
} else { Log.error("Error in cancenExecutionFromComputations:" + caught.getLocalizedMessage());
Log.error("Error in cancenExecutionFromComputations:" UtilsGXT3.alert("Error", "Error in cancel computation " + itemDescription.getName() + ": "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", }
"Error in cancel computation "
+ itemDescription.getName() + ": "
+ caught.getLocalizedMessage());
}
} }
@Override @Override
public void onSuccess(String result) { public void onSuccess(String result) {
Log.debug("Computation Cancelled!"); Log.debug("Computation Cancelled!");
final InfoMessageBox d = new InfoMessageBox("Info", final InfoMessageBox d = new InfoMessageBox("Info",
"Computation cancellation request has been accepted!"); "Computation cancellation request has been accepted!");
d.addHideHandler(new HideHandler() { d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
fireRefreshDataMinerWorkAreaEvent(DataMinerWorkAreaElementType.Computations);
}
});
d.show();
public void onHide(HideEvent event) {
fireRefreshDataMinerWorkAreaEvent(DataMinerWorkAreaElementType.Computations);
} }
}); });
d.show();
}
});
} }
private void cancelComputationRequest( private void cancelComputationRequest(CancelComputationExecutionRequestEvent event) {
CancelComputationExecutionRequestEvent event) {
final ComputationId computationId = event.getComputationId(); final ComputationId computationId = event.getComputationId();
DataMinerPortletServiceAsync.INSTANCE.cancelComputation(computationId, DataMinerPortletServiceAsync.INSTANCE.cancelComputation(computationId, new AsyncCallback<String>() {
new AsyncCallback<String>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) { if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session!"); UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
.fireEvent(new SessionExpiredEvent()); } else {
} else { UtilsGXT3.alert("Error", "Error in cancel computation " + computationId.getId() + ": "
UtilsGXT3.alert("Error", + caught.getLocalizedMessage());
"Error in cancel computation " }
+ computationId.getId() + ": "
+ caught.getLocalizedMessage());
}
} }
@Override @Override
public void onSuccess(String result) { public void onSuccess(String result) {
Log.debug("Computation Cancelled!"); Log.debug("Computation Cancelled!");
} }
}); });
} }
private void resubmitComputationRequest( private void resubmitComputationRequest(final ResubmitComputationExecutionRequestEvent event) {
final ResubmitComputationExecutionRequestEvent event) {
currentVisualization = MenuType.EXPERIMENT; currentVisualization = MenuType.EXPERIMENT;
MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent( MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent(MenuType.EXPERIMENT);
MenuType.EXPERIMENT);
EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent); EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent);
DataMinerPortletServiceAsync.INSTANCE.resubmit( DataMinerPortletServiceAsync.INSTANCE.resubmit(event.getItemDescription(), new AsyncCallback<ComputationId>() {
event.getItemDescription(), new AsyncCallback<ComputationId>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) { if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session!"); UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
.fireEvent(new SessionExpiredEvent()); } else {
} else { UtilsGXT3.alert("Error", "Failed to resubmit computation: " + caught.getMessage());
UtilsGXT3.alert( }
"Error", }
"Failed to resubmit computation: "
+ caught.getMessage());
}
}
@Override @Override
public void onSuccess(ComputationId result) { public void onSuccess(ComputationId result) {
if (result == null) if (result == null)
UtilsGXT3 UtilsGXT3.alert("Error", "Failed to resubmit computation, the computation id is null!");
.alert("Error", else {
"Failed to resubmit computation, the computation id is null!"); resubmitComputation(result);
else { }
resubmitComputation(result);
}
} }
}); });
} }
private void resubmitComputation(ComputationId computationId) { private void resubmitComputation(ComputationId computationId) {
ResubmitComputationExecutionEvent event = new ResubmitComputationExecutionEvent( ResubmitComputationExecutionEvent event = new ResubmitComputationExecutionEvent(computationId);
computationId);
EventBusProvider.INSTANCE.fireEvent(event); EventBusProvider.INSTANCE.fireEvent(event);
} }
private void operatorsClassificationRequest( private void operatorsClassificationRequest(OperatorsClassificationRequestEvent event) {
OperatorsClassificationRequestEvent event) {
if (operatorsClassifications == null) { if (operatorsClassifications == null) {
getOperatorsClassifications(event); getOperatorsClassifications(event);
} else { } else {
if (event.getOperatorsClassificationRequestType() == null) { if (event.isRefresh()) {
return; getOperatorsClassifications(event);
} else {
organizesOperatorsClassification(event);
} }
switch (event.getOperatorsClassificationRequestType()) {
case ByName:
getOperatorsClassificationByName(event);
break;
case Default:
getOperatorsClassificationDefault(event);
break;
default:
break;
}
} }
} }
private void getOperatorsClassifications( private void organizesOperatorsClassification(OperatorsClassificationRequestEvent event) {
final OperatorsClassificationRequestEvent event) { if (event.getOperatorsClassificationRequestType() == null) {
DataMinerPortletServiceAsync.INSTANCE return;
.getOperatorsClassifications(new AsyncCallback<List<OperatorsClassification>>() { }
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<List<OperatorsClassification>>() {
@Override @Override
public void onSuccess(List<OperatorsClassification> result) { public void onSuccess(List<OperatorsClassification> result) {
operatorsClassifications = result; operatorsClassifications = result;
operatorsClassificationRequest(event); organizesOperatorsClassification(event);
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) { if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session"); UtilsGXT3.alert("Error", "Expired Session");
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
.fireEvent(new SessionExpiredEvent());
} else { } else {
UtilsGXT3.alert("Error", UtilsGXT3.alert("Error",
"Error retrieving operators classification! " "Error retrieving operators classification! " + caught.getLocalizedMessage());
+ caught.getLocalizedMessage()); Log.error("Error retrieving operators classification: " + caught.getLocalizedMessage());
Log.error("Error retrieving operators classification: "
+ caught.getLocalizedMessage());
caught.printStackTrace(); caught.printStackTrace();
} }
} }
}); });
} }
private void getOperatorsClassificationDefault( private void getOperatorsClassificationDefault(OperatorsClassificationRequestEvent event) {
OperatorsClassificationRequestEvent event) {
OperatorsClassification find = null; OperatorsClassification find = null;
for (OperatorsClassification oc : operatorsClassifications) { for (OperatorsClassification oc : operatorsClassifications) {
if (oc.getName().equals(Constants.UserClassificationName)) { if (oc.getName().equals(PerspectiveType.User.getPerspective())) {
find = oc; find = oc;
break; break;
} }
} }
OperatorsClassificationEvent ocEvent; OperatorsClassificationEvent ocEvent;
if(event.isOperatorId()){ if (event.isOperatorId()) {
ocEvent = new OperatorsClassificationEvent( ocEvent = new OperatorsClassificationEvent(find, operatorId, event.isRefresh());
find, operatorId);
} else { } else {
ocEvent = new OperatorsClassificationEvent( ocEvent = new OperatorsClassificationEvent(find, event.isRefresh());
find);
} }
EventBusProvider.INSTANCE.fireEvent(ocEvent); EventBusProvider.INSTANCE.fireEvent(ocEvent);
} }
private void getOperatorsClassificationByName( private void getOperatorsClassificationByName(OperatorsClassificationRequestEvent event) {
OperatorsClassificationRequestEvent event) {
OperatorsClassification find = null; OperatorsClassification find = null;
for (OperatorsClassification oc : operatorsClassifications) { for (OperatorsClassification oc : operatorsClassifications) {
if (oc.getName().equals(event.getClassificationName())) { if (oc.getName().equals(event.getPerspectiveType().getPerspective())) {
find = oc; find = oc;
break; break;
} }
@ -559,101 +486,86 @@ public class DataMinerManagerController {
if (find == null) { if (find == null) {
for (OperatorsClassification oc : operatorsClassifications) { for (OperatorsClassification oc : operatorsClassifications) {
if (oc.getName().equals(Constants.UserClassificationName)) { if (oc.getName().equals(PerspectiveType.User.getPerspective())) {
find = oc; find = oc;
break; break;
} }
} }
} }
OperatorsClassificationEvent ocEvent; OperatorsClassificationEvent ocEvent;
if(event.isOperatorId()){ if (event.isOperatorId()) {
ocEvent = new OperatorsClassificationEvent( ocEvent = new OperatorsClassificationEvent(event.getPerspectiveType(), find, operatorId, event.isRefresh());
event.getClassificationName(), find, operatorId);
} else { } else {
ocEvent = new OperatorsClassificationEvent( ocEvent = new OperatorsClassificationEvent(event.getPerspectiveType(), find, event.isRefresh());
event.getClassificationName(), find);
} }
EventBusProvider.INSTANCE.fireEvent(ocEvent); EventBusProvider.INSTANCE.fireEvent(ocEvent);
} }
private void retrieveDataMinerWorkArea( private void retrieveDataMinerWorkArea(final DataMinerWorkAreaRequestEvent event) {
final DataMinerWorkAreaRequestEvent event) {
final StatusMonitor monitor = new StatusMonitor(); final StatusMonitor monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE DataMinerPortletServiceAsync.INSTANCE.getDataMinerWorkArea(new AsyncCallback<DataMinerWorkArea>() {
.getDataMinerWorkArea(new AsyncCallback<DataMinerWorkArea>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
monitor.hide(); monitor.hide();
if (caught instanceof SessionExpiredServiceException) { if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session"); UtilsGXT3.alert("Error", "Expired Session");
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
.fireEvent(new SessionExpiredEvent()); } else {
} else { UtilsGXT3.alert("Error",
UtilsGXT3.alert("Error", "Error retrieving DataMiner work area info: " + caught.getLocalizedMessage());
"Error retrieving DataMiner work area info: " }
+ caught.getLocalizedMessage()); }
}
}
@Override @Override
public void onSuccess(DataMinerWorkArea result) { public void onSuccess(DataMinerWorkArea result) {
monitor.hide(); monitor.hide();
Log.debug("DataMinerWorkArea: " + result); Log.debug("DataMinerWorkArea: " + result);
fireDataMinerWorkAreaEventRetrieved(event, result); fireDataMinerWorkAreaEventRetrieved(event, result);
} }
}); });
} }
private void fireDataMinerWorkAreaEventRetrieved( private void fireDataMinerWorkAreaEventRetrieved(DataMinerWorkAreaRequestEvent event, DataMinerWorkArea result) {
DataMinerWorkAreaRequestEvent event, DataMinerWorkArea result) {
dataMinerWorkArea = result; dataMinerWorkArea = result;
DataMinerWorkAreaEvent dataMinerWorkAreaEvent = new DataMinerWorkAreaEvent( DataMinerWorkAreaEvent dataMinerWorkAreaEvent = new DataMinerWorkAreaEvent(DataMinerWorkAreaEventType.OPEN,
DataMinerWorkAreaEventType.OPEN,
event.getDataMinerWorkAreaRegionType(), result); event.getDataMinerWorkAreaRegionType(), result);
EventBusProvider.INSTANCE.fireEvent(dataMinerWorkAreaEvent); EventBusProvider.INSTANCE.fireEvent(dataMinerWorkAreaEvent);
} }
private void deleteItemRequest(final DeleteItemRequestEvent event) { private void deleteItemRequest(final DeleteItemRequestEvent event) {
final StatusMonitor monitor = new StatusMonitor(); final StatusMonitor monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE.deleteItem( DataMinerPortletServiceAsync.INSTANCE.deleteItem(event.getItemDescription(), new AsyncCallback<Void>() {
event.getItemDescription(), new AsyncCallback<Void>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
monitor.hide(); monitor.hide();
if (caught instanceof SessionExpiredServiceException) { if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session"); UtilsGXT3.alert("Error", "Expired Session");
EventBusProvider.INSTANCE EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
.fireEvent(new SessionExpiredEvent()); } else {
} else { UtilsGXT3.alert("Error", "Error deleting item on workspace: " + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", }
"Error deleting item on workspace: " }
+ caught.getLocalizedMessage());
}
}
@Override @Override
public void onSuccess(Void result) { public void onSuccess(Void result) {
monitor.hide(); monitor.hide();
Log.debug("Deleted Item!"); Log.debug("Deleted Item!");
fireRefreshDataMinerWorkAreaEvent(event fireRefreshDataMinerWorkAreaEvent(event.getDataMinerWorkAreaElementType());
.getDataMinerWorkAreaElementType());
} }
}); });
} }
private void fireRefreshDataMinerWorkAreaEvent( private void fireRefreshDataMinerWorkAreaEvent(DataMinerWorkAreaElementType dataMinerWorkAreaElementType) {
DataMinerWorkAreaElementType dataMinerWorkAreaElementType) { RefreshDataMinerWorkAreaEvent refreshEvent = new RefreshDataMinerWorkAreaEvent(dataMinerWorkAreaElementType);
RefreshDataMinerWorkAreaEvent refreshEvent = new RefreshDataMinerWorkAreaEvent(
dataMinerWorkAreaElementType);
EventBusProvider.INSTANCE.fireEvent(refreshEvent); EventBusProvider.INSTANCE.fireEvent(refreshEvent);
} }
@ -662,36 +574,28 @@ public class DataMinerManagerController {
if (event == null) { if (event == null) {
UtilsGXT3.alert("Error", "Invalid output request!"); UtilsGXT3.alert("Error", "Invalid output request!");
} else { } else {
if (event.getComputationId() == null if (event.getComputationId() == null || event.getComputationId().getId() == null
|| event.getComputationId().getId() == null
|| event.getComputationId().getId().isEmpty()) { || event.getComputationId().getId().isEmpty()) {
UtilsGXT3.alert( UtilsGXT3.alert("Error", "Invalid output request, computation id: " + event.getComputationId());
"Error",
"Invalid output request, computation id: "
+ event.getComputationId());
} else { } else {
final StatusMonitor monitor = new StatusMonitor(); final StatusMonitor monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE DataMinerPortletServiceAsync.INSTANCE.getOutputDataByComputationId(event.getComputationId(),
.getOutputDataByComputationId(event.getComputationId(), new AsyncCallback<OutputData>() {
new AsyncCallback<OutputData>() { @Override
@Override public void onSuccess(OutputData outputData) {
public void onSuccess(OutputData outputData) { monitor.hide();
monitor.hide(); fireOutputDataEvent(outputData);
fireOutputDataEvent(outputData); }
}
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
monitor.hide(); monitor.hide();
Log.error("Error in getResourceByComputationId: " Log.error("Error in getResourceByComputationId: " + caught.getLocalizedMessage());
+ caught.getLocalizedMessage()); UtilsGXT3.alert("Error",
UtilsGXT3 "Impossible to retrieve output info. " + caught.getLocalizedMessage());
.alert("Error",
"Impossible to retrieve output info. "
+ caught.getLocalizedMessage());
} }
}); });
} }
} }
} }
@ -702,25 +606,20 @@ public class DataMinerManagerController {
} }
private void manageComputationDataRequestEvent( private void manageComputationDataRequestEvent(ComputationDataRequestEvent event) {
ComputationDataRequestEvent event) {
if (event == null) { if (event == null) {
UtilsGXT3.alert("Error", "Invalid computation info request!"); UtilsGXT3.alert("Error", "Invalid computation info request!");
} else { } else {
if (event.getItemDescription() == null if (event.getItemDescription() == null || event.getItemDescription().getId() == null
|| event.getItemDescription().getId() == null
|| event.getItemDescription().getId().isEmpty()) { || event.getItemDescription().getId().isEmpty()) {
UtilsGXT3.alert("Error", UtilsGXT3.alert("Error",
"Invalid computation info request, item description: " "Invalid computation info request, item description: " + event.getItemDescription());
+ event.getItemDescription());
} else { } else {
final StatusMonitor monitor = new StatusMonitor(); final StatusMonitor monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE.getComputationData( DataMinerPortletServiceAsync.INSTANCE.getComputationData(event.getItemDescription(),
event.getItemDescription(),
new AsyncCallback<ComputationData>() { new AsyncCallback<ComputationData>() {
@Override @Override
public void onSuccess( public void onSuccess(ComputationData computationData) {
ComputationData computationData) {
monitor.hide(); monitor.hide();
fireComputationDataEvent(computationData); fireComputationDataEvent(computationData);
} }
@ -728,12 +627,10 @@ public class DataMinerManagerController {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
monitor.hide(); monitor.hide();
Log.error("Error in getComputationData: " Log.error("Error in getComputationData: " + caught.getLocalizedMessage());
+ caught.getLocalizedMessage());
caught.printStackTrace(); caught.printStackTrace();
UtilsGXT3.alert("Error", UtilsGXT3.alert("Error",
"Impossible to retrieve computation info. " "Impossible to retrieve computation info. " + caught.getLocalizedMessage());
+ caught.getLocalizedMessage());
} }
}); });

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.user.dataminermanager.client.events; package org.gcube.portlets.user.dataminermanager.client.events;
import org.gcube.portlets.user.dataminermanager.client.type.OperatorsClassificationRequestType; 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 org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;
@ -17,52 +18,56 @@ import com.google.gwt.event.shared.HasHandlers;
* *
*/ */
public class OperatorsClassificationEvent public class OperatorsClassificationEvent
extends extends GwtEvent<OperatorsClassificationEvent.OperatorsClassificationEventHandler> {
GwtEvent<OperatorsClassificationEvent.OperatorsClassificationEventHandler> {
public static Type<OperatorsClassificationEventHandler> TYPE = new Type<OperatorsClassificationEventHandler>(); public static Type<OperatorsClassificationEventHandler> TYPE = new Type<OperatorsClassificationEventHandler>();
private OperatorsClassificationRequestType operatorsClassificationRequestType; private OperatorsClassificationRequestType operatorsClassificationRequestType;
private String classificationName; private PerspectiveType perspectiveType;
private OperatorsClassification operatorsClassification; private OperatorsClassification operatorsClassification;
private String operatorId; private String operatorId;
private boolean refresh;
public interface OperatorsClassificationEventHandler extends EventHandler { public interface OperatorsClassificationEventHandler extends EventHandler {
void onOperatorsClassification(OperatorsClassificationEvent event); void onOperatorsClassification(OperatorsClassificationEvent event);
} }
public interface HasOperatorsClassificationEventHandler extends HasHandlers { public interface HasOperatorsClassificationEventHandler extends HasHandlers {
public HandlerRegistration addOperatorsClassificationEventHandler( public HandlerRegistration addOperatorsClassificationEventHandler(OperatorsClassificationEventHandler handler);
OperatorsClassificationEventHandler handler);
} }
public OperatorsClassificationEvent( public OperatorsClassificationEvent(OperatorsClassification operatorsClassification, boolean refresh) {
OperatorsClassification operatorsClassification) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default; this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default;
this.operatorsClassification = operatorsClassification; this.operatorsClassification = operatorsClassification;
this.operatorId = null; this.operatorId = null;
this.perspectiveType = null;
this.refresh = refresh;
} }
public OperatorsClassificationEvent(String classificationName, public OperatorsClassificationEvent(PerspectiveType perspectiveType,
OperatorsClassification operatorsClassification) { OperatorsClassification operatorsClassification, boolean refresh) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName; this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
this.classificationName = classificationName; this.perspectiveType = perspectiveType;
this.operatorsClassification = operatorsClassification; this.operatorsClassification = operatorsClassification;
this.operatorId = null; this.operatorId = null;
this.refresh = refresh;
} }
public OperatorsClassificationEvent( public OperatorsClassificationEvent(OperatorsClassification operatorsClassification, String operatorId,
OperatorsClassification operatorsClassification, String operatorId) { boolean refresh) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default; this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default;
this.operatorsClassification = operatorsClassification; this.operatorsClassification = operatorsClassification;
this.operatorId = operatorId; this.operatorId = operatorId;
this.perspectiveType = null;
this.refresh = refresh;
} }
public OperatorsClassificationEvent(String classificationName, public OperatorsClassificationEvent(PerspectiveType perspectiveType,
OperatorsClassification operatorsClassification, String operatorId) { OperatorsClassification operatorsClassification, String operatorId, boolean refresh) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName; this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
this.classificationName = classificationName; this.perspectiveType = perspectiveType;
this.operatorsClassification = operatorsClassification; this.operatorsClassification = operatorsClassification;
this.operatorId = operatorId; this.operatorId = operatorId;
this.refresh = refresh;
} }
@Override @Override
@ -79,8 +84,7 @@ public class OperatorsClassificationEvent
return TYPE; return TYPE;
} }
public static void fire(HasHandlers source, public static void fire(HasHandlers source, OperatorsClassificationEvent event) {
OperatorsClassificationEvent event) {
source.fireEvent(event); source.fireEvent(event);
} }
@ -88,8 +92,8 @@ public class OperatorsClassificationEvent
return operatorsClassificationRequestType; return operatorsClassificationRequestType;
} }
public String getClassificationName() { public PerspectiveType getPerspectiveType() {
return classificationName; return perspectiveType;
} }
public OperatorsClassification getOperatorsClassification() { public OperatorsClassification getOperatorsClassification() {
@ -100,14 +104,15 @@ public class OperatorsClassificationEvent
return operatorId; return operatorId;
} }
public boolean isRefresh() {
return refresh;
}
@Override @Override
public String toString() { public String toString() {
return "OperatorsClassificationEvent [operatorsClassificationRequestType=" return "OperatorsClassificationEvent [operatorsClassificationRequestType=" + operatorsClassificationRequestType
+ operatorsClassificationRequestType + ", perspectiveType=" + perspectiveType + ", operatorsClassification=" + operatorsClassification
+ ", classificationName=" + ", operatorId=" + operatorId + ", refresh=" + refresh + "]";
+ classificationName
+ ", operatorsClassification="
+ operatorsClassification + ", operatorId=" + operatorId + "]";
} }
} }

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.dataminermanager.client.events; 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 org.gcube.portlets.user.dataminermanager.client.type.OperatorsClassificationRequestType;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;
@ -16,43 +17,31 @@ import com.google.gwt.event.shared.HasHandlers;
* *
*/ */
public class OperatorsClassificationRequestEvent public class OperatorsClassificationRequestEvent
extends extends GwtEvent<OperatorsClassificationRequestEvent.OperatorsClassificationRequestEventHandler> {
GwtEvent<OperatorsClassificationRequestEvent.OperatorsClassificationRequestEventHandler> {
public static Type<OperatorsClassificationRequestEventHandler> TYPE = new Type<OperatorsClassificationRequestEventHandler>(); public static Type<OperatorsClassificationRequestEventHandler> TYPE = new Type<OperatorsClassificationRequestEventHandler>();
private OperatorsClassificationRequestType operatorsClassificationRequestType; private OperatorsClassificationRequestType operatorsClassificationRequestType;
private String classificationName; private PerspectiveType perspectiveType;
private boolean operatorId; private boolean operatorId;
private boolean refresh;
public interface OperatorsClassificationRequestEventHandler extends public interface OperatorsClassificationRequestEventHandler extends EventHandler {
EventHandler {
void onRequest(OperatorsClassificationRequestEvent event); void onRequest(OperatorsClassificationRequestEvent event);
} }
public interface HasOperatorsClassificationRequestEventHandler extends public interface HasOperatorsClassificationRequestEventHandler extends HasHandlers {
HasHandlers {
public HandlerRegistration addOperatorsClassificationRequestEventHandler( public HandlerRegistration addOperatorsClassificationRequestEventHandler(
OperatorsClassificationRequestEventHandler handler); OperatorsClassificationRequestEventHandler handler);
} }
/*public OperatorsClassificationRequestEvent() {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default; public OperatorsClassificationRequestEvent(OperatorsClassificationRequestType operatorsClassificationRequestType, PerspectiveType perspectiveType, boolean operatorId, boolean refresh) {
this.operatorId = false; this.operatorsClassificationRequestType = operatorsClassificationRequestType;
}*/ this.perspectiveType = perspectiveType;
public OperatorsClassificationRequestEvent(String classificationName,
boolean operatorId) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
this.classificationName = classificationName;
this.operatorId = operatorId; this.operatorId = operatorId;
this.refresh = refresh;
} }
/*public OperatorsClassificationRequestEvent(String classificationName) {
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
this.classificationName = classificationName;
this.operatorId = false;
}*/
@Override @Override
protected void dispatch(OperatorsClassificationRequestEventHandler handler) { protected void dispatch(OperatorsClassificationRequestEventHandler handler) {
handler.onRequest(this); handler.onRequest(this);
@ -67,8 +56,7 @@ public class OperatorsClassificationRequestEvent
return TYPE; return TYPE;
} }
public static void fire(HasHandlers source, public static void fire(HasHandlers source, OperatorsClassificationRequestEvent event) {
OperatorsClassificationRequestEvent event) {
source.fireEvent(event); source.fireEvent(event);
} }
@ -76,20 +64,23 @@ public class OperatorsClassificationRequestEvent
return operatorsClassificationRequestType; return operatorsClassificationRequestType;
} }
public String getClassificationName() { public PerspectiveType getPerspectiveType() {
return classificationName; return perspectiveType;
} }
public boolean isOperatorId() { public boolean isOperatorId() {
return operatorId; return operatorId;
} }
public boolean isRefresh() {
return refresh;
}
@Override @Override
public String toString() { public String toString() {
return "OperatorsClassificationRequestEvent [operatorsClassificationRequestType=" return "OperatorsClassificationRequestEvent [operatorsClassificationRequestType="
+ operatorsClassificationRequestType + operatorsClassificationRequestType + ", perspectiveType=" + perspectiveType + ", operatorId="
+ ", classificationName=" + operatorId + ", refresh=" + refresh + "]";
+ classificationName + ", operatorId=" + operatorId + "]";
} }
} }

View File

@ -8,15 +8,15 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; 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.DataMinerManager;
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider; 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.OperatorsClassificationEvent;
import org.gcube.portlets.user.dataminermanager.client.events.OperatorsClassificationRequestEvent; import org.gcube.portlets.user.dataminermanager.client.events.OperatorsClassificationRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.type.OperatorsClassificationRequestType; 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.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.dom.client.KeyUpEvent; 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 { public class OperatorsPanel extends FramedPanel {
private static final String LOADING_MESSAGE = "Loading Operators..."; 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_ALL_OPERATORS_TOOLTIP = "Show all Operators without category classification.";
private static final String SHOW_CATEGORIES_TOOLTIP = "Show Operators by Categories"; 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 OperatorsPanelHandler handler;
private VerticalLayoutContainer topV; private VerticalLayoutContainer topV;
private ToolBar toolBar; private ToolBar toolBar;
@ -60,15 +60,14 @@ public class OperatorsPanel extends FramedPanel {
private OperatorsClassification operatorsClassification; private OperatorsClassification operatorsClassification;
private List<Operator> operators; private List<Operator> operators;
// private ArrayList<OperatorCategoryPanel> categoryPanels; private Map<PerspectiveType, List<OperatorCategoryPanel>> mapCategoriesPanels = new HashMap<PerspectiveType, List<OperatorCategoryPanel>>();
private Map<String, List<OperatorCategoryPanel>> mapCategoriesPanels = new HashMap<String, List<OperatorCategoryPanel>>();
private enum View { private enum View {
CATEGORIES, FILTER, ALL CATEGORIES, FILTER, ALL
}; };
private View view = null; 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) { private void manageOperatorsClassificationEvent(OperatorsClassificationEvent event) {
try { try {
Log.debug("Manage Operators: " + event);
if (event.getOperatorsClassificationRequestType() if (event.getOperatorsClassificationRequestType()
.compareTo(OperatorsClassificationRequestType.ByName) == 0) { .compareTo(OperatorsClassificationRequestType.ByName) == 0) {
if (currentClassificationName.compareTo(event.getClassificationName()) == 0) { Log.debug("Current classification name: " + currentPerspectiveType);
if (currentPerspectiveType.compareTo(event.getPerspectiveType()) == 0) {
waitMessage(false); waitMessage(false);
if (event.getOperatorsClassification() != null) { if (event.getOperatorsClassification() != null) {
operatorsClassification = event.getOperatorsClassification(); operatorsClassification = event.getOperatorsClassification();
@ -117,15 +117,26 @@ public class OperatorsPanel extends FramedPanel {
String operatorId = event.getOperatorId(); String operatorId = event.getOperatorId();
Log.debug("ShowCategoriesList"); Log.debug("ShowCategoriesList");
List<OperatorCategoryPanel> categoryPanels = mapCategoriesPanels.get(currentClassificationName); List<OperatorCategoryPanel> categoryPanels;
if (categoryPanels == null) { if (event.isRefresh()) {
categoryPanels = new ArrayList<OperatorCategoryPanel>(); categoryPanels = new ArrayList<OperatorCategoryPanel>();
if (operatorsClassification != null) { if (operatorsClassification != null) {
for (OperatorCategory cat : operatorsClassification.getOperatorCategories()) { for (OperatorCategory cat : operatorsClassification.getOperatorCategories()) {
categoryPanels.add(new OperatorCategoryPanel(handler, cat)); 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<OperatorCategoryPanel>();
if (operatorsClassification != null) {
for (OperatorCategory cat : operatorsClassification.getOperatorCategories()) {
categoryPanels.add(new OperatorCategoryPanel(handler, cat));
}
}
mapCategoriesPanels.put(currentPerspectiveType, categoryPanels);
}
} }
v.clear(); v.clear();
@ -156,6 +167,7 @@ public class OperatorsPanel extends FramedPanel {
} }
Log.debug("Refresh OperatorsPanel");
forceLayout(); forceLayout();
} }
@ -180,7 +192,7 @@ public class OperatorsPanel extends FramedPanel {
add(topV); add(topV);
waitMessage(true); waitMessage(true);
OperatorsClassificationRequestEvent operatorsClassificationRequestEvent = new OperatorsClassificationRequestEvent( OperatorsClassificationRequestEvent operatorsClassificationRequestEvent = new OperatorsClassificationRequestEvent(
currentClassificationName, true); OperatorsClassificationRequestType.ByName, currentPerspectiveType, true, false);
Log.debug("OperatorsPanel fire: " + operatorsClassificationRequestEvent); Log.debug("OperatorsPanel fire: " + operatorsClassificationRequestEvent);
EventBusProvider.INSTANCE.fireEvent(operatorsClassificationRequestEvent); EventBusProvider.INSTANCE.fireEvent(operatorsClassificationRequestEvent);
} }
@ -218,18 +230,19 @@ public class OperatorsPanel extends FramedPanel {
}); });
filterField.setWidth(100); filterField.setWidth(100);
TextButton showAllOperatorsButton = new TextButton(); TextButton refreshOperatorsButton = new TextButton();
showAllOperatorsButton.setIcon(DataMinerManager.resources.sortAscending()); refreshOperatorsButton.setIcon(DataMinerManager.resources.refresh());
showAllOperatorsButton.addSelectHandler(new SelectEvent.SelectHandler() { refreshOperatorsButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override @Override
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
filterField.clear(); filterField.clear();
showAllOperatorsList(); refreshOperatorsList();
} }
}); });
showAllOperatorsButton.setToolTip(SHOW_ALL_OPERATORS_TOOLTIP);
refreshOperatorsButton.setToolTip(REFRESH_OPERATORS_TOOLTIP);
TextButton showCategoriesButton = new TextButton(); TextButton showCategoriesButton = new TextButton();
showCategoriesButton.setIcon(DataMinerManager.resources.tree()); showCategoriesButton.setIcon(DataMinerManager.resources.tree());
@ -245,39 +258,53 @@ public class OperatorsPanel extends FramedPanel {
showCategoriesButton.setToolTip(SHOW_CATEGORIES_TOOLTIP); showCategoriesButton.setToolTip(SHOW_CATEGORIES_TOOLTIP);
final TextButton btnMenuPerspective = new TextButton(currentClassificationName); TextButton showAllOperatorsButton = new TextButton();
btnMenuPerspective.setIcon(DataMinerManager.resources.userPerspective()); 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(); Menu menuPerspective = new Menu();
for (final String perspectiveName : Constants.ClassificationNames) { final ImageResource img = DataMinerManager.resources.userPerspective();
final ImageResource img = perspectiveName.equals(Constants.UserClassificationName) MenuItem perspectiveItem = new MenuItem(PerspectiveType.User.getLabel());
? DataMinerManager.resources.userPerspective() perspectiveItem.addSelectionHandler(new SelectionHandler<Item>() {
: DataMinerManager.resources.computationPerspective();
MenuItem perspectiveItem = new MenuItem(perspectiveName);
perspectiveItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override @Override
public void onSelection(SelectionEvent<Item> event) { public void onSelection(SelectionEvent<Item> event) {
filterField.clear(); filterField.clear();
currentClassificationName = perspectiveName; currentPerspectiveType = PerspectiveType.User;
btnMenuPerspective.setText(perspectiveName); btnMenuPerspective.setText(PerspectiveType.User.getLabel());
btnMenuPerspective.setIcon(img); btnMenuPerspective.setIcon(img);
showCategoriesList(true); btnMenuPerspective.setToolTip(PerspectiveType.User.getPerspective());
showCategoriesList(true);
} }
}); });
perspectiveItem.setIcon(img); perspectiveItem.setIcon(img);
menuPerspective.add(perspectiveItem); perspectiveItem.setToolTip(PerspectiveType.User.getPerspective());
}
menuPerspective.add(perspectiveItem);
btnMenuPerspective.setMenu(menuPerspective); btnMenuPerspective.setMenu(menuPerspective);
toolBar.add(refreshOperatorsButton);
toolBar.add(showCategoriesButton); toolBar.add(showCategoriesButton);
toolBar.add(showAllOperatorsButton); toolBar.add(showAllOperatorsButton);
toolBar.add(filterField); toolBar.add(filterField);
toolBar.add(btnMenuPerspective); toolBar.add(btnMenuPerspective);
return; return;
} }
private void waitMessage(boolean show) { 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) { private void showCategoriesList(boolean force) {
try { try {
if (force || view != View.CATEGORIES) { if (force || view != View.CATEGORIES) {
Log.debug("ShowCategoriesList"); Log.debug("ShowCategoriesList");
List<OperatorCategoryPanel> categoryPanels = mapCategoriesPanels.get(currentClassificationName); List<OperatorCategoryPanel> categoryPanels = mapCategoriesPanels.get(currentPerspectiveType);
if (categoryPanels == null) { if (categoryPanels == null) {
categoryPanels = new ArrayList<OperatorCategoryPanel>(); categoryPanels = new ArrayList<OperatorCategoryPanel>();
if (operatorsClassification != null) { if (operatorsClassification != null) {
@ -325,7 +360,7 @@ public class OperatorsPanel extends FramedPanel {
categoryPanels.add(new OperatorCategoryPanel(handler, cat)); categoryPanels.add(new OperatorCategoryPanel(handler, cat));
} }
} }
mapCategoriesPanels.put(currentClassificationName, categoryPanels); mapCategoriesPanels.put(currentPerspectiveType, categoryPanels);
} }
v.clear(); v.clear();

View File

@ -27,7 +27,7 @@ public interface DataMinerPortletService extends RemoteService {
public UserInfo hello() throws ServiceException; public UserInfo hello() throws ServiceException;
public List<OperatorsClassification> getOperatorsClassifications() public List<OperatorsClassification> getOperatorsClassifications(boolean refresh)
throws ServiceException; throws ServiceException;
public List<Parameter> getParameters(Operator operator) throws ServiceException; public List<Parameter> getParameters(Operator operator) throws ServiceException;

View File

@ -31,42 +31,30 @@ public interface DataMinerPortletServiceAsync {
void hello(AsyncCallback<UserInfo> callback); void hello(AsyncCallback<UserInfo> callback);
void getOperatorsClassifications( void getOperatorsClassifications(boolean refresh, AsyncCallback<List<OperatorsClassification>> callback);
AsyncCallback<List<OperatorsClassification>> callback);
void getParameters(Operator operator, void getParameters(Operator operator, AsyncCallback<List<Parameter>> callback);
AsyncCallback<List<Parameter>> callback);
void startComputation(Operator op, void startComputation(Operator op, AsyncCallback<ComputationId> asyncCallback);
AsyncCallback<ComputationId> asyncCallback);
void getComputationStatus(ComputationId computationId, void getComputationStatus(ComputationId computationId, AsyncCallback<ComputationStatus> asyncCallback);
AsyncCallback<ComputationStatus> asyncCallback);
void resubmit(ItemDescription itemDescription, void resubmit(ItemDescription itemDescription, AsyncCallback<ComputationId> callback);
AsyncCallback<ComputationId> callback);
void retrieveTableInformation(Item item, void retrieveTableInformation(Item item, AsyncCallback<TableItemSimple> callback);
AsyncCallback<TableItemSimple> callback);
void getDataMinerWorkArea(AsyncCallback<DataMinerWorkArea> asyncCallback); void getDataMinerWorkArea(AsyncCallback<DataMinerWorkArea> asyncCallback);
void getPublicLink(ItemDescription itemDescription, void getPublicLink(ItemDescription itemDescription, AsyncCallback<String> callback);
AsyncCallback<String> callback);
void cancelComputation(ComputationId computationId, void cancelComputation(ComputationId computationId, AsyncCallback<String> asyncCallback);
AsyncCallback<String> asyncCallback);
void deleteItem(ItemDescription itemDescription, void deleteItem(ItemDescription itemDescription, AsyncCallback<Void> callback);
AsyncCallback<Void> callback);
void getOutputDataByComputationId(ComputationId computationId, void getOutputDataByComputationId(ComputationId computationId, AsyncCallback<OutputData> callback);
AsyncCallback<OutputData> callback);
void getComputationData(ItemDescription itemDescription, void getComputationData(ItemDescription itemDescription, AsyncCallback<ComputationData> callback);
AsyncCallback<ComputationData> callback);
void cancelComputation(ItemDescription itemDescription, void cancelComputation(ItemDescription itemDescription, AsyncCallback<String> asyncCallback);
AsyncCallback<String> asyncCallback);
} }

View File

@ -46,14 +46,12 @@
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' />

View File

@ -80,13 +80,13 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
} }
@Override @Override
public List<OperatorsClassification> getOperatorsClassifications() throws ServiceException { public List<OperatorsClassification> getOperatorsClassifications(boolean refresh) throws ServiceException {
try { try {
HttpServletRequest httpRequest = this.getThreadLocalRequest(); HttpServletRequest httpRequest = this.getThreadLocalRequest();
ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(httpRequest); ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(httpRequest);
SClient smClient = SessionUtil.getSClient(httpRequest, serviceCredentials); SClient smClient = SessionUtil.getSClient(httpRequest, serviceCredentials);
List<OperatorsClassification> list = smClient.getOperatorsClassifications(); List<OperatorsClassification> list = smClient.getOperatorsClassifications(refresh);
return list; return list;
} catch (ServiceException e) { } catch (ServiceException e) {
logger.error(e.getLocalizedMessage(), e); logger.error(e.getLocalizedMessage(), e);

View File

@ -21,10 +21,7 @@ public class Constants {
public final static String DEFAULT_TOKEN = "ae1208f0-210d-47c9-9b24-d3f2dfcce05f-98187548"; public final static String DEFAULT_TOKEN = "ae1208f0-210d-47c9-9b24-d3f2dfcce05f-98187548";
public static final String DEFAULT_ROLE = "OrganizationMember"; 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 SClientMap = "DataMinerClientMap";
public static final String DATA_MINER_SERVICE_NAME = "DataMiner"; public static final String DATA_MINER_SERVICE_NAME = "DataMiner";
public static final String DATAMINER_SERVICE_CATEGORY = "DataAnalysis"; 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 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 // WPS Data Miner
public static final String WPSServiceURL = "http://dataminer-d-d4s.d4science.org:80/wps/"; public static final String WPSServiceURL = "http://dataminer-d-d4s.d4science.org:80/wps/";
public static final String WPSWebProcessingService = "WebProcessingService"; 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 WPSToken = "f0666597-4302-49ce-bea2-555b94e569cb";
public static final String WPSUser = "giancarlo.panichi"; public static final String WPSUser = "giancarlo.panichi";
public static final String WPSLanguage = "en-US"; 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 //DownloadFolderServlet

View File

@ -46,14 +46,11 @@
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' />