2016-04-06 18:28:32 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package org.gcube.portlets.user.dataminermanager.client.experimentArea;
|
|
|
|
|
|
|
|
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
|
|
|
|
import org.gcube.portlets.user.dataminermanager.client.bean.Operator;
|
|
|
|
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
|
2016-04-07 20:13:35 +02:00
|
|
|
import org.gcube.portlets.user.dataminermanager.client.events.EmptyComputationPanelEvent;
|
2016-04-06 18:28:32 +02:00
|
|
|
import org.gcube.portlets.user.dataminermanager.client.events.ResubmitComputationEvent;
|
|
|
|
import org.gcube.portlets.user.dataminermanager.client.experimentArea.WorkflowOperatorPanel.WorkflowOperatorPanelHandler;
|
|
|
|
|
2016-04-07 20:13:35 +02:00
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
2016-04-06 18:28:32 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.TabItemConfig;
|
|
|
|
import com.sencha.gxt.widget.core.client.TabPanel;
|
|
|
|
|
|
|
|
/**
|
2016-04-07 20:13:35 +02:00
|
|
|
*
|
|
|
|
* @author Giancarlo Panichi email: <a
|
|
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
2016-04-06 18:28:32 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class WorkflowPanel extends TabPanel {
|
2016-04-07 20:13:35 +02:00
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
public static final String DEFAULT_OPERATOR = "AQUAMAPS_SUITABLE";
|
2016-04-07 20:13:35 +02:00
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
private WorkflowOperatorPanel workflowOperatorPanel;
|
2016-04-07 20:13:35 +02:00
|
|
|
private ComputationExecutionPanel computationExecutionPanel;
|
2016-04-06 18:28:32 +02:00
|
|
|
private ComputationPanel computationPanel;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public WorkflowPanel() {
|
|
|
|
super();
|
2016-04-07 20:13:35 +02:00
|
|
|
init();
|
|
|
|
create();
|
2016-04-06 18:28:32 +02:00
|
|
|
bind();
|
2016-04-07 20:13:35 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void init() {
|
2016-04-06 18:28:32 +02:00
|
|
|
setBodyBorder(false);
|
2016-04-07 20:13:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void create() {
|
|
|
|
workflowOperatorPanel = null;
|
|
|
|
|
|
|
|
TabItemConfig tabWorkFlowLcItemConf = new TabItemConfig(
|
|
|
|
".: Computation", false);
|
|
|
|
tabWorkFlowLcItemConf.setIcon(DataMinerManager.resources
|
|
|
|
.folderExplore());
|
|
|
|
computationPanel = new ComputationPanel();
|
|
|
|
computationPanel
|
|
|
|
.addEmptyComputationPanelEventHandler(new EmptyComputationPanelEvent.EmptyComputationPanelEventHandler() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onEmpty(EmptyComputationPanelEvent event) {
|
|
|
|
Log.debug("EmptyComputationPanelEvent Received");
|
|
|
|
workflowOperatorPanel = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
add(computationPanel, tabWorkFlowLcItemConf);
|
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
TabItemConfig tabComputationPanelItemConf = new TabItemConfig(
|
|
|
|
".: Computations Execution", false);
|
2016-04-07 20:13:35 +02:00
|
|
|
tabComputationPanelItemConf.setIcon(DataMinerManager.resources
|
|
|
|
.folderExplore());
|
|
|
|
computationExecutionPanel = new ComputationExecutionPanel();
|
|
|
|
add(computationExecutionPanel, tabComputationPanelItemConf);
|
2016-04-06 18:28:32 +02:00
|
|
|
|
|
|
|
setActiveWidget(computationPanel);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2016-04-07 20:13:35 +02:00
|
|
|
private void bind() {
|
|
|
|
EventBusProvider.INSTANCE.addHandler(
|
|
|
|
ResubmitComputationEvent.getType(),
|
|
|
|
new ResubmitComputationEvent.ResubmitComputationHandler() {
|
|
|
|
@Override
|
|
|
|
public void onResubmitComputation(
|
|
|
|
ResubmitComputationEvent event) {
|
|
|
|
setActiveWidget(computationExecutionPanel);
|
|
|
|
}
|
|
|
|
});
|
2016-04-06 18:28:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-04-07 20:13:35 +02:00
|
|
|
* @param computationTitle
|
|
|
|
* @param operator
|
2016-04-06 18:28:32 +02:00
|
|
|
*
|
|
|
|
*/
|
2016-04-07 20:13:35 +02:00
|
|
|
private void startComputation(String computationTitle,
|
|
|
|
String computationDescription) {
|
2016-04-06 18:28:32 +02:00
|
|
|
|
2016-04-07 20:13:35 +02:00
|
|
|
if (workflowOperatorPanel != null) {
|
2016-04-06 18:28:32 +02:00
|
|
|
forceLayout();
|
|
|
|
workflowOperatorPanel.updateOperatorParametersValues();
|
|
|
|
Operator op = workflowOperatorPanel.getOperator();
|
2016-04-07 20:13:35 +02:00
|
|
|
|
|
|
|
computationExecutionPanel.startNewComputation(op, computationTitle,
|
|
|
|
computationDescription);
|
2016-04-06 18:28:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addOperator(Operator op) {
|
2016-04-07 20:13:35 +02:00
|
|
|
setActiveWidget(computationPanel);
|
2016-04-06 18:28:32 +02:00
|
|
|
|
|
|
|
workflowOperatorPanel = new WorkflowOperatorPanel(op);
|
|
|
|
workflowOperatorPanel.setHandler(new WorkflowOperatorPanelHandler() {
|
|
|
|
@Override
|
2016-04-07 20:13:35 +02:00
|
|
|
public void startComputation(String computationTitle,
|
|
|
|
String computationDescription) {
|
|
|
|
WorkflowPanel.this.startComputation(computationTitle,
|
|
|
|
computationDescription);
|
|
|
|
setActiveWidget(computationExecutionPanel);
|
2016-04-06 18:28:32 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-04-07 20:13:35 +02:00
|
|
|
computationPanel.addWorkflowOperatorPanel(workflowOperatorPanel);
|
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
}
|
2016-04-07 20:13:35 +02:00
|
|
|
|
2016-04-06 18:28:32 +02:00
|
|
|
}
|