Package edu.indiana.extreme.xbaya.graph

Examples of edu.indiana.extreme.xbaya.graph.Port


    @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));
            }
            port.getGUI().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)));
            port.getGUI().setOffset(offset);
        }

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

        // control-out
        for (Port controlOutPort : this.node.getControlOutPorts()) {
            controlOutPort.getGUI().setOffset(
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);
            port.getGUI().setOffset(offset);
        }

        PortImpl controlInPort = this.node.getControlInPort();
        if (controlInPort != null) {
            Point offset = new Point(0, this.headHeight / 2);
            controlInPort.getGUI().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);
        controlOutPort1.getGUI().setOffset(offset);

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

        // No outputs
    }
View Full Code Here

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

        Port controlInPort = this.node.getControlInPort();
        if (controlInPort != null) {
            controlInPort.getGUI().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);
        controlOutPort1.getGUI().setOffset(offset);

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

        // No outputs
    }
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));
            }
            port.getGUI().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)));
            port.getGUI().setOffset(offset);
        }

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

        // control-out
        for (Port controlOutPort : this.node.getControlOutPorts()) {
            controlOutPort.getGUI().setOffset(
View Full Code Here

                    new Point(getBounds().width, getBounds().height
                            - this.headHeight / 2));
            break; // Has only one
        }

        Port port = this.node.getEPRPort();
        port.getGUI().setOffset(
                new Point(getBounds().width / 2, this.headHeight / 4));
    }
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

            Node fromNode = port.getFromNode();
            if (fromNode instanceof InputNode) {
                value = PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('"
                        + fromNode.getID() + "')";
            } else {
                Port fromPort = port.getFromPort();
                value = "" + fromNode.getID() + INVOKER_SUFFIX + "."
                        + GET_OUTPUT_METHOD + "('" + fromPort.getName() + "')";

                // This might try to remove a node that has been removed
                // already, but it's OK.
                this.executingNodes.remove(fromNode);
            }
View Full Code Here

    }

    private void writeOutput(OutputNode node, PrintWriter pw)
            throws GraphException {
        String id = node.getID();
        Port port = node.getPort();

        Node fromNode = port.getFromNode();
        if (fromNode == null) {
            throw new GraphException(
                    "Output parameter has to be connected to some node.");
        }
        Port fromPort = port.getFromPort();
        if (fromNode instanceof InputNode) {
            // The OutputNode is directly connected to an InputNode.
            pw.println(TAB + id + VALUE_SUFFIX + " = " + PROPERTIES_VARIABLE
                    + "." + GET_PROPERTY_METHOD + "('" + fromNode.getID()
                    + "')");
        } else {
            pw.println(TAB + "# Wait output " + id);
            pw.println(TAB + id + VALUE_SUFFIX + " = " + fromNode.getID()
                    + INVOKER_SUFFIX + "." + GET_OUTPUT_METHOD + "('"
                    + fromPort.getName() + "')");
        }
        pw.println(TAB + "print '" + id + " = ', " + id + VALUE_SUFFIX);

        // This might try to remove a node that has been removed
        // already, but it's OK.
View Full Code Here

                        return false;
                    }
                }
            }
        }
        Port port = node.getControlInPort();
        if (port != null) {
            Collection<Node> fromNodes = port.getFromNodes();
            for (Node fromNode : fromNodes) {
                if (this.notYetInvokedNodes.contains(fromNode)) {
                    return false;
                }
            }
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);
      port.getGUI().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);
      port.getGUI().setOffset(offset);
    }

    // control in port
    Port controlInPort = this.node.getControlInPort();
    controlInPort.getGUI().setOffset(new Point(0,0));
  }
View Full Code Here

TOP

Related Classes of edu.indiana.extreme.xbaya.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.