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

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


                    connect(this.draggedPort, freePort);
                    this.dynamicNodeWithFreePort = null;
                }

            } else if (graphPiece instanceof Port) {
                Port port = (Port) graphPiece;
                if (this.draggedPort.getKind() == Kind.DATA_OUT && port.getKind() == Kind.DATA_IN) {
                    connect(this.draggedPort, port);
                } else if (port.getKind() == Kind.DATA_OUT && this.draggedPort.getKind() == Kind.DATA_IN) {
                    connect(port, this.draggedPort);
                } else if (this.draggedPort.getKind() == Kind.CONTROL_OUT && port.getKind() == Kind.CONTROL_IN) {
                    connect(this.draggedPort, port);
                } else if (this.draggedPort.getKind() == Kind.CONTROL_IN && port.getKind() == Kind.CONTROL_OUT) {
                    connect(port, this.draggedPort);
                } else if (this.draggedPort.getKind() == Kind.EPR && port.getKind() == Kind.DATA_IN) {
                    connect(this.draggedPort, port);
                } else if (this.draggedPort.getKind() == Kind.DATA_IN && port.getKind() == Kind.EPR) {
                    connect(port, this.draggedPort);
                }
            }
            this.draggedPort = null;
        }
View Full Code Here


        event.consume();
      }
      if (this.draggedPort != null) {
        GraphPiece piece = NodeController.getGUI(this.graph).getGraphPieceAt(point);
        if (piece instanceof Port) {
          Port port = (Port) piece;
          // Display the information of port that is close to the mouse
          // pointer.
          if (this.draggedPort.getKind() == Kind.DATA_IN
              && port.getKind() == Kind.DATA_OUT) {
            this.panel.setCursor(SwingUtil.CROSSHAIR_CURSOR);
            selectOutputPort(port);
          } else if (this.draggedPort.getKind() == Kind.DATA_OUT
              && port.getKind() == Kind.DATA_IN) {
            this.panel.setCursor(SwingUtil.CROSSHAIR_CURSOR);
            selectInputPort(port);
          } else if (this.draggedPort.getKind() == Kind.DATA_IN
              && port.getKind() == Kind.EPR) {
            this.panel.setCursor(SwingUtil.CROSSHAIR_CURSOR);
            selectOutputPort(port);
          } else if (this.draggedPort.getKind() == Kind.EPR
              && port.getKind() == Kind.DATA_IN) {
            this.panel.setCursor(SwingUtil.CROSSHAIR_CURSOR);
            selectInputPort(port);
          } else {
            this.panel.setCursor(SwingUtil.DEFAULT_CURSOR);
          }
View Full Code Here

     */
    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 = 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);
        }

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

        // control-outs
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() {
    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);

  }
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 = 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);
        }

        // control in port
        Port controlInPort = this.node.getControlInPort();
        NodeController.getGUI(controlInPort).setOffset(new Point(0, 0));
    }
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 = 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);
        }

        // control out port
        List<? extends Port> controlOutPorts = this.node.getControlOutPorts();
        Port controlOutPort1 = controlOutPorts.get(0);
        Point offset = new Point(getBounds().width / 2, getBounds().height);
        NodeController.getGUI(controlOutPort1).setOffset(offset);
    }
View Full Code Here

    private void activeTabChanged() {
        GraphCanvas graphPanel = getGraphCanvas();

        if (graphPanel!=null) {
      // Reset the port viewers.
      Port inputPort = graphPanel.getSelectedInputPort();
      Port outputPort = graphPanel.getSelectedOutputPort();
      this.portViewer.setInputPort(inputPort);
      this.portViewer.setOutputPort(outputPort);
      // Reset component viewer.
      Node node = graphPanel.getSelectedNode();
      Component component;
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

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.