int count = adapter.getChildCount();
for (int i = 0; i < count; i++) {
Component child = adapter.getChild(i);
WidgetAdapter childAdapter = WidgetAdapter.getWidgetAdapter(child);
if (childAdapter.isSelected()) {
Constraints constraints = layout.getConstraints(child);
Alignment horizontal = constraints.getHorizontal();
int y = child.getY() + child.getHeight() / 2;
int x = 0;
if (horizontal instanceof Leading) {
x = ((Leading) horizontal).getLeading();
g2d.drawLine(insets.left, y, insets.left + x, y);
Polygon polygon = new Polygon();
polygon.addPoint(insets.left, y - BOX + 1);
polygon.addPoint(insets.left, y + BOX);
polygon.addPoint(insets.left + BOX, y);
g2d.fillPolygon(polygon);
} else if (horizontal instanceof Trailing) {
x = child.getX() + child.getWidth();
g2d.drawLine(width - insets.right, y, x, y);
Polygon polygon = new Polygon();
polygon.addPoint(width - insets.right, y - BOX);
polygon.addPoint(width - insets.right, y + BOX - 1);
polygon.addPoint(width - BOX - insets.right, y);
g2d.fillPolygon(polygon);
} else if (horizontal instanceof Bilateral) {
x = ((Bilateral) horizontal).getLeading();
g2d.drawLine(insets.left, y, insets.left + x, y);
Polygon polygon = new Polygon();
polygon.addPoint(insets.left, y - BOX + 1);
polygon.addPoint(insets.left, y + BOX);
polygon.addPoint(insets.left + BOX, y);
g2d.fillPolygon(polygon);
x = child.getX() + child.getWidth();
g2d.drawLine(width - insets.right, y, x, y);
polygon = new Polygon();
polygon.addPoint(width - insets.right, y - BOX);
polygon.addPoint(width - insets.right, y + BOX - 1);
polygon.addPoint(width - BOX - insets.right, y);
g2d.fillPolygon(polygon);
}
Alignment vertical = constraints.getVertical();
x = child.getX() + child.getWidth() / 2;
if (vertical instanceof Leading) {
y = ((Leading) vertical).getLeading();
g2d.drawLine(x, insets.top, x, insets.top + y);
Polygon polygon = new Polygon();