static void paintValue(InstancePainter painter, Value value) {
Graphics g = painter.getGraphics();
// intentionally with no graphics object - we don't want label included
Bounds bds = painter.getBounds();
RadixOption radix = painter.getAttributeValue(RadixOption.ATTRIBUTE);
if (radix == null || radix == RadixOption.RADIX_2) {
int x = bds.getX();
int y = bds.getY();
int wid = value.getWidth();
if (wid == 0) {
x += bds.getWidth() / 2;
y += bds.getHeight() / 2;
GraphicsUtil.switchToWidth(g, 2);
g.drawLine(x - 4, y, x + 4, y);
return;
}
int x0 = bds.getX() + bds.getWidth() - 5;
int compWidth = wid * 10;
if (compWidth < bds.getWidth() - 3) {
x0 = bds.getX() + (bds.getWidth() + compWidth) / 2 - 5;
}
int cx = x0;
int cy = bds.getY() + bds.getHeight() - 12;
int cur = 0;
for (int k = 0; k < wid; k++) {
GraphicsUtil.drawCenteredText(g,
value.get(k).toDisplayString(), cx, cy);
++cur;
if (cur == 8) {
cur = 0;
cx = x0;
cy -= 20;
} else {
cx -= 10;
}
}
} else {
String text = radix.toString(value);
GraphicsUtil.drawCenteredText(g, text,
bds.getX() + bds.getWidth() / 2,
bds.getY() + bds.getHeight() / 2);
}
}