From: Artur Signell Date: Wed, 28 Nov 2012 07:15:01 +0000 (+0200) Subject: Always mark child hierarchy dirty when switching tabs (#10404) X-Git-Tag: 7.0.0.beta11~120^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=268b3ca88dec3869562ff4129b99212f139f2233;p=vaadin-framework.git Always mark child hierarchy dirty when switching tabs (#10404) Change-Id: Id6a0b23efb500d2c94bd696cc6eebfe5b5ffd60b --- diff --git a/server/src/com/vaadin/ui/TabSheet.java b/server/src/com/vaadin/ui/TabSheet.java index 5553bf64f8..66e41cffba 100644 --- a/server/src/com/vaadin/ui/TabSheet.java +++ b/server/src/com/vaadin/ui/TabSheet.java @@ -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 index 0000000000..19eff4f8b7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithHasComponent.html @@ -0,0 +1,77 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.tabsheet.TabSheetWithHasComponent?restartApplication
assertTextvaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VPopupView[0]foo
mouseClickvaadin=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]24,5
assertTextvaadin=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]2
mouseClickvaadin=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]66,3
assertTextvaadin=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]A button
mouseClickvaadin=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]9,12
assertTextvaadin=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]5
mouseClickvaadin=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]24,8
mouseClickvaadin=runcomvaadintestscomponentstabsheetTabSheetWithHasComponent::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTabsheet[0]/VTabsheetPanel[0]/VPopupView[0]13,10
mouseClickvaadin=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]54,28
assertTextvaadin=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]Tab 2 inside popup
+ + 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 index 0000000000..2dd4993aca --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetWithHasComponent.java @@ -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; + } + +}