Search in sources :

Example 1 with PortGUI

use of org.apache.airavata.xbaya.ui.graph.PortGUI in project airavata by apache.

the class IfNodeGUI 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);
    }
    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);
    PortGUI truePortGUI = NodeController.getGUI(controlOutPort1);
    truePortGUI.setOffset(offset);
    truePortGUI.setPortText("T");
    Port controlOutPort2 = controlOutPorts.get(1);
    offset = new Point(this.getBounds().width, getBounds().height - this.headHeight / 2);
    PortGUI falsePortGUI = NodeController.getGUI(controlOutPort2);
    falsePortGUI.setOffset(offset);
    falsePortGUI.setPortText("F");
// No outputs
}
Also used : PortGUI(org.apache.airavata.xbaya.ui.graph.PortGUI) 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)

Aggregations

Point (java.awt.Point)1 Port (org.apache.airavata.workflow.model.graph.Port)1 PortImpl (org.apache.airavata.workflow.model.graph.impl.PortImpl)1 PortGUI (org.apache.airavata.xbaya.ui.graph.PortGUI)1