tests ui paint optimization: tree.getRowBounds is not cheap and for most of rows (not run tests) would be ignored, so check if we would paint duration first

This commit is contained in:
Anna Kozlova
2015-06-09 20:31:11 +03:00
parent fe31794f66
commit 66b522e18e
@@ -195,18 +195,18 @@ public abstract class TestTreeView extends Tree implements DataProvider, CopyPro
if (isExpandableHandlerVisibleForCurrentRow(row)) {
continue;
}
Rectangle rowBounds = getRowBounds(row);
rowBounds.x = 0;
rowBounds.width = Integer.MAX_VALUE;
Object node = getPathForRow(row).getLastPathComponent();
if (node instanceof DefaultMutableTreeNode) {
Object data = ((DefaultMutableTreeNode)node).getUserObject();
if (data instanceof BaseTestProxyNodeDescriptor) {
final AbstractTestProxy testProxy = ((BaseTestProxyNodeDescriptor)data).getElement();
final String durationString = testProxy.getDurationString(properties);
if (durationString != null) {
Rectangle rowBounds = getRowBounds(row);
rowBounds.x = 0;
rowBounds.width = Integer.MAX_VALUE;
if (rowBounds.intersects(clip)) {
Object node = getPathForRow(row).getLastPathComponent();
if (node instanceof DefaultMutableTreeNode) {
Object data = ((DefaultMutableTreeNode)node).getUserObject();
if (data instanceof BaseTestProxyNodeDescriptor) {
final AbstractTestProxy testProxy = ((BaseTestProxyNodeDescriptor)data).getElement();
final String durationString = testProxy.getDurationString(properties);
if (durationString != null) {
if (rowBounds.intersects(clip)) {
final Rectangle fullRowRect = new Rectangle(visibleRect.x, rowBounds.y, visibleRect.width, rowBounds.height);
final boolean rowSelected = isRowSelected(row);
final boolean hasTreeFocus = hasFocus();