aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tickets/Ticket2289.java
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2012-08-31 10:10:03 +0300
committerJohn Ahlroos <john@vaadin.com>2012-08-31 10:10:03 +0300
commit340cd7899812b444941584d383d930fe8155159b (patch)
tree5989b22f0db52cd578aad087afc9f9fe4d63fb9d /uitest/src/com/vaadin/tests/tickets/Ticket2289.java
parent8b546f207714a663d4e2996f514cdc077cc9dafc (diff)
parent7b25b3886ea95bc6495506fbe9472e45fcbde684 (diff)
downloadvaadin-framework-340cd7899812b444941584d383d930fe8155159b.tar.gz
vaadin-framework-340cd7899812b444941584d383d930fe8155159b.zip
Merge branch 'master' into layoutgraph
Conflicts: client/src/com/vaadin/client/ComponentLocator.java client/src/com/vaadin/client/ui/AbstractComponentConnector.java
Diffstat (limited to 'uitest/src/com/vaadin/tests/tickets/Ticket2289.java')
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket2289.java101
1 files changed, 101 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2289.java b/uitest/src/com/vaadin/tests/tickets/Ticket2289.java
new file mode 100644
index 0000000000..c715fafd74
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket2289.java
@@ -0,0 +1,101 @@
+package com.vaadin.tests.tickets;
+
+import com.vaadin.Application;
+import com.vaadin.ui.Accordion;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
+
+public class Ticket2289 extends Application.LegacyApplication {
+
+ TabSheet ts = null;
+ Accordion acc = null;
+
+ @Override
+ public void init() {
+
+ LegacyWindow w = new LegacyWindow();
+ setMainWindow(w);
+ VerticalLayout ol = new VerticalLayout();
+ w.setContent(ol);
+ Button b = new Button("close current tab");
+ b.addListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ closeCurrentTab();
+
+ }
+ });
+ ol.addComponent(b);
+
+ b = new Button("close first tab");
+ b.addListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ closeFirstTab();
+
+ }
+ });
+
+ ol.addComponent(b);
+ ts = new TabSheet();
+ ts.setSizeUndefined();
+ ts.setWidth("300px");
+ ts.addTab(new MyTab("tab one"), "Caption1", null);
+ ts.addTab(new MyTab("tab two"), "Caption2", null);
+ ts.addTab(new MyTab("tab three"), "Caption3", null);
+ ts.addTab(new MyTab("tab four"), "Caption4", null);
+ ts.addTab(new MyTab("tab five"), "Caption5", null);
+
+ acc = new Accordion();
+ acc.setSizeUndefined();
+ acc.addTab(new MyTab("tab one"), "Caption1", null);
+ acc.addTab(new MyTab("tab two"), "Caption2", null);
+ acc.addTab(new MyTab("tab three"), "Caption3", null);
+ acc.addTab(new MyTab("tab four"), "Caption4", null);
+
+ ol.addComponent(acc);
+ ts = null;
+ // ol.addComponent(ts);
+
+ }
+
+ private void closeCurrentTab() {
+ if (ts != null) {
+ MyTab m = (MyTab) ts.getSelectedTab();
+ if (m != null) {
+ ts.removeComponent(m);
+ }
+ }
+ if (acc != null) {
+ MyTab m = (MyTab) acc.getSelectedTab();
+ if (m != null) {
+ acc.removeComponent(m);
+ }
+ }
+ }
+
+ private void closeFirstTab() {
+ if (ts != null) {
+ ts.removeComponent(ts.getComponentIterator().next());
+ }
+ if (acc != null) {
+ acc.removeComponent(acc.getComponentIterator().next());
+ }
+ }
+
+}
+
+class MyTab extends CustomComponent {
+ public MyTab(String text) {
+ setSizeUndefined();
+ HorizontalLayout ol = new HorizontalLayout();
+ setCompositionRoot(ol);
+ ol.addComponent(new Label(text));
+ }
+} \ No newline at end of file