@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);