summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2008-05-06 07:31:19 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2008-05-06 07:31:19 +0000
commitd812e2956148dd84ffcfe4dd3cdb0b2032cc8c35 (patch)
tree3db21b205e2d9564adaf6ebd1030d833d4727a2a /src
parent5bb6a78715ea0ba21f1fe1f03567e51f70705fee (diff)
downloadvaadin-framework-d812e2956148dd84ffcfe4dd3cdb0b2032cc8c35.tar.gz
vaadin-framework-d812e2956148dd84ffcfe4dd3cdb0b2032cc8c35.zip
Test case for #831
svn changeset:4336/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/tests/TestForTabSheet.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/tests/TestForTabSheet.java b/src/com/itmill/toolkit/tests/TestForTabSheet.java
new file mode 100644
index 0000000000..09b7ce1c73
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/TestForTabSheet.java
@@ -0,0 +1,58 @@
+package com.itmill.toolkit.tests;
+
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.CustomComponent;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.TabSheet;
+import com.itmill.toolkit.ui.Button.ClickEvent;
+import com.itmill.toolkit.ui.TabSheet.SelectedTabChangeEvent;
+
+public class TestForTabSheet extends CustomComponent implements
+ Button.ClickListener, TabSheet.SelectedTabChangeListener {
+ TabSheet tabsheet = new TabSheet();
+ Button tab1_root = new Button("Push this button");
+ Label tab2_root = new Label("Contents of Second Tab");
+ Label tab3_root = new Label("Contents of Third Tab");
+
+ TestForTabSheet() {
+ setCompositionRoot(tabsheet);
+
+ tabsheet.addListener(this);
+
+ /* Listen for button click events. */
+ tab1_root.addListener(this);
+ tabsheet.addTab(tab1_root, "First Tab", null);
+
+ /* A tab that is initially disabled. */
+ tab2_root.setEnabled(false);
+ tabsheet.addTab(tab2_root, "Second Tab", null);
+
+ /* A tab that is initially disabled. */
+ tab3_root.setEnabled(false);
+ tabsheet.addTab(tab3_root, "Third tab", null);
+ }
+
+ public void buttonClick(ClickEvent event) {
+ System.out.println("tab2=" + tab2_root.isEnabled() + " tab3="
+ + tab3_root.isEnabled());
+ tab2_root.setEnabled(true);
+ tab3_root.setEnabled(true);
+ }
+
+ public void selectedTabChange(SelectedTabChangeEvent event) {
+ /*
+ * Cast to a TabSheet. This isn't really necessary in this example, as
+ * we have only one TabSheet component, but would be useful if there
+ * were multiple TabSheets.
+ */
+ TabSheet source = (TabSheet) event.getSource();
+ if (source == tabsheet) {
+ /* If the first tab was selected. */
+ if (source.getSelectedTab() == tab1_root) {
+ System.out.println("foo");
+ tab2_root.setEnabled(false);
+ tab3_root.setEnabled(false);
+ }
+ }
+ }
+} \ No newline at end of file