]> source.dussan.org Git - vaadin-framework.git/commitdiff
Always mark child hierarchy dirty when switching tabs (#10404) 07/407/2
authorArtur Signell <artur@vaadin.com>
Wed, 28 Nov 2012 07:15:01 +0000 (09:15 +0200)
committerArtur Signell <artur@vaadin.com>
Wed, 28 Nov 2012 07:23:51 +0000 (09:23 +0200)
Change-Id: Id6a0b23efb500d2c94bd696cc6eebfe5b5ffd60b

server/src/com/vaadin/ui/TabSheet.java
uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithHasComponent.html [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithHasComponent.java [new file with mode: 0644]

index 5553bf64f8e1fedd65082bedf217b2057ef8db84..66e41cffbaaf2bf0e2bf9bc9ad304cee8794dd71 100644 (file)
@@ -547,16 +547,9 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
         // component is communicated to the client. Otherwise this will be a
         // "cached" update even though the client knows nothing about the
         // connector
-        if (selected instanceof ComponentContainer) {
-            ((ComponentContainer) selected).markAsDirtyRecursive();
-        } else if (selected instanceof Table) {
-            // Workaround until there's a generic way of telling a component
-            // that there is no client side state to rely on. See #8642
-            ((Table) selected).refreshRowCache();
-        } else if (selected != null) {
-            selected.markAsDirty();
+        if (selected != null) {
+            selected.markAsDirtyRecursive();
         }
-
     }
 
     /**
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithHasComponent.html b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithHasComponent.html
new file mode 100644 (file)
index 0000000..19eff4f
--- /dev/null
@@ -0,0 +1,77 @@
+<?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://arturwin.office.itmill.com: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.tabsheet.TabSheetWithHasComponent?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VPopupView[0]</td>
+       <td>foo</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td>
+       <td>24,5</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td>
+       <td>2</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td>
+       <td>66,3</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VPanel[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td>A button</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td>
+       <td>9,12</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[1]/domChild[0]</td>
+       <td>5</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+       <td>24,8</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VPopupView[0]</td>
+       <td>13,10</td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VPopupView[0]/VPopupView$CustomPopup[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
+       <td>54,28</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VPopupView[0]/VPopupView$CustomPopup[0]/VTabsheet[0]/VTabsheetPanel[0]/VNativeButton[0]</td>
+       <td>Tab 2 inside popup</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithHasComponent.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithHasComponent.java
new file mode 100644 (file)
index 0000000..2dd4993
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2012 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.tabsheet;
+
+import com.vaadin.data.Item;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.PopupView;
+import com.vaadin.ui.PopupView.Content;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.ColumnGenerator;
+import com.vaadin.ui.VerticalLayout;
+
+public class TabSheetWithHasComponent extends AbstractTestUI {
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        TabSheet ts = new TabSheet();
+        ts.addComponent(createPopupView(createSmallTabSheet()));
+        ts.addComponent(createTable());
+        ts.addComponent(createPanel());
+        ts.addComponent(new CustomComponent(new Panel(
+                "Panel in custom component", new Button("In panel"))));
+
+        addComponent(ts);
+    }
+
+    private PopupView createPopupView(final Component content) {
+        PopupView pv = new PopupView(new Content() {
+
+            @Override
+            public String getMinimizedValueAsHTML() {
+                return "foo";
+            }
+
+            @Override
+            public Component getPopupComponent() {
+                return content;
+            }
+
+        });
+        pv.setCaption("A popup view");
+        return pv;
+    }
+
+    protected TabSheet createSmallTabSheet() {
+        return new TabSheet(new Button("Tab1 inside popup"), new NativeButton(
+                "Tab 2 inside popup"));
+    }
+
+    private Panel createPanel() {
+        return new Panel("Panel containing stuff", new VerticalLayout(
+                new Label("A Label"), new Button("A button")));
+    }
+
+    private Table createTable() {
+        Table t = new Table("A table");
+        t.addContainerProperty("Column 1", String.class, "");
+        t.addContainerProperty("Column 2", Integer.class, null);
+        t.addGeneratedColumn("Generated", new ColumnGenerator() {
+
+            @Override
+            public Object generateCell(Table source, Object itemId,
+                    Object columnId) {
+                if ("Item 2".equals(itemId)) {
+                    return createPopupView(createSmallTabSheet());
+                } else {
+                    return createPopupView(createPanel());
+                }
+            }
+        });
+        t.setPageLength(5);
+        for (int i = 1; i <= 5; i++) {
+            Item item = t.addItem("Item " + i);
+            item.getItemProperty("Column 1").setValue("Item " + i + " col 1");
+            item.getItemProperty("Column 2").setValue(i);
+        }
+        return t;
+    }
+
+    @Override
+    protected String getTestDescription() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}