From: Matti Tahvonen Date: Wed, 12 Nov 2008 12:42:09 +0000 (+0000) Subject: ICaption getHeight improvement, Igridlayout cleaning and enhancements X-Git-Tag: 6.7.0.beta1~3815 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=475ec2d55486cc8d67baba66953c4534d079cb43;p=vaadin-framework.git ICaption getHeight improvement, Igridlayout cleaning and enhancements svn changeset:5879/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java b/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java index 55f459ea63..7871aed7d9 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java @@ -312,7 +312,35 @@ public class ICaption extends HTML { } public int getHeight() { - int height = clearElement.getOffsetTop() - getElement().getOffsetTop(); + int height = 0; + int h; + + if (icon != null) { + h = icon.getOffsetHeight(); + if (h > height) { + height = h; + } + } + + if (captionText != null) { + h = captionText.getOffsetHeight(); + if (h > height) { + height = h; + } + } + if (requiredFieldIndicator != null) { + h = requiredFieldIndicator.getOffsetHeight(); + if (h > height) { + height = h; + } + } + if (errorIndicatorElement != null) { + h = errorIndicatorElement.getOffsetHeight(); + if (h > height) { + height = h; + } + } + return height; } diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java index 182c102715..1878ccbb69 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java @@ -557,7 +557,6 @@ public class IGridLayout extends SimplePanel implements Paintable, Container { } public boolean requestLayout(final Set changedChildren) { - ApplicationConnection.getConsole().log("IGridLayout.requestLayout()"); boolean needsLayout = false; boolean reDistributeColSpanWidths = false; boolean reDistributeRowSpanHeights = false; @@ -580,8 +579,7 @@ public class IGridLayout extends SimplePanel implements Paintable, Container { cell.cc.setHeight(""); cell.cc.updateWidgetSize(); - int width = cell.cc.getWidgetSize().getWidth() - + cell.cc.getCaptionWidthAfterComponent(); + int width = cell.getWidth(); int allocated = columnWidths[cell.col]; for (int i = 1; i < cell.colspan; i++) { allocated += spacingPixels + columnWidths[cell.col + i]; @@ -601,8 +599,7 @@ public class IGridLayout extends SimplePanel implements Paintable, Container { dirtyColumns.add(cell.col); } - int height = cell.cc.getWidgetSize().getHeight() - + cell.cc.getCaptionHeightAboveComponent(); + int height = cell.getHeight(); allocated = rowHeights[cell.row]; for (int i = 1; i < cell.rowspan; i++) { @@ -631,8 +628,7 @@ public class IGridLayout extends SimplePanel implements Paintable, Container { Cell cell = cells[colIndex][i]; if (cell != null && cell.getChildUIDL() != null && !cell.hasRelativeWidth()) { - int width = cell.cc.getWidgetSize().getWidth() - + cell.cc.getCaptionWidthAfterComponent(); + int width = cell.getWidth(); if (width > colW) { colW = width; } @@ -661,8 +657,7 @@ public class IGridLayout extends SimplePanel implements Paintable, Container { Cell cell = cells[i][rowIndex]; if (cell != null && cell.getChildUIDL() != null && !cell.hasRelativeHeight()) { - int h = cell.cc.getWidgetSize().getHeight() - + cell.cc.getCaptionHeightAboveComponent(); + int h = cell.getHeight(); if (h > rowH) { rowH = h; } @@ -772,7 +767,8 @@ public class IGridLayout extends SimplePanel implements Paintable, Container { public int getWidth() { if (cc != null) { - int w = cc.getElement().getScrollWidth(); + int w = cc.getWidgetSize().getWidth() + + cc.getCaptionWidthAfterComponent(); return w; } else { return 0; @@ -781,7 +777,8 @@ public class IGridLayout extends SimplePanel implements Paintable, Container { public int getHeight() { if (cc != null) { - return cc.getElement().getScrollHeight(); + return cc.getWidgetSize().getHeight() + + cc.getCaptionHeightAboveComponent(); } else { return 0; }