--- /dev/null
+package com.vaadin.tests.components.tabsheet;\r
+\r
+import com.vaadin.tests.components.TestBase;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.Button.ClickEvent;\r
+import com.vaadin.ui.Button.ClickListener;\r
+import com.vaadin.ui.Component;\r
+import com.vaadin.ui.HorizontalLayout;\r
+import com.vaadin.ui.Label;\r
+import com.vaadin.ui.TabSheet;\r
+import com.vaadin.ui.TextField;\r
+\r
+public class TabSheetDiscardsMovedComponents extends TestBase implements\r
+ ClickListener {\r
+\r
+ private static final long serialVersionUID = 3153820728819626096L;\r
+\r
+ private Component c1 = new TextField("Component 1", "TextField 1");\r
+ private Component c2 = new Button("Component 2");\r
+\r
+ private TabSheet ts = null;\r
+ private Button moveButton = new Button("Move components to new tabsheet",\r
+ this);\r
+ private Button moveAndSelectButton = new Button(\r
+ "Move components to new tabsheet and remove previous tabsheet",\r
+ this);\r
+\r
+ private HorizontalLayout hl;\r
+\r
+ @Override\r
+ public void setup() {\r
+ hl = new HorizontalLayout();\r
+\r
+ hl.addComponent(moveButton);\r
+ hl.addComponent(moveAndSelectButton);\r
+\r
+ recreateTabSheet();\r
+\r
+ hl.addComponent(ts);\r
+ addComponent(hl);\r
+ }\r
+\r
+ private void recreateTabSheet() {\r
+ ts = new TabSheet();\r
+ ts.addTab(c1);\r
+ ts.addTab(c2);\r
+ }\r
+\r
+ public void buttonClick(ClickEvent event) {\r
+ if (event.getButton() == moveAndSelectButton) {\r
+ hl.removeComponent(ts);\r
+ }\r
+ ts.addTab(new Label("Old tabsheet"), "Old tabsheet", null);\r
+ recreateTabSheet();\r
+ hl.addComponent(ts);\r
+\r
+ }\r
+\r
+ @Override\r
+ protected String getDescription() {\r
+ return "Moving components from one TabSheet to another should not cause problems. Click the second tab and then a button to move the components to another TabSheet and the caption of the Button or the contents of the TextField will disappear";\r
+ }\r
+\r
+ @Override\r
+ protected Integer getTicketNumber() {\r
+ return 2669;\r
+ }\r
+\r
+}\r