@Override
public final void paintIcon(InstancePainter painter) {
Graphics g = painter.getGraphics();
g.setColor(Color.black);
if (painter.getGateShape() == AppPreferences.SHAPE_RECTANGULAR) {
Icon iconRect = getIconRectangular();
if (iconRect != null) {
iconRect.paintIcon(painter.getDestination(), g, 2, 2);
} else {
paintIconRectangular(painter);
}
} else if (painter.getGateShape() == AppPreferences.SHAPE_DIN40700) {
Icon iconDin = getIconDin40700();
if (iconDin != null) {
iconDin.paintIcon(painter.getDestination(), g, 2, 2);
} else {
paintIconRectangular(painter);
}
} else {
Icon iconShaped = getIconShaped();
if (iconShaped != null) {
iconShaped.paintIcon(painter.getDestination(), g, 2, 2);
} else {
paintIconShaped(painter);
}
}
}