Search in sources :

Example 1 with PortImpl

use of org.apache.airavata.workflow.model.graph.impl.PortImpl in project airavata by apache.

the class WSGraphFactory method createPort.

public PortImpl createPort(XmlElement portElement) {
    String type = portElement.attributeValue(GraphSchema.NS, GraphSchema.PORT_TYPE_ATTRIBUTE);
    if (type == null) {
        // Old graphs don't have the namespace for the attribute.
        type = portElement.attributeValue(GraphSchema.PORT_TYPE_ATTRIBUTE);
    }
    PortImpl port;
    if (GraphSchema.PORT_TYPE_WS_DATA.equals(type)) {
        port = new WSPort(portElement);
    } else if (GraphSchema.PORT_TYPE_SYSTEM_DATA.equals(type)) {
        port = new SystemDataPort(portElement);
    } else if (GraphSchema.PORT_TYPE_CONTROL.equals(type)) {
        port = new ControlPort(portElement);
    } else if (GraphSchema.PORT_TYPE_EPR.equals(type)) {
        port = new EPRPort(portElement);
    } else if (GraphSchema.PORT_TYPE_INSTANCE.equals(type)) {
        port = new InstanceDataPort(portElement);
    } else {
        // Default is WsPort because of backword compatibility
        port = new WSPort(portElement);
    }
    return port;
}
Also used : EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) ControlPort(org.apache.airavata.workflow.model.graph.ControlPort) InstanceDataPort(org.apache.airavata.workflow.model.graph.amazon.InstanceDataPort) SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort) PortImpl(org.apache.airavata.workflow.model.graph.impl.PortImpl)

Example 2 with PortImpl

use of org.apache.airavata.workflow.model.graph.impl.PortImpl in project airavata by apache.

the class WSGraphFactory method createPort.

/**
 * @see org.apache.airavata.workflow.model.graph.GraphFactory#createPort(org.xmlpull.infoset.XmlElement)
 */
public PortImpl createPort(JsonObject portObject) {
    String type = portObject.getAsJsonPrimitive(GraphSchema.PORT_TYPE_ATTRIBUTE).getAsString();
    PortImpl port;
    if (GraphSchema.PORT_TYPE_WS_DATA.equals(type)) {
        port = new WSPort(portObject);
    } else if (GraphSchema.PORT_TYPE_SYSTEM_DATA.equals(type)) {
        port = new SystemDataPort(portObject);
    } else if (GraphSchema.PORT_TYPE_CONTROL.equals(type)) {
        port = new ControlPort(portObject);
    /*        } else if (GraphSchema.PORT_TYPE_EPR.equals(type)) {
            port = new EPRPort(portElement);
        } else if (GraphSchema.PORT_TYPE_INSTANCE.equals(type)) {
            port = new InstanceDataPort(portElement);*/
    } else {
        // Default is WsPort because of backword compatibility
        port = new WSPort(portObject);
    }
    return port;
}
Also used : ControlPort(org.apache.airavata.workflow.model.graph.ControlPort) SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort) PortImpl(org.apache.airavata.workflow.model.graph.impl.PortImpl)

Example 3 with PortImpl

use of org.apache.airavata.workflow.model.graph.impl.PortImpl in project airavata by apache.

the class ExitNode method getEdges.

protected List<ControlEdge> getEdges() {
    PortImpl port = getControlInPort();
    List<ControlEdge> edges = (List<ControlEdge>) port.getEdges();
    return edges;
}
Also used : List(java.util.List) PortImpl(org.apache.airavata.workflow.model.graph.impl.PortImpl) ControlEdge(org.apache.airavata.workflow.model.graph.ControlEdge)

Example 4 with PortImpl

use of org.apache.airavata.workflow.model.graph.impl.PortImpl in project airavata by apache.

the class DoWhileNodeGUI method setPortPositions.

/**
 * Sets up the position of ports
 */
@Override
protected void setPortPositions() {
    List<? extends Port> inputPorts = this.node.getInputPorts();
    for (int i = 0; i < inputPorts.size(); i++) {
        Port port = inputPorts.get(i);
        Point offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight + PORT_INITIAL_GAP + PORT_GAP * i);
        NodeController.getGUI(port).setOffset(offset);
    }
    // outputs
    List<? extends Port> outputPorts = this.node.getOutputPorts();
    for (int i = 0; i < outputPorts.size(); i++) {
        Port port = outputPorts.get(i);
        // Use getBounds() instead of this.dimension because subclass might
        // overwrite getBounds() to have different shape.
        Point offset = new Point(this.getBounds().width - PortGUI.DATA_PORT_SIZE / 2, this.headHeight + PORT_INITIAL_GAP + PORT_GAP * i);
        NodeController.getGUI(port).setOffset(offset);
    }
    PortImpl controlInPort = this.node.getControlInPort();
    if (controlInPort != null) {
        Point offset = new Point(0, this.headHeight / 2);
        NodeController.getGUI(controlInPort).setOffset(offset);
    }
    // There are two controlOutPorts.
    List<? extends Port> controlOutPorts = this.node.getControlOutPorts();
    Port controlOutPort1 = controlOutPorts.get(0);
    Point offset = new Point(getBounds().width, +this.headHeight / 2);
    NodeController.getGUI(controlOutPort1).setOffset(offset);
    Port controlOutPort2 = controlOutPorts.get(1);
    offset = new Point(this.getBounds().width, getBounds().height - this.headHeight / 2);
    NodeController.getGUI(controlOutPort2).setOffset(offset);
}
Also used : Port(org.apache.airavata.workflow.model.graph.Port) Point(java.awt.Point) Point(java.awt.Point) PortImpl(org.apache.airavata.workflow.model.graph.impl.PortImpl)

Example 5 with PortImpl

use of org.apache.airavata.workflow.model.graph.impl.PortImpl in project airavata by apache.

the class ForEachNodeGUI method setPortPositions.

/**
 * Sets up the position of ports
 */
@Override
protected void setPortPositions() {
    super.setPortPositions();
    PortImpl controlInPort = this.node.getControlInPort();
    if (controlInPort != null) {
        Point off = new Point(0, this.headHeight / 2);
        NodeController.getGUI(controlInPort).setOffset(off);
    }
}
Also used : Point(java.awt.Point) PortImpl(org.apache.airavata.workflow.model.graph.impl.PortImpl)

Aggregations

PortImpl (org.apache.airavata.workflow.model.graph.impl.PortImpl)7 Point (java.awt.Point)3 Port (org.apache.airavata.workflow.model.graph.Port)3 ControlPort (org.apache.airavata.workflow.model.graph.ControlPort)2 SystemDataPort (org.apache.airavata.workflow.model.graph.system.SystemDataPort)2 List (java.util.List)1 WSComponent (org.apache.airavata.workflow.model.component.ws.WSComponent)1 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)1 ControlEdge (org.apache.airavata.workflow.model.graph.ControlEdge)1 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)1 Node (org.apache.airavata.workflow.model.graph.Node)1 InstanceDataPort (org.apache.airavata.workflow.model.graph.amazon.InstanceDataPort)1 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)1 WSGraph (org.apache.airavata.workflow.model.graph.ws.WSGraph)1 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)1 WSPort (org.apache.airavata.workflow.model.graph.ws.WSPort)1 Workflow (org.apache.airavata.workflow.model.wf.Workflow)1 PortGUI (org.apache.airavata.xbaya.ui.graph.PortGUI)1