]> source.dussan.org Git - vaadin-framework.git/commitdiff
ICaption getHeight improvement, Igridlayout cleaning and enhancements
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 12 Nov 2008 12:42:09 +0000 (12:42 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 12 Nov 2008 12:42:09 +0000 (12:42 +0000)
svn changeset:5879/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ICaption.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java

index 55f459ea63a31966b34c5b91b3c4772bf7aeebb3..7871aed7d92874f57eff0b28c9ca53a430547ed7 100644 (file)
@@ -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;
     }
 
index 182c1027153ac1e10b10d6f302c97dae98c26f0b..1878ccbb697cd3d94726b96868f9184995e59297 100644 (file)
@@ -557,7 +557,6 @@ public class IGridLayout extends SimplePanel implements Paintable, Container {
     }
 
     public boolean requestLayout(final Set<Paintable> 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;
             }