diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-04-02 12:52:59 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-04-02 12:52:59 +0000 |
commit | 651ab66ebf222a1220db7f05f39f04ab19bf7314 (patch) | |
tree | 9acba14177fd822b25d5e497dca6d8ad6888f0f7 /src/com/itmill | |
parent | 8f78e7c8994a630ff7a09819074f3c11f1c1d976 (diff) | |
download | vaadin-framework-651ab66ebf222a1220db7f05f39f04ab19bf7314.tar.gz vaadin-framework-651ab66ebf222a1220db7f05f39f04ab19bf7314.zip |
Merged "Test case and fix for #2816: Form rendering causes artifacts in certain cases
http://dev.itmill.com/ticket/2816"
svn changeset:7289/svn branch:6.0
Diffstat (limited to 'src/com/itmill')
-rw-r--r-- | src/com/itmill/toolkit/terminal/gwt/client/ui/IForm.java | 9 | ||||
-rw-r--r-- | src/com/itmill/toolkit/tests/components/form/FormRenderingFlicker.java | 65 |
2 files changed, 73 insertions, 1 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IForm.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IForm.java index 1550d85446..0b91268d25 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IForm.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IForm.java @@ -52,6 +52,8 @@ public class IForm extends ComplexPanel implements Container { private int borderPaddingVertical;
+ private boolean rendering = false;
+
public IForm() {
setElement(DOM.createDiv());
DOM.appendChild(getElement(), fieldSet);
@@ -72,6 +74,8 @@ public class IForm extends ComplexPanel implements Container { }
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+ rendering = true;
+
if (this.client == null) {
this.client = client;
borderPaddingVertical = getOffsetHeight();
@@ -79,6 +83,7 @@ public class IForm extends ComplexPanel implements Container { }
if (client.updateComponent(this, uidl, false)) {
+ rendering = false;
return;
}
@@ -159,6 +164,8 @@ public class IForm extends ComplexPanel implements Container { client.unregisterPaintable(footer);
}
}
+
+ rendering = false;
}
public void updateSize() {
@@ -266,7 +273,7 @@ public class IForm extends ComplexPanel implements Container { updateSize();
- if (height.equals("")) {
+ if (!rendering && height.equals("")) {
// Width might affect height
Util.updateRelativeChildrenAndSendSizeUpdateEvent(client, this);
}
diff --git a/src/com/itmill/toolkit/tests/components/form/FormRenderingFlicker.java b/src/com/itmill/toolkit/tests/components/form/FormRenderingFlicker.java new file mode 100644 index 0000000000..f670aa7d23 --- /dev/null +++ b/src/com/itmill/toolkit/tests/components/form/FormRenderingFlicker.java @@ -0,0 +1,65 @@ +package com.itmill.toolkit.tests.components.form;
+
+import com.itmill.toolkit.data.Item;
+import com.itmill.toolkit.event.ItemClickEvent;
+import com.itmill.toolkit.event.ItemClickEvent.ItemClickListener;
+import com.itmill.toolkit.tests.components.TestBase;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Table;
+import com.itmill.toolkit.ui.VerticalLayout;
+
+public class FormRenderingFlicker extends TestBase {
+
+ private VerticalLayout tableLayout;
+ private Table table;
+ private Panel tablePanel;
+ private Form form;
+
+ @Override
+ protected String getDescription() {
+ return "Clicking on an item in the table will replace the panel (surrounding the table) with a form. This should not cause the table rows to move downwards or cause any other visible flicker";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2816;
+ }
+
+ @Override
+ protected void setup() {
+ createTableLayout();
+ form = new Form();
+
+ tablePanel = new Panel();
+ tablePanel.setLayout(tableLayout);
+
+ addComponent(tablePanel);
+ }
+
+ private void createTableLayout() {
+ tableLayout = new VerticalLayout();
+ table = new Table();
+ table.addContainerProperty("name", String.class, "");
+ table.addContainerProperty("age", String.class, "");
+ for (int i = 0; i < 100; i++) {
+ table.addItem(new Object[] { "Name " + i, String.valueOf(i) },
+ new Object());
+ }
+ table.setImmediate(true);
+ table.addListener(new ItemClickListener() {
+
+ public void itemClick(ItemClickEvent event) {
+ clicked(event.getItem());
+ }
+
+ });
+
+ tableLayout.addComponent(table);
+ }
+
+ protected void clicked(Item item) {
+ getLayout().replaceComponent(tablePanel, form);
+ }
+
+}
|