]> source.dussan.org Git - vaadin-framework.git/commitdiff
#6902 Table empties field on Layout.replaceComponent
authorArtur Signell <artur.signell@itmill.com>
Fri, 27 Jan 2012 13:10:57 +0000 (13:10 +0000)
committerArtur Signell <artur.signell@itmill.com>
Fri, 27 Jan 2012 13:10:57 +0000 (13:10 +0000)
svn changeset:22788/svn branch:6.7

src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html [new file with mode: 0644]
tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java

index 553934bf9809bdaf8214431d9baf746b64876ffd..f7d23d44534be07fd83686ba71ba7c9440a870a3 100644 (file)
@@ -2592,6 +2592,17 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
                     break;
                 }
                 break;
+            case Event.ONCONTEXTMENU:
+                if (client.hasEventListeners(VScrollTable.this,
+                        HEADER_CLICK_EVENT_ID)) {
+                    // Prevent showing the browser's context menu when there is
+                    // a right click listener.
+                    event.preventDefault();
+                }
+                break;
+            case Event.ONDBLCLICK:
+                fireHeaderClickedEvent(event);
+                break;
             case Event.ONTOUCHMOVE:
             case Event.ONMOUSEMOVE:
                 if (dragging) {
@@ -4736,6 +4747,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
                         Paintable paintable = client.getPaintable(uidl);
                         paintable.updateFromUIDL(uidl, client);
                     }
+                    pendingComponentPaints.clear();
                 }
             }
 
diff --git a/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html b/tests/testbench/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html
new file mode 100644 (file)
index 0000000..4573cf4
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\r
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">\r
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
+<link rel="selenium.base" href="http://localhost:8888/" />\r
+<title>TextFieldValueGoesMissing</title>\r
+</head>\r
+<body>\r
+<table cellpadding="1" cellspacing="1" border="1">\r
+<thead>\r
+<tr><td rowspan="1" colspan="3">TextFieldValueGoesMissing</td></tr>\r
+</thead><tbody>\r
+<tr>\r
+       <td>open</td>\r
+       <td>/run/com.vaadin.tests.components.table.TextFieldValueGoesMissing?restartApplication</td>\r
+       <td></td>\r
+</tr>\r
+<tr>\r
+       <td>mouseClick</td>\r
+       <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>\r
+       <td>73,10</td>\r
+</tr>\r
+<tr>\r
+       <td>enterCharacter</td>\r
+       <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>\r
+       <td>test</td>\r
+</tr>\r
+<tr>\r
+       <td>click</td>\r
+       <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>\r
+       <td></td>\r
+</tr>\r
+<tr>\r
+       <td>contextmenu</td>\r
+       <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>\r
+       <td></td>\r
+</tr>\r
+<tr>\r
+       <td>assertValue</td>\r
+       <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>\r
+       <td>test</td>\r
+</tr>\r
+\r
+</tbody></table>\r
+</body>\r
+</html>\r
index 254f1b0a90bd750ce7549cbdaf03b43745cafc06..f3ff5e983e349177b11bc38a752263e6e8eca80b 100644 (file)
@@ -17,11 +17,15 @@ public class TextFieldValueGoesMissing extends TestBase {
         final Label label1 = new Label("1");
         final Label label2 = new Label("2");
 
-        Button button = new Button("Refresh");
+        Button button = new Button("Replace label");
         button.addListener(new Button.ClickListener() {
 
             public void buttonClick(ClickEvent event) {
-                verticalLayout.replaceComponent(label1, label2);
+                if (verticalLayout.getComponentIndex(label1) > -1) {
+                    verticalLayout.replaceComponent(label1, label2);
+                } else {
+                    verticalLayout.replaceComponent(label2, label1);
+                }
             }
         });
         verticalLayout.addComponent(button);
@@ -41,7 +45,7 @@ public class TextFieldValueGoesMissing extends TestBase {
 
     @Override
     protected String getDescription() {
-        return "Enter a text in the TextField in the table and press the 'replace label' button. This replaces the label which is in the same layout as the table but should not cause the TextField in the table to lose its contents";
+        return "Enter a text in the TextField in the table and press the 'Replace label' button. This replaces the label which is in the same layout as the table but should not cause the TextField in the table to lose its contents";
     }
 
     @Override