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 e52e4a9..e2da68b 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 @@ -235,15 +235,14 @@ public class DataMinerManagerController { }); - EventBusProvider.INSTANCE.addHandler(ServiceInfoRequestEvent.TYPE, new ServiceInfoRequestEvent.ServiceInfoRequestEventHandler() { - + @Override public void onRequest(ServiceInfoRequestEvent event) { Log.debug("Catch EnvironmentRequestEvent: " + event); retrieveEnvironment(event); - + } }); @@ -423,7 +422,7 @@ public class DataMinerManagerController { getOperatorsClassifications(event); } else { if (event.isRefresh()) { - RemoveSelectedOperatorEvent rEvent=new RemoveSelectedOperatorEvent(); + RemoveSelectedOperatorEvent rEvent = new RemoveSelectedOperatorEvent(); EventBusProvider.INSTANCE.fireEvent(rEvent); getOperatorsClassifications(event); } else { @@ -468,7 +467,9 @@ public class DataMinerManagerController { } else { UtilsGXT3.alert("Error", "The VRE currently has problems loading all required operators. We apologize for this inconvenience."); - Log.error("The VRE currently has problems loading all required operators. We apologize for this inconvenience: " + caught.getLocalizedMessage()); + Log.error( + "The VRE currently has problems loading all required operators. We apologize for this inconvenience: " + + caught.getLocalizedMessage()); caught.printStackTrace(); } } @@ -547,7 +548,7 @@ public class DataMinerManagerController { }); } - + private void retrieveEnvironment(final ServiceInfoRequestEvent event) { DataMinerPortletServiceAsync.INSTANCE.getServiceInfo(new AsyncCallback() { @@ -565,7 +566,7 @@ public class DataMinerManagerController { @Override public void onSuccess(ServiceInfo serviceInfo) { Log.debug("DataMiner Service Info: " + serviceInfo); - + ServiceInfoEvent serviceInfoEvent = new ServiceInfoEvent(serviceInfo); EventBusProvider.INSTANCE.fireEvent(serviceInfoEvent); @@ -574,7 +575,6 @@ public class DataMinerManagerController { }); } - private void fireDataMinerWorkAreaEventRetrieved(DataMinerWorkAreaRequestEvent event, DataMinerWorkArea result) { dataMinerWorkArea = result; diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/ComputationStatusPanel.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/ComputationStatusPanel.java index 57d6f9b..4089709 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/ComputationStatusPanel.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/experiments/ComputationStatusPanel.java @@ -50,7 +50,8 @@ public class ComputationStatusPanel extends SimpleContainer { /** * - * @param operatorName operator name + * @param operatorName + * operator name */ public ComputationStatusPanel(String operatorName) { super(); @@ -66,8 +67,7 @@ public class ComputationStatusPanel extends SimpleContainer { private void create() { vert = new VerticalLayoutContainer(); HtmlLayoutContainer title = new HtmlLayoutContainer( - "

Computation of " - + operatorName + "

"); + "

Computation of " + operatorName + "

"); vert.add(title, new VerticalLayoutData(-1, -1, new Margins(0))); add(vert); forceLayout(); @@ -86,8 +86,8 @@ public class ComputationStatusPanel extends SimpleContainer { */ // vert.add(date, new VerticalLayoutData(-1, -1, new Margins(0))); - vert.add(new HtmlLayoutContainer("

Id: " - + computationId.getId() + "

")); + vert.add(new HtmlLayoutContainer( + "

Id: " + computationId.getId() + "

")); TextButton equivalentRequestBtn = new TextButton(); equivalentRequestBtn.setText("Show"); @@ -100,11 +100,9 @@ public class ComputationStatusPanel extends SimpleContainer { } }); - FieldLabel equivalentRequestLabel = new FieldLabel( - equivalentRequestBtn, "WPS Request"); + FieldLabel equivalentRequestLabel = new FieldLabel(equivalentRequestBtn, "WPS Request"); equivalentRequestLabel.setLabelWidth(180); - vert.add(equivalentRequestLabel, new VerticalLayoutData(-1, -1, - new Margins(0))); + vert.add(equivalentRequestLabel, new VerticalLayoutData(-1, -1, new Margins(0))); TextButton monitorComputationBtn = new TextButton(); monitorComputationBtn.setText("Show"); @@ -112,18 +110,16 @@ public class ComputationStatusPanel extends SimpleContainer { @Override public void onSelect(SelectEvent event) { - showLinkToMonitorComputationDialog();; + showLinkToMonitorComputationDialog(); + } }); - FieldLabel monitorComputationLabel = new FieldLabel( - monitorComputationBtn, "Link to monitor the computation"); + FieldLabel monitorComputationLabel = new FieldLabel(monitorComputationBtn, "Link to monitor the computation"); monitorComputationLabel.setLabelWidth(180); - vert.add(monitorComputationLabel, new VerticalLayoutData(-1, -1, - new Margins(0))); - - + vert.add(monitorComputationLabel, new VerticalLayoutData(-1, -1, new Margins(0))); + progressBar = new ProgressBar(); progressBar.updateProgress(0, "Starting..."); vert.add(progressBar, new VerticalLayoutData(1, -1, new Margins(20))); @@ -140,21 +136,18 @@ public class ComputationStatusPanel extends SimpleContainer { } }); - cancelComputationBtn.getElement().getStyle() - .setMarginBottom(36, Unit.PX); + cancelComputationBtn.getElement().getStyle().setMarginBottom(36, Unit.PX); - vert.add(cancelComputationBtn, new VerticalLayoutData(-1, -1, - new Margins(0))); + vert.add(cancelComputationBtn, new VerticalLayoutData(-1, -1, new Margins(0))); forceLayout(); timer.scheduleRepeating(Constants.TIME_UPDATE_COMPUTATION_STATUS_PANEL); } private void showEquivalentRequestDialog() { - EquivalentRequestDialog equivalentRequestDialog = new EquivalentRequestDialog( - computationId); + EquivalentRequestDialog equivalentRequestDialog = new EquivalentRequestDialog(computationId); equivalentRequestDialog.show(); } - + private void showLinkToMonitorComputationDialog() { LinkToMonitorComputationDialog linkToMonitorComputDialogDialog = new LinkToMonitorComputationDialog( computationId); @@ -162,8 +155,7 @@ public class ComputationStatusPanel extends SimpleContainer { } private void cancelComputation() { - CancelComputationExecutionRequestEvent event = new CancelComputationExecutionRequestEvent( - computationId); + CancelComputationExecutionRequestEvent event = new CancelComputationExecutionRequestEvent(computationId); EventBusProvider.INSTANCE.fireEvent(event); } @@ -172,8 +164,7 @@ public class ComputationStatusPanel extends SimpleContainer { * @param operator * */ - private void computationTerminated(ComputationId computationId, - ComputationStatus computationStatus) { + private void computationTerminated(ComputationId computationId, ComputationStatus computationStatus) { Log.debug("Computation Terminated"); Log.debug("Computation Status:" + computationStatus); if (terminated == false) { @@ -181,17 +172,14 @@ public class ComputationStatusPanel extends SimpleContainer { cancelComputationBtn.setVisible(false); if (computationStatus.isComplete()) { Log.debug("Computation is Complete"); - Info.display("Terminated", - "The computation " + computationId.getId() + " of " - + computationId.getOperatorName() - + " is terminated correctly."); + Info.display("Terminated", "The computation " + computationId.getId() + " of " + + computationId.getOperatorName() + " is terminated correctly."); int index = vert.getWidgetIndex(progressBar); vert.remove(index); // TODO progressBar = new GreenProgressBar(); progressBar.updateProgress(1, "Computation Complete"); - vert.insert(progressBar, index, new VerticalLayoutData(1, -1, - new Margins(20))); + vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20))); showComputationCompletedOutput(); } else if (computationStatus.isFailed()) { Log.debug("Computation is Failed"); @@ -199,49 +187,37 @@ public class ComputationStatusPanel extends SimpleContainer { if (computationStatus.getError() == null) { errorMessage = new String("Computation Failed!"); } else { - errorMessage = computationStatus.getError() - .getLocalizedMessage(); - ElementsHighlights el=new ElementsHighlights(); - errorMessage=el.createLinkFromText(errorMessage); - + errorMessage = computationStatus.getError().getLocalizedMessage(); + ElementsHighlights el = new ElementsHighlights(); + errorMessage = el.createLinkFromText(errorMessage); + } - Info.display("Failed", - "The computation " + computationId.getId() + " of " - + computationId.getOperatorName() - + " is failed."); - UtilsGXT3.alert("Failed", - "The computation " + computationId.getId() + " of " - + computationId.getOperatorName() - + " has failed.
" + errorMessage); + Info.display("Failed", "The computation " + computationId.getId() + " of " + + computationId.getOperatorName() + " is failed."); + UtilsGXT3.alert("Failed", "The computation " + computationId.getId() + " of " + + computationId.getOperatorName() + " has failed.
" + errorMessage); int index = vert.getWidgetIndex(progressBar); vert.remove(index); // TODO progressBar = new RedProgressBar(); progressBar.updateProgress(1, "Computation Failed"); - progressBar.getElement().getStyle() - .setMarginBottom(36, Unit.PX); - vert.insert(progressBar, index, new VerticalLayoutData(1, -1, - new Margins(20))); + progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX); + vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20))); } else if (computationStatus.isCancelled()) { Log.debug("Computation Cancelled"); String errorMessage; errorMessage = new String("Computation Cancelled!"); - Info.display("Info", "The computation " + computationId.getId() - + " of " + computationId.getOperatorName() - + " has been cancelled."); - UtilsGXT3.info("Info", - "The computation " + computationId.getId() + " of " - + computationId.getOperatorName() - + " has been cancelled.
" + errorMessage); + Info.display("Info", "The computation " + computationId.getId() + " of " + + computationId.getOperatorName() + " has been cancelled."); + UtilsGXT3.info("Info", "The computation " + computationId.getId() + " of " + + computationId.getOperatorName() + " has been cancelled.
" + errorMessage); int index = vert.getWidgetIndex(progressBar); vert.remove(index); // TODO progressBar = new OrangeProgressBar(); progressBar.updateProgress(1, "Computation Cancelled"); - progressBar.getElement().getStyle() - .setMarginBottom(36, Unit.PX); - vert.insert(progressBar, index, new VerticalLayoutData(1, -1, - new Margins(20))); + progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX); + vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20))); } } @@ -254,16 +230,11 @@ public class ComputationStatusPanel extends SimpleContainer { */ private void showComputationCompletedOutput() { HtmlLayoutContainer computationEndMessage = new HtmlLayoutContainer( - "

The computation " + computationId.getOperatorName() - + " finished.

"); - vert.add(computationEndMessage, new VerticalLayoutData(-1, -1, - new Margins(0))); - ComputationOutputPanel computationOutputPanel = new ComputationOutputPanel( - computationId); - computationOutputPanel.getElement().getStyle() - .setMarginBottom(36, Unit.PX); - vert.add(computationOutputPanel, new VerticalLayoutData(1, -1, - new Margins(0))); + "

The computation " + computationId.getOperatorName() + " finished.

"); + vert.add(computationEndMessage, new VerticalLayoutData(-1, -1, new Margins(0))); + ComputationOutputPanel computationOutputPanel = new ComputationOutputPanel(computationId); + computationOutputPanel.getElement().getStyle().setMarginBottom(36, Unit.PX); + vert.add(computationOutputPanel, new VerticalLayoutData(1, -1, new Margins(0))); } @@ -271,8 +242,7 @@ public class ComputationStatusPanel extends SimpleContainer { * @param computationStatus */ private void updateStatus(ComputationStatus computationStatus) { - Log.debug("Conputation Status Panel ::Update Status " - + computationStatus); + Log.debug("Conputation Status Panel ::Update Status " + computationStatus); if (computationStatus.getStatus().compareTo(Status.ACCEPTED) == 0) progressBar.updateText("Accepted..."); else { @@ -280,8 +250,7 @@ public class ComputationStatusPanel extends SimpleContainer { if (percentage == 0) { progressBar.updateText("Running, 0% Complete"); } else { - progressBar.updateProgress(percentage / 100, "Running, " - + percentage + "% Complete"); + progressBar.updateProgress(percentage / 100, "Running, " + percentage + "% Complete"); } } forceLayout(); @@ -292,8 +261,8 @@ public class ComputationStatusPanel extends SimpleContainer { @Override public void run() { Log.debug("Timer run ....."); - DataMinerPortletServiceAsync.INSTANCE.getComputationStatus( - computationId, new AsyncCallback() { + DataMinerPortletServiceAsync.INSTANCE.getComputationStatus(computationId, + new AsyncCallback() { @Override public void onFailure(Throwable caught) { @@ -301,25 +270,19 @@ public class ComputationStatusPanel extends SimpleContainer { vert.remove(index); // TODO progressBar = new RedProgressBar(); - progressBar.updateProgress(1, - "Failed to get the status"); - progressBar.getElement().getStyle() - .setMarginBottom(36, Unit.PX); - vert.insert(progressBar, index, - new VerticalLayoutData(1, -1, new Margins( - 20))); + progressBar.updateProgress(1, "Failed to get the status"); + progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX); + vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20))); } @Override - public void onSuccess( - ComputationStatus computationStatus) { - Log.debug("ComputationStatus: "+computationStatus); + public void onSuccess(ComputationStatus computationStatus) { + Log.debug("ComputationStatus: " + computationStatus); if (computationStatus != null) { if (computationStatus.isTerminated()) { ComputationTimer.this.cancel(); - computationTerminated(computationId, - computationStatus); + computationTerminated(computationId, computationStatus); } else updateStatus(computationStatus); }