From 15a3a76b4bb9aa3ec4158a23c43bff44bb1b922f Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Mon, 28 May 2012 13:19:23 +0400 Subject: [PATCH] Table & Grid: fix for repaint before apply new component --- .../model/layout/grid/RadGridLayout.java | 13 +++++--- .../model/layout/table/RadTableRowLayout.java | 33 +++++++++++-------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/layout/grid/RadGridLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/layout/grid/RadGridLayout.java index 0afcc41a4dd5..ea024ab3a309 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/layout/grid/RadGridLayout.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/layout/grid/RadGridLayout.java @@ -109,11 +109,16 @@ public class RadGridLayout extends RadViewLayoutWithData implements ILayoutDecor mySelectionDecorator = new GridSelectionDecorator(Color.red, 1) { @Override public Rectangle getCellBounds(Component layer, RadComponent component) { - RadGridLayoutComponent parent = (RadGridLayoutComponent)component.getParent(); - GridInfo gridInfo = parent.getGridInfo(); - Rectangle cellInfo = RadGridLayoutComponent.getCellInfo(component); + try { + RadGridLayoutComponent parent = (RadGridLayoutComponent)component.getParent(); + GridInfo gridInfo = parent.getGridInfo(); + Rectangle cellInfo = RadGridLayoutComponent.getCellInfo(component); - return calculateBounds(layer, gridInfo, parent, component, cellInfo.y, cellInfo.x, cellInfo.height, cellInfo.width); + return calculateBounds(layer, gridInfo, parent, component, cellInfo.y, cellInfo.x, cellInfo.height, cellInfo.width); + } + catch (Throwable e) { + return new Rectangle(); + } } }; } diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/layout/table/RadTableRowLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/layout/table/RadTableRowLayout.java index 3b85798f1587..cc8de9d46eb9 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/layout/table/RadTableRowLayout.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/layout/table/RadTableRowLayout.java @@ -83,23 +83,28 @@ public class RadTableRowLayout extends RadLinearLayout { mySelectionDecorator = new GridSelectionDecorator(Color.red, 1) { @Override public Rectangle getCellBounds(Component layer, RadComponent component) { - RadTableLayoutComponent tableComponent = (RadTableLayoutComponent)component.getParent().getParent(); - GridInfo gridInfo = tableComponent.getVirtualGridInfo(); - int row = tableComponent.getChildren().indexOf(component.getParent()); - RadComponent[] rowComponents = gridInfo.components[row]; - int column = ArrayUtil.indexOf(rowComponents, component); - int columnSpan = 1; + try { + RadTableLayoutComponent tableComponent = (RadTableLayoutComponent)component.getParent().getParent(); + GridInfo gridInfo = tableComponent.getVirtualGridInfo(); + int row = tableComponent.getChildren().indexOf(component.getParent()); + RadComponent[] rowComponents = gridInfo.components[row]; + int column = ArrayUtil.indexOf(rowComponents, component); + int columnSpan = 1; - for (int i = column + 1; i < rowComponents.length; i++) { - if (rowComponents[i] == component) { - columnSpan++; - } - else { - break; + for (int i = column + 1; i < rowComponents.length; i++) { + if (rowComponents[i] == component) { + columnSpan++; + } + else { + break; + } } + + return calculateBounds(layer, gridInfo, tableComponent, component, row, column, 1, columnSpan); + } + catch (Throwable e) { + return new Rectangle(); } - - return calculateBounds(layer, gridInfo, tableComponent, component, row, column, 1, columnSpan); } }; }