fixed drag&drop when spacing changes

This commit is contained in:
bancika
2011-01-21 23:06:48 +00:00
parent 9fdf7c3e46
commit 99d85a2d1f
2 changed files with 57 additions and 38 deletions
@@ -94,6 +94,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
}
g2d.setColor(bodyColor);
g2d.fill(shape);
decorateComponentBody(g2d);
g2d.setComposite(oldComposite);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.setColor(componentState == ComponentState.SELECTED
@@ -126,7 +127,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
g2d.setFont(Constants.LABEL_FONT);
g2d
.setColor(componentState == ComponentState.SELECTED ? LABEL_COLOR_SELECTED
: LABEL_COLOR);
: getLabelColor());
FontMetrics fontMetrics = g2d.getFontMetrics();
String label = display == Display.NAME ? getName() : getValue().toString();
// Adjust label angle if needed to make sure that it's readable.
@@ -139,6 +140,14 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
(int) (shapeRect.height - textRect.getHeight()) / 2 + fontMetrics.getAscent());
}
protected void decorateComponentBody(Graphics2D g2d) {
// Do nothing.
}
protected Color getLabelColor() {
return LABEL_COLOR;
}
protected boolean shouldShadeLeads() {
return true;
}