use of com.igormaznitsa.mindmap.swing.panel.utils.ScalableIcon in project netbeans-mmd-plugin by raydac.
the class IconBlock method paint.
public void paint(@Nonnull final MMGraphics gfx) {
final int numberOfIcons = this.model.getNumberOfExtras();
if (numberOfIcons != 0) {
double offsetX = this.bounds.getX();
final int offsetY = (int) Math.round(this.bounds.getY());
final double scaledIconWidth = ScalableIcon.BASE_WIDTH * this.scale;
for (final Extra<?> e : this.currentExtras) {
final ScalableIcon ico;
switch(e.getType()) {
case FILE:
ico = findIconForFileType((ExtraFile) e);
break;
case LINK:
final String uri = ((ExtraLink) e).getAsString();
ico = uri.startsWith("mailto:") ? ScalableIcon.LINK_EMAIL : ScalableIcon.LINK;
break;
case NOTE:
ico = ScalableIcon.TEXT;
break;
case TOPIC:
ico = ScalableIcon.TOPIC;
break;
default:
// NOI18N
throw new Error("Unexpected extras");
}
if (scaledIconWidth >= 1.0d) {
gfx.drawImage(ico.getImage(this.scale), (int) Math.round(offsetX), offsetY);
offsetX += scaledIconWidth;
}
}
}
}
Aggregations