IDEMPIERE-1917 Division by zero rendering performance indicator

This commit is contained in:
Carlos Ruiz 2014-04-28 16:07:48 -05:00
parent af43f27785
commit 898e61f153
1 changed files with 6 additions and 0 deletions

View File

@ -160,15 +160,21 @@ public class WPerformanceIndicator extends Panel implements EventListener<Event>
private void onAfterSize(AfterSizeEvent event) {
int width = event.getWidth();
if (width == 0)
return; // no space to render
int height = event.getHeight();
//set normal height
if (height == 0) {
height = width > 300 ? width * 40 / 100 : width * 85 / 100;
if (height == 0)
return; // no space to render
this.setHeight(height+"px");
} else {
int ratio = (height * 100) / width;
if (ratio > 85 || ratio < 50) {
height = width > 300 ? width * 40 / 100 : width * 85 / 100;
if (height == 0)
return; // no space to render
this.setHeight(height+"px");
}
}