// TODO Margin handling
for (ComponentConnector child : getChildComponents()) {
- getWidget().setWidgetPosition(
- child.getWidget(),
- getState().connectorToCssPosition.get(child
- .getConnectorId()));
+ setChildWidgetPosition(child);
}
+ }
+
+ private void setChildWidgetPosition(ComponentConnector child) {
+ getWidget().setWidgetPosition(
+ child.getWidget(),
+ getState().connectorToCssPosition.get(child
+ .getConnectorId()));
};
/*
if (!getWidget().contains(child.getWidget())) {
getWidget().add(child.getWidget());
child.addStateChangeHandler(childStateChangeHandler);
+ setChildWidgetPosition(child);
}
}
for (ComponentConnector oldChild : event.getOldChildren()) {
--- /dev/null
+<?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>AbsoluteLayoutCorrectPositioningOfHiddenField</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">AbsoluteLayoutCorrectPositioningOfHiddenField</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.absolutelayout.AbsoluteLayoutCorrectPositioningOfHiddenField?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutCorrectPositioningOfHiddenField::PID_SpositionedLabel</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutCorrectPositioningOfHiddenField::PID_SactionButton</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutCorrectPositioningOfHiddenField::PID_SpositionedLabel</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>AbsoluteLayoutLabelPositionNotOrigo</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutCorrectPositioningOfHiddenField::PID_SactionButton</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>AbsoluteLayoutLabelMovedDown</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
--- /dev/null
+package com.vaadin.tests.components.absolutelayout;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.AbsoluteLayout.ComponentPosition;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Label;
+
+public class AbsoluteLayoutCorrectPositioningOfHiddenField extends TestBase {
+
+ @Override
+ protected void setup() {
+ setTheme("tests-tickets");
+ final AbsoluteLayout abs = new AbsoluteLayout();
+ abs.setStyleName("borders");
+ abs.setWidth("250px");
+ abs.setHeight("100px");
+
+ final Label l = new Label("Top 20, Left 20");
+ l.setSizeUndefined();
+ l.setId("positionedLabel");
+ l.setVisible(false);
+ abs.addComponent(l, "top:20px;left:20px");
+
+ final Button action = new Button("Set visible");
+ action.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (l.isVisible()) {
+ l.setValue("Top 70, Left 20");
+ ComponentPosition position = abs.getPosition(l);
+ position.setCSSString("top:70px;left:20px;");
+ abs.setPosition(l, position);
+ } else {
+ l.setVisible(true);
+ action.setCaption("Move down");
+ }
+ }
+ });
+ action.setId("actionButton");
+ abs.addComponent(action, "top: 70px;left: 150px;");
+
+ addComponent(abs);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "AbsoluteLayout should reposition invisible components when set to visible";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 10180;
+ }
+
+}