Search in sources :

Example 6 with GraphEvent

use of cbit.gui.graph.GraphEvent in project vcell by virtualcell.

the class WorkflowGraphModel method refreshAll.

/**
 * Insert the method's description here.
 * Creation date: (7/8/2003 9:11:57 AM)
 */
@Override
public void refreshAll() {
    clearAllShapes();
    if (getWorkflow() == null) {
        fireGraphChanged(new GraphEvent(this));
        return;
    }
    ContainerShape containerShape = new SimpleContainerShape(new Object(), this, "workflow-container");
    addShape(containerShape);
    // 
    for (Task task : getWorkflow().getTasks()) {
        TaskShape taskShape = new TaskShape(task, this);
        containerShape.addChildShape(taskShape);
        addShape(taskShape);
        // 
        for (DataOutput<? extends Object> output : task.getOutputs()) {
            if (!output.getName().equals("displayed")) {
                DataHolderShape dataHolderShape = new DataHolderShape(output, this);
                containerShape.addChildShape(dataHolderShape);
                addShape(dataHolderShape);
                WorkflowEdgeShape workflowEdgeShape = new WorkflowEdgeShape(task.getName() + ":" + output.getName(), taskShape, dataHolderShape, this, true, false);
                containerShape.addChildShape(workflowEdgeShape);
                addShape(workflowEdgeShape);
            }
        }
    // //
    // // add a DataInputShape for each input and connect to TaskShape with an edge
    // //
    // for (DataInput<? extends Object> input : task.getInputs()){
    // DataInputShape dataInputShape = new DataInputShape(input,this);
    // containerShape.addChildShape(dataInputShape);
    // addShape(dataInputShape);
    // 
    // WorkflowEdgeShape workflowEdgeShape = new WorkflowEdgeShape("input:"+task.getName()+":"+input.name,dataInputShape, taskShape, this, true, false);
    // containerShape.addChildShape(workflowEdgeShape);
    // addShape(workflowEdgeShape);
    // }
    }
    // 
    for (Task task : getWorkflow().getTasks()) {
        for (DataInput<? extends Object> input : task.getInputs()) {
            DataObject<? extends Object> source = getWorkflow().getConnectorSource(input);
            if (source instanceof DataOutput) {
                DataHolderShape dataHolderShape = (DataHolderShape) getShapeFromModelObject(source);
                TaskShape taskShape = (TaskShape) getShapeFromModelObject(task);
                WorkflowEdgeShape workflowEdgeShape = new WorkflowEdgeShape("connection:" + input.getName(), dataHolderShape, taskShape, this, true, false);
                containerShape.addChildShape(workflowEdgeShape);
                addShape(workflowEdgeShape);
            }
        }
    }
    fireGraphChanged(new GraphEvent(this));
}
Also used : DataOutput(org.vcell.workflow.DataOutput) Task(org.vcell.workflow.Task) GraphEvent(cbit.gui.graph.GraphEvent) SimpleContainerShape(cbit.gui.graph.SimpleContainerShape) ContainerShape(cbit.gui.graph.ContainerShape) DataObject(org.vcell.workflow.DataObject) SimpleContainerShape(cbit.gui.graph.SimpleContainerShape)

Aggregations

GraphEvent (cbit.gui.graph.GraphEvent)6 Shape (cbit.gui.graph.Shape)4 Structure (cbit.vcell.model.Structure)3 HashSet (java.util.HashSet)3 ContainerShape (cbit.gui.graph.ContainerShape)2 SimpleContainerShape (cbit.gui.graph.SimpleContainerShape)2 Catalyst (cbit.vcell.model.Catalyst)2 Diagram (cbit.vcell.model.Diagram)2 Feature (cbit.vcell.model.Feature)2 FluxReaction (cbit.vcell.model.FluxReaction)2 Membrane (cbit.vcell.model.Membrane)2 Product (cbit.vcell.model.Product)2 ProductPattern (cbit.vcell.model.ProductPattern)2 Reactant (cbit.vcell.model.Reactant)2 ReactantPattern (cbit.vcell.model.ReactantPattern)2 ReactionParticipant (cbit.vcell.model.ReactionParticipant)2 ReactionRule (cbit.vcell.model.ReactionRule)2 ReactionRuleParticipant (cbit.vcell.model.ReactionRuleParticipant)2 ReactionStep (cbit.vcell.model.ReactionStep)2 RuleParticipantLongSignature (cbit.vcell.model.RuleParticipantLongSignature)2