use of org.vcell.workflow.Workflow in project vcell by virtualcell.
the class WorkflowGraphModel method setWorkflow.
/**
* Sets the graph property (cbit.vcell.mapping.potential.Graph) value.
* @param graph The new value for the property.
* @see #getGraph
*/
public void setWorkflow(Workflow workflow) {
Workflow oldValue = fieldWorkflow;
fieldWorkflow = workflow;
firePropertyChange("workflow", oldValue, workflow);
refreshAll();
}
use of org.vcell.workflow.Workflow in project vcell by virtualcell.
the class WorkflowModelPanel method setWorkflow.
/**
* Sets the graph property (cbit.vcell.mapping.potential.Graph) value.
* @param graph The new value for the property.
* @see #getGraph
*/
public void setWorkflow(Workflow workflow) {
Workflow oldValue = fieldWorkflow;
fieldWorkflow = workflow;
firePropertyChange("workflow", oldValue, workflow);
}
use of org.vcell.workflow.Workflow in project vcell by virtualcell.
the class WorkflowModelPanel method main.
/**
* main entrypoint - starts the part when it is run as an application
* @param args java.lang.String[]
*/
public static void main(java.lang.String[] args) {
try {
JFrame frame = new javax.swing.JFrame();
WorkflowModelPanel aWorkflowModelPanel;
aWorkflowModelPanel = new WorkflowModelPanel();
frame.setContentPane(aWorkflowModelPanel);
frame.setSize(aWorkflowModelPanel.getSize());
frame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
LocalWorkspace localWorkspace = new LocalWorkspace(new File("C:\\temp"));
Workflow workflow = new Workflow("temp");
class Task1 extends Task {
final DataInput<Double> in = new DataInput<Double>(Double.class, "in", this);
final DataOutput<Double> out = new DataOutput<Double>(Double.class, "out", this);
public Task1() {
super("t1");
addInput(in);
addOutput(out);
}
@Override
protected void compute0(TaskContext context, ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
System.out.println("executing task " + getName());
}
}
;
class Task2 extends Task {
final DataInput<Double> in = new DataInput<Double>(Double.class, "in", this);
final DataOutput<Double> out = new DataOutput<Double>(Double.class, "out", this);
public Task2() {
super("t2");
addInput(in);
addOutput(out);
}
@Override
protected void compute0(TaskContext context, ClientTaskStatusSupport clientTaskStatusSupport) throws Exception {
System.out.println("executing task " + getName());
}
}
;
Task1 task1 = new Task1();
workflow.addTask(task1);
Task2 task2 = new Task2();
workflow.addTask(task2);
workflow.connect2(task1.out, task2.in);
aWorkflowModelPanel.setWorkflow(workflow);
frame.setVisible(true);
java.awt.Insets insets = frame.getInsets();
frame.setSize(frame.getWidth() + insets.left + insets.right, frame.getHeight() + insets.top + insets.bottom);
frame.setVisible(true);
} catch (Throwable exception) {
System.err.println("Exception occurred in main() of javax.swing.JPanel");
exception.printStackTrace(System.out);
}
}
use of org.vcell.workflow.Workflow in project vcell by virtualcell.
the class WorkflowObjectsTableModel method setValueAt.
public void setValueAt(Object value, int row, int col) {
if (value == null) {
return;
}
try {
String inputValue = (String) value;
inputValue = inputValue.trim();
WorkflowObject workflowObject = getValueAt(row);
switch(col) {
case COLUMN_VALUE:
{
if (inputValue.length() == 0) {
return;
}
if (workflowObject instanceof WorkflowParameter) {
WorkflowParameter dataHolder = (WorkflowParameter) workflowObject;
Class dataClass = dataHolder.getType();
Repository repository = taskContext.getRepository();
Workflow workflow = taskContext.getWorkflow();
if (dataClass.equals(Double.class)) {
repository.setData(dataHolder, Double.valueOf(inputValue));
workflow.refreshStatus();
} else if (dataClass.equals(Float.class)) {
repository.setData(dataHolder, Float.valueOf(inputValue));
workflow.refreshStatus();
} else if (dataClass.equals(Integer.class)) {
repository.setData(dataHolder, Integer.valueOf(inputValue));
workflow.refreshStatus();
} else if (dataClass.equals(Boolean.class)) {
repository.setData(dataHolder, Boolean.valueOf(inputValue));
workflow.refreshStatus();
} else if (dataClass.equals(String.class)) {
repository.setData(dataHolder, inputValue);
workflow.refreshStatus();
} else {
System.out.println("type " + dataClass.getSimpleName() + " not supported");
}
}
break;
}
}
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
use of org.vcell.workflow.Workflow in project vcell by virtualcell.
the class WorkflowObjectsTableModel method setTaskContext.
public void setTaskContext(TaskContext taskContext) {
if (taskContext != null) {
Workflow workflow = taskContext.getWorkflow();
workflow.removePropertyChangeListener(this);
for (WorkflowParameter<? extends Object> dataHolder : workflow.getParameters()) {
dataHolder.removePropertyChangeListener(this);
}
for (Task task : workflow.getTasks()) {
task.removePropertyChangeListener(this);
}
}
this.taskContext = taskContext;
if (this.taskContext != null) {
Workflow workflow = this.taskContext.getWorkflow();
workflow.addPropertyChangeListener(this);
for (WorkflowParameter<? extends Object> dataHolder : workflow.getParameters()) {
dataHolder.addPropertyChangeListener(this);
}
for (Task task : workflow.getTasks()) {
task.addPropertyChangeListener(this);
}
}
refreshData();
}
Aggregations