]> source.dussan.org Git - vaadin-framework.git/commitdiff
IPanel height calculations altered (yet again). Seems to work more consistently acros...
authorJouni Koivuviita <jouni.koivuviita@itmill.com>
Mon, 29 Oct 2007 13:59:15 +0000 (13:59 +0000)
committerJouni Koivuviita <jouni.koivuviita@itmill.com>
Mon, 29 Oct 2007 13:59:15 +0000 (13:59 +0000)
svn changeset:2619/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java
src/com/itmill/toolkit/terminal/gwt/public/default/panel/panel.css

index 3c1a877dfe7dee2f67de47fccec6089ba2c2c721..8f894990fed88f143df925c18818ede4e9413d6d 100644 (file)
@@ -33,8 +33,12 @@ public class IPanel extends SimplePanel implements Paintable,
                DOM.appendChild(getElement(), contentNode);
                DOM.appendChild(getElement(), bottomDecoration);
                setStyleName(CLASSNAME);
-               DOM.setElementProperty(captionNode, "className", CLASSNAME + "-caption");
-               DOM.setElementProperty(contentNode, "className", CLASSNAME + "-content");
+               DOM
+                               .setElementProperty(captionNode, "className", CLASSNAME
+                                               + "-caption");
+               DOM
+                               .setElementProperty(contentNode, "className", CLASSNAME
+                                               + "-content");
                DOM.setElementProperty(bottomDecoration, "className", CLASSNAME
                                + "-deco");
        }
@@ -71,7 +75,8 @@ public class IPanel extends SimplePanel implements Paintable,
                        hasCaption = true;
                } else {
                        DOM.setInnerText(captionNode, "");
-                       DOM.setElementProperty(captionNode, "className", CLASSNAME + "-nocaption");
+                       DOM.setElementProperty(captionNode, "className", CLASSNAME
+                                       + "-nocaption");
                }
 
                // Add proper stylenames for all elements
@@ -109,33 +114,34 @@ public class IPanel extends SimplePanel implements Paintable,
                if (height != null && height != "") {
                        // need to fix containers height properly
                        DOM.setStyleAttribute(getElement(), "height", height);
-                       boolean hasChildren = getWidget() != null;
-                       Element contentEl = null;
-                       String origPositioning = null;
-                       if (hasChildren) {
-                               // remove children temporary form normal flow to detect proper
-                               // size
-                               contentEl = getWidget().getElement();
-                               origPositioning = DOM.getStyleAttribute(contentEl, "position");
-                               DOM.setStyleAttribute(contentEl, "position", "absolute");
-                       }
-                       DOM.setStyleAttribute(contentNode, "height", "");
+                       //boolean hasChildren = getWidget() != null;
+                       //Element contentEl = null;
+                       //String origPositioning = null; if (hasChildren) { // remove
+                       //children temporary form normal flow to detect proper // size
+                       //contentEl = getWidget().getElement(); origPositioning =
+                       //DOM.getStyleAttribute(contentEl, "position");
+                       //DOM.setStyleAttribute(contentEl, "position", "absolute"); }
+                       //DOM.setStyleAttribute(contentNode, "height", ""); int availableH =
+                       //DOM.getElementPropertyInt(getElement(), "clientHeight");
+                       // 
+                       //int usedH = DOM .getElementPropertyInt(bottomDecoration,
+                       //"offsetTop") + DOM.getElementPropertyInt(bottomDecoration,
+                       //"offsetHeight");
+                       
+                       DOM.setStyleAttribute(contentNode, "height", "1px");
+                       DOM.setStyleAttribute(contentNode, "overflow", "hidden");
                        int availableH = DOM.getElementPropertyInt(getElement(),
-                                       "clientHeight");
-
-                       int usedH = DOM
-                                       .getElementPropertyInt(bottomDecoration, "offsetTop")
-                                       + DOM.getElementPropertyInt(bottomDecoration,
-                                                       "offsetHeight");
-                       int contentH = availableH - usedH;
+                                       "offsetHeight");
+                       DOM.setStyleAttribute(getElement(), "height", "");
+                       int usedH = DOM.getElementPropertyInt(getElement(), "offsetHeight");
+                       int contentH = availableH - usedH - 1;
                        if (contentH < 0)
                                contentH = 0;
                        DOM.setStyleAttribute(contentNode, "height", contentH + "px");
-                       if (hasChildren) {
+                       /*if (hasChildren) {
                                DOM.setStyleAttribute(contentEl, "position", origPositioning);
-                       }
+                       }*/
                        DOM.setStyleAttribute(contentNode, "overflow", "auto");
-                       DOM.setStyleAttribute(getElement(), "height", "");
                } else {
                        DOM.setStyleAttribute(contentNode, "height", "");
                }
index 254faf308411b96b0e717f2fca4b407c752993de..75fee0c567aab137705dbb77787a7bb25e0dfdc5 100644 (file)
 }
 
 * html .i-panel-deco {
-       display: none;
+       height: 0;
+       overflow: hidden;
 }
 *+html .i-panel-deco {
-       display: none;
+       height: 0;
+       overflow: hidden;
 }
 
 /* Without caption */