Tomas Jelinek has uploaded a new change for review. Change subject: userportal: Fix exception on browser resizing ......................................................................
userportal: Fix exception on browser resizing The SideTabExtendedResourceView listens to Window.addResizeHandler and tries to change it's widget hights. The problem is, that this recieves the events also when the resources view is not visible so the widgets' heights are 0 leaving the calculated new height negative. This throws an assertion exception: "CSS heights should not be negative". Fixed by guarding that this size will never be less then zero. Change-Id: I43238b399a7e4148ebb3c75b3afdac807ad78202 Signed-off-by: Tomas Jelinek <[email protected]> --- M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedResourceView.java 1 file changed, 11 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/40/14240/1 diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedResourceView.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedResourceView.java index 5583cad..7fffd7e 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedResourceView.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/view/tab/extended/SideTabExtendedResourceView.java @@ -190,13 +190,21 @@ Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent resizeEvent) { - vcpuExpanderContent.setHeight((infoBoxCpu.getOffsetHeight() - INFO_BOX_UPPER_PART_HEIGHT) + "px"); //$NON-NLS-1$ - memoryExpanderContent.setHeight((infoBoxMemory.getOffsetHeight() - INFO_BOX_UPPER_PART_HEIGHT) + "px"); //$NON-NLS-1$ - vmTable.setHeight((bottomLayoutPanel.getOffsetHeight() - STORAGE_BOX_UPPER_PART_HEIGHT) + "px"); //$NON-NLS-1$ + vcpuExpanderContent.setHeight(numOrZero(infoBoxCpu.getOffsetHeight() - INFO_BOX_UPPER_PART_HEIGHT) + "px"); //$NON-NLS-1$ + memoryExpanderContent.setHeight(numOrZero(infoBoxMemory.getOffsetHeight() - INFO_BOX_UPPER_PART_HEIGHT) + "px"); //$NON-NLS-1$ + vmTable.setHeight(numOrZero(bottomLayoutPanel.getOffsetHeight() - STORAGE_BOX_UPPER_PART_HEIGHT) + "px"); //$NON-NLS-1$ } }); } + private int numOrZero(int num) { + if (num < 0) { + return 0; + } else { + return num; + } + } + private void localize() { vcpuExpander.setTitleWhenCollapsed(constants.showQuotaDistribution()); vcpuExpander.setTitleWhenExpended(constants.hideQuotaDistribution()); -- To view, visit http://gerrit.ovirt.org/14240 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I43238b399a7e4148ebb3c75b3afdac807ad78202 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tomas Jelinek <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
