protected void validateConnectWidget(ConnectWidget widget) { Point point = widget.getPoint(); if (widget.getRole() == HyperEdge.INPUT) { // Should have fixed position Point p = getLinkPoint(); point.x = p.x + 1; point.y = p.y; return; } // Always in the north Rectangle bounds = getBounds(); int fixedY = bounds.y + RenderableGene.GENE_SYMBOL_WIDTH / 2 - 2; if (point.y != fixedY) point.y = fixedY; double ratio = widget.getLinkRatio(); // Don't let x goes out of the bounds if (ratio > 0.0) { point.x = (int) (bounds.x + bounds.width * ratio); } else if (point.x < bounds.x) point.x = bounds.x; else if (point.x > bounds.x + bounds.width) point.x = bounds.x + bounds.width; }