< prev index next >

application/org.openjdk.jmc.ui/src/main/java/org/openjdk/jmc/ui/charts/RendererToolkit.java

Print this page

        

*** 100,112 **** } private static class CompositeRenderer implements IXDataRenderer { ! private static final Color TOO_MUCH_CONTENT_BG = new Color(240, 240, 240, 190); private static final String TOO_MUCH_CONTENT_MSG = Messages .getString(Messages.RendererToolkit_TOO_MUCH_CONTENT); private final List<IXDataRenderer> children; private final List<Double> weights; private final String text; private final double totalWeight; --- 100,114 ---- } private static class CompositeRenderer implements IXDataRenderer { ! private static final Color MISMATCH_CONTENT_BG = new Color(240, 240, 240, 190); private static final String TOO_MUCH_CONTENT_MSG = Messages .getString(Messages.RendererToolkit_TOO_MUCH_CONTENT); + private static final String NO_CONTENT_MSG = Messages + .getString(Messages.RendererToolkit_NO_CONTENT); private final List<IXDataRenderer> children; private final List<Double> weights; private final String text; private final double totalWeight;
*** 141,162 **** context.translate(0, rowHeight); } } context.setTransform(oldTransform); if (result.size() != children.size()) { result = Collections.emptyList(); ! context.setPaint(TOO_MUCH_CONTENT_BG); context.fillRect(0, 0, xRange.getPixelExtent(), height); // FIXME: Draw something nice. Font orgFont = context.getFont(); Font italicFont = orgFont.deriveFont(Font.ITALIC); FontMetrics fm = context.getFontMetrics(italicFont); ! int msgWidth = fm.stringWidth(TOO_MUCH_CONTENT_MSG); if (height > fm.getHeight() && xRange.getPixelExtent() > msgWidth) { context.setFont(italicFont); context.setPaint(Color.BLACK); ! context.drawString(TOO_MUCH_CONTENT_MSG, (xRange.getPixelExtent() - msgWidth) / 2, (height - fm.getHeight()) / 2 + fm.getAscent()); context.setFont(orgFont); } } --- 143,165 ---- context.translate(0, rowHeight); } } context.setTransform(oldTransform); if (result.size() != children.size()) { + String displayMessage = result.size() == 0 ? NO_CONTENT_MSG : TOO_MUCH_CONTENT_MSG; result = Collections.emptyList(); ! context.setPaint(MISMATCH_CONTENT_BG); context.fillRect(0, 0, xRange.getPixelExtent(), height); // FIXME: Draw something nice. Font orgFont = context.getFont(); Font italicFont = orgFont.deriveFont(Font.ITALIC); FontMetrics fm = context.getFontMetrics(italicFont); ! int msgWidth = fm.stringWidth(displayMessage); if (height > fm.getHeight() && xRange.getPixelExtent() > msgWidth) { context.setFont(italicFont); context.setPaint(Color.BLACK); ! context.drawString(displayMessage, (xRange.getPixelExtent() - msgWidth) / 2, (height - fm.getHeight()) / 2 + fm.getAscent()); context.setFont(orgFont); } }
< prev index next >