inline statistics for tests: hide tests tree attempt

This commit is contained in:
Anna Kozlova
2015-05-25 18:06:46 +02:00
parent bc94e2714b
commit e9cb730532
@@ -196,9 +196,8 @@ public abstract class TestTreeView extends Tree implements DataProvider, CopyPro
final AbstractTestProxy testProxy = ((BaseTestProxyNodeDescriptor)data).getElement();
final String durationString = testProxy.getDurationString();
if (durationString != null) {
g.setColor(isRowSelected(row) ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeForeground());
Rectangle fullRowRect = new Rectangle(visibleRect.x, rowBounds.y, visibleRect.width, rowBounds.height);
paintRowData(this, durationString, fullRowRect, (Graphics2D)g);
final Rectangle fullRowRect = new Rectangle(visibleRect.x, rowBounds.y, visibleRect.width, rowBounds.height);
paintRowData(this, durationString, fullRowRect, (Graphics2D)g, isRowSelected(row), hasFocus());
}
}
}
@@ -207,14 +206,17 @@ public abstract class TestTreeView extends Tree implements DataProvider, CopyPro
}
}
private static void paintRowData(Tree tree, String duration, Rectangle bounds, Graphics2D g) {
private static void paintRowData(Tree tree, String duration, Rectangle bounds, Graphics2D g, boolean isSelected, boolean hasFocus) {
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
final FontMetrics metrics = tree.getFontMetrics(tree.getFont());
g.setFont(metrics.getFont().deriveFont(Font.ITALIC, UIUtil.getFontSize(UIUtil.FontSize.MINI)));
int totalWidth = metrics.stringWidth(duration);
int x = bounds.x + bounds.width - totalWidth;
g.setColor(isSelected ? UIUtil.getTreeSelectionBackground(hasFocus) : UIUtil.getTreeBackground());
g.fillRect(x, bounds.y, totalWidth, bounds.height);
int fontHeight = (int)metrics.getMaxCharBounds(g).getHeight();
g.translate(0, bounds.y - 1);
g.setColor(isSelected ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeForeground());
g.drawString(duration, x, fontHeight);
g.translate(0, -bounds.y + 1);
config.restore();