Package org.apache.airavata.workflow.model.graph

Examples of org.apache.airavata.workflow.model.graph.Port


    private Set<Node> getBlockBlock(Node node, boolean blockBlock) throws GraphException {
        Set<Node> block = new HashSet<Node>();

        int index = blockBlock ? 0 : 1;
        Port controlOutPort = node.getControlOutPorts().get(index);
        for (Node nextNode : controlOutPort.getToNodes()) {
            block.add(nextNode);
            getSpecialBlock(nextNode, 0, block, BlockNode.class, EndBlockNode.class);
        }
        return block;
    }
View Full Code Here


        for (Port controlOutPort : this.node.getControlOutPorts()) {
          NodeController.getGUI(controlOutPort).setOffset(new Point(getBounds().width, getBounds().height - this.headHeight / 2));
            break; // Has only one
        }

        Port port = this.node.getEPRPort();
        NodeController.getGUI(port).setOffset(new Point(getBounds().width / 2, this.headHeight / 4));
    }
View Full Code Here

    @Override
    protected void setPortPositions() {
        // inputs
        List<? extends Port> inputPorts = this.node.getInputPorts();
        for (int i = 0; i < inputPorts.size(); i++) {
            Port port = inputPorts.get(i);
            Point offset;
            if (i < inputPorts.size() / 2) {
                offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight
                        + PORT_INITIAL_GAP + PORT_GAP * i);
            } else {
                offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight
                        + PORT_INITIAL_GAP + PORT_GAP * (i + 1));
            }
            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);
            Point offset = new Point(this.getBounds().width
                    - PortGUI.DATA_PORT_SIZE / 2, (int) (this.headHeight
                    + PORT_INITIAL_GAP + PORT_GAP
                    * (outputPorts.size() / 2.0 + i)));
            NodeController.getGUI(port).setOffset(offset);
View Full Code Here

     */
    protected void setPortPositions() {
        // inputs
        List<? extends Port> inputPorts = getNode().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 = getNode().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);
        }

        // control-in
        Port controlInPort = getNode().getControlInPort();
        if (controlInPort != null) {
          NodeController.getGUI(controlInPort).setOffset(new Point(0, 0));
        }

        // control-outs
View Full Code Here

     * @param node
     */
    private void finishPredecessorNodes(Node node) {
        for (Port inputPort : node.getInputPorts()) {
            for (Edge edge : inputPort.getEdges()) {
                Port fromPort = edge.getFromPort();
                if (!(fromPort instanceof EPRPort)) {
                    Node fromNode = fromPort.getNode();
                    finishNode(fromNode);
                    finishPredecessorNodes(fromNode);
                }
            }
        }
        Port controlInPort = node.getControlInPort();
        if (controlInPort != null) {
            for (Node fromNode : controlInPort.getFromNodes()) {
                finishNode(fromNode);
                finishPredecessorNodes(fromNode);
            }
        }
    }
View Full Code Here

    public void graphCanvasChanged(GraphCanvasEvent event) {
        GraphCanvasEventType type = event.getType();
        GraphCanvas graphCanvas = event.getGraphCanvas();
        switch (type) {
        case INPUT_PORT_SELECTED:
            Port inputPort = graphCanvas.getSelectedInputPort();
            setInputPort(inputPort);
            break;
        case OUTPUT_PORT_SELECTED:
            Port outputPort = graphCanvas.getSelectedOutputPort();
            setOutputPort(outputPort);
            break;
        case GRAPH_LOADED:
        case NAME_CHANGED:
        case NODE_SELECTED:
View Full Code Here

                point2.x, point2.y);
        g.draw(line);
    }

    private Point getFromPosition() {
        Port port = this.edge.getFromPort();
        return NodeController.getGUI(port).getPosition();
    }
View Full Code Here

        Port port = this.edge.getFromPort();
        return NodeController.getGUI(port).getPosition();
    }

    private Point getToPosition() {
        Port port = this.edge.getToPort();
        return NodeController.getGUI(port).getPosition();
    }
View Full Code Here

     */
    @Override
    protected void setPortPositions() {
        // No input ports

        Port controlInPort = this.node.getControlInPort();
        if (controlInPort != null) {
          NodeController.getGUI(controlInPort).setOffset(new Point(0, 0));
        }

        // There are two controlOutPorts.
        List<? extends Port> controlOutPorts = this.node.getControlOutPorts();
        Port controlOutPort1 = controlOutPorts.get(0);
        Point offset = new Point(getBounds().width, +getBounds().height / 2);
        NodeController.getGUI(controlOutPort1).setOffset(offset);

        Port controlOutPort2 = controlOutPorts.get(1);
        offset = new Point(this.getBounds().width, getBounds().height);
        NodeController.getGUI(controlOutPort2).setOffset(offset);

        // No outputs
    }
View Full Code Here

                piece = node;
            }

            // Find the closest port of this node.
            double minPortDist = Double.MAX_VALUE;
            Port closestPort = null;
            for (Port port : node.getAllPorts()) {
                double dist = NodeController.getGUI(port).getPosition().distance(point);
                if (dist < minPortDist) {
                    closestPort = port;
                    minPortDist = dist;
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.model.graph.Port

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.