]> source.dussan.org Git - vaadin-framework.git/commitdiff
Interim fix for resizing of child component in AbsoluteLayout when child is 100%...
authorJohn Ahlroos <john@vaadin.com>
Thu, 14 Feb 2013 13:41:45 +0000 (15:41 +0200)
committerVaadin Code Review <review@vaadin.com>
Mon, 18 Feb 2013 12:40:57 +0000 (12:40 +0000)
Change-Id: I497ecc1ac88ef1b3c07d127aff3c157827088e01

client/src/com/vaadin/client/ui/VAbsoluteLayout.java
uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizing.html [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizing.java [new file with mode: 0644]

index 92a51f209d20d6346ad9b5c9e91814c3b592242d..88fbae6e88feca913a302bcaf290623bd12cd47e 100644 (file)
@@ -326,6 +326,10 @@ public class VAbsoluteLayout extends ComplexPanel {
 
                 Style wrapperStyle = wrapper.getElement().getStyle();
                 Style widgetStyle = wrapper.getWidget().getElement().getStyle();
+
+                // Ensure previous heights do not affect the measures
+                wrapperStyle.clearHeight();
+
                 if (widgetStyle.getHeight() != null
                         && widgetStyle.getHeight().endsWith("%")) {
                     int h;
@@ -343,8 +347,6 @@ public class VAbsoluteLayout extends ComplexPanel {
                                 - wrapper.getElement().getOffsetTop();
                     }
                     wrapperStyle.setHeight(h, Unit.PX);
-                } else {
-                    wrapperStyle.clearHeight();
                 }
 
                 wrapper.updateCaptionPosition();
@@ -380,6 +382,9 @@ public class VAbsoluteLayout extends ComplexPanel {
                 Style wrapperStyle = wrapper.getElement().getStyle();
                 Style widgetStyle = wrapper.getWidget().getElement().getStyle();
 
+                // Ensure previous heights do not affect the measures
+                wrapperStyle.clearWidth();
+
                 if (widgetStyle.getWidth() != null
                         && widgetStyle.getWidth().endsWith("%")) {
                     int w;
@@ -398,8 +403,6 @@ public class VAbsoluteLayout extends ComplexPanel {
                                 - wrapper.getElement().getOffsetLeft();
                     }
                     wrapperStyle.setWidth(w, Unit.PX);
-                } else {
-                    wrapperStyle.clearWidth();
                 }
 
                 wrapper.updateCaptionPosition();
diff --git a/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizing.html b/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizing.html
new file mode 100644 (file)
index 0000000..01206b3
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+    <td>open</td>
+    <td>/run/com.vaadin.tests.components.absolutelayout.AbsoluteLayoutResizing?restartApplication</td>
+    <td></td>
+</tr>
+<tr>
+    <td>dragAndDrop</td>
+    <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutResizing::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VSplitPanelVertical[0]/domChild[0]/domChild[1]/domChild[0]</td>
+    <td>0,294</td>
+</tr>
+<tr>
+    <td>dragAndDrop</td>
+    <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutResizing::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VSplitPanelVertical[0]/VSplitPanelHorizontal[0]/domChild[0]/domChild[1]/domChild[0]</td>
+    <td>588,0</td>
+</tr>
+<tr>
+    <td>screenCapture</td>
+    <td></td>
+    <td>resized</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizing.java b/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizing.java
new file mode 100644 (file)
index 0000000..810a583
--- /dev/null
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.absolutelayout;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.HorizontalSplitPanel;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.VerticalSplitPanel;
+
+public class AbsoluteLayoutResizing extends TestBase {
+
+    @Override
+    protected void setup() {
+        getLayout().setSizeFull();
+
+        AbsoluteLayout al = new AbsoluteLayout();
+
+        TextArea ta = new TextArea();
+        ta.setValue("When resizing the layout this text area should also get resized");
+        ta.setSizeFull();
+        al.addComponent(ta, "left: 10px; right: 10px; top: 10px; bottom: 10px;");
+
+        HorizontalSplitPanel horizPanel = new HorizontalSplitPanel();
+        horizPanel.setSizeFull();
+        horizPanel.setFirstComponent(al);
+
+        VerticalSplitPanel vertPanel = new VerticalSplitPanel();
+        vertPanel.setSizeFull();
+        vertPanel.setFirstComponent(horizPanel);
+
+        addComponent(vertPanel);
+
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Absolute layout should correctly dynamically resize itself";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 10427;
+    }
+
+}