114 lines
2.9 KiB
Java
114 lines
2.9 KiB
Java
/**
|
|
*
|
|
*/
|
|
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;
|
|
import org.gcube.portlets.user.dataminermanager.client.events.ResubmitComputationEvent;
|
|
import org.gcube.portlets.user.dataminermanager.client.events.StartComputationEvent;
|
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
|
import com.sencha.gxt.widget.core.client.TabItemConfig;
|
|
import com.sencha.gxt.widget.core.client.TabPanel;
|
|
|
|
/**
|
|
*
|
|
* @author Giancarlo Panichi email: <a
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
*
|
|
*/
|
|
public class WorkflowPanel extends TabPanel {
|
|
|
|
public static final String DEFAULT_OPERATOR = "AQUAMAPS_SUITABLE";
|
|
|
|
|
|
private ComputationExecutionPanel computationExecutionPanel;
|
|
private ComputationPanel computationPanel;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public WorkflowPanel() {
|
|
super();
|
|
init();
|
|
create();
|
|
bind();
|
|
|
|
}
|
|
|
|
private void init() {
|
|
setBodyBorder(false);
|
|
}
|
|
|
|
private void create() {
|
|
|
|
TabItemConfig tabWorkFlowLcItemConf = new TabItemConfig(
|
|
".: Computation", false);
|
|
tabWorkFlowLcItemConf.setIcon(DataMinerManager.resources
|
|
.folderExplore());
|
|
computationPanel = new ComputationPanel();
|
|
computationPanel
|
|
.addStartComputationEventHandler(new StartComputationEvent.StartComputationEventHandler() {
|
|
|
|
@Override
|
|
public void onStart(StartComputationEvent event) {
|
|
Log.debug("StartComputationEvent Received:"+event);
|
|
startComputation(event.getOp(), event.getComputationTitle(),
|
|
event.getComputationDescription());
|
|
|
|
}
|
|
});
|
|
add(computationPanel, tabWorkFlowLcItemConf);
|
|
|
|
TabItemConfig tabComputationPanelItemConf = new TabItemConfig(
|
|
".: Computations Execution", false);
|
|
tabComputationPanelItemConf.setIcon(DataMinerManager.resources
|
|
.folderExplore());
|
|
computationExecutionPanel = new ComputationExecutionPanel();
|
|
add(computationExecutionPanel, tabComputationPanelItemConf);
|
|
|
|
setActiveWidget(computationPanel);
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private void bind() {
|
|
EventBusProvider.INSTANCE.addHandler(
|
|
ResubmitComputationEvent.getType(),
|
|
new ResubmitComputationEvent.ResubmitComputationHandler() {
|
|
@Override
|
|
public void onResubmitComputation(
|
|
ResubmitComputationEvent event) {
|
|
setActiveWidget(computationExecutionPanel);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @param computationTitle
|
|
* @param operator
|
|
*
|
|
*/
|
|
private void startComputation(Operator op, String computationTitle,
|
|
String computationDescription) {
|
|
setActiveWidget(computationExecutionPanel);
|
|
computationExecutionPanel.startNewComputation(op, computationTitle,
|
|
computationDescription);
|
|
|
|
|
|
}
|
|
|
|
public void addOperator(Operator op) {
|
|
setActiveWidget(computationPanel);
|
|
computationPanel.addOperator(op);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|