summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/tests/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/vaadin/tests/components')
-rw-r--r--src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java83
-rw-r--r--src/com/vaadin/tests/components/MultipleDebugIds.java35
-rw-r--r--src/com/vaadin/tests/components/TestBase.java52
-rw-r--r--src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutClipping.java42
-rw-r--r--src/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java69
-rw-r--r--src/com/vaadin/tests/components/accordion/RemoveTabs.java130
-rw-r--r--src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java98
-rw-r--r--src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java47
-rw-r--r--src/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java75
-rw-r--r--src/com/vaadin/tests/components/checkbox/CheckboxIcon.java29
-rw-r--r--src/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java42
-rw-r--r--src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java37
-rw-r--r--src/com/vaadin/tests/components/combobox/ComboBoxLargeIcons.java44
-rw-r--r--src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java30
-rw-r--r--src/com/vaadin/tests/components/combobox/ComboBoxValueUpdate.java45
-rwxr-xr-xsrc/com/vaadin/tests/components/combobox/fi.gifbin0 -> 371 bytes
-rwxr-xr-xsrc/com/vaadin/tests/components/combobox/se.gifbin0 -> 367 bytes
-rw-r--r--src/com/vaadin/tests/components/datefield/TestDatefieldYear.java28
-rw-r--r--src/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java149
-rw-r--r--src/com/vaadin/tests/components/embedded/EmbeddedTooltip.java28
-rw-r--r--src/com/vaadin/tests/components/form/FormCommitWithInvalidValues.java71
-rw-r--r--src/com/vaadin/tests/components/form/FormRenderingFlicker.java65
-rw-r--r--src/com/vaadin/tests/components/label/HundredPercentWideLabelResize.java42
-rw-r--r--src/com/vaadin/tests/components/label/LabelWrapping.java46
-rw-r--r--src/com/vaadin/tests/components/link/LinkIcon.java30
-rw-r--r--src/com/vaadin/tests/components/link/LinkTargetSize.java30
-rw-r--r--src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java42
-rw-r--r--src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java64
-rw-r--r--src/com/vaadin/tests/components/table/ColumnExpandRatio.java70
-rw-r--r--src/com/vaadin/tests/components/table/ColumnGeneratorAddingOrder.java52
-rw-r--r--src/com/vaadin/tests/components/table/ColumnWidths.java69
-rw-r--r--src/com/vaadin/tests/components/table/ContainerSizeChange.java91
-rw-r--r--src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java68
-rw-r--r--src/com/vaadin/tests/components/table/PropertyValueChange.java158
-rw-r--r--src/com/vaadin/tests/components/table/RowAdditionTest.java59
-rw-r--r--src/com/vaadin/tests/components/table/TableItemIcon.java38
-rw-r--r--src/com/vaadin/tests/components/table/TableRowHeight.java112
-rw-r--r--src/com/vaadin/tests/components/table/TableRowHeight2.java64
-rw-r--r--src/com/vaadin/tests/components/table/TableRowHeight3.java61
-rw-r--r--src/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java60
-rwxr-xr-xsrc/com/vaadin/tests/components/table/fi.gifbin0 -> 371 bytes
-rwxr-xr-xsrc/com/vaadin/tests/components/table/se.gifbin0 -> 367 bytes
-rw-r--r--src/com/vaadin/tests/components/tabsheet/AddAndRemoveTabs.java60
-rw-r--r--src/com/vaadin/tests/components/tabsheet/RemoveTabs.java129
-rw-r--r--src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java55
-rw-r--r--src/com/vaadin/tests/components/tabsheet/TabSheetDisabling.java62
-rw-r--r--src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java54
-rw-r--r--src/com/vaadin/tests/components/tabsheet/VerticalScrollbarPosition.java40
-rw-r--r--src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java33
-rw-r--r--src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java46
-rw-r--r--src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java44
-rw-r--r--src/com/vaadin/tests/components/window/WindowResizeListener.java99
52 files changed, 2977 insertions, 0 deletions
diff --git a/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java b/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java
new file mode 100644
index 0000000000..6b3daae539
--- /dev/null
+++ b/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java
@@ -0,0 +1,83 @@
+package com.vaadin.tests.components;
+
+import com.vaadin.ui.Button;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+
+public class CustomComponentwithUndefinedSize extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "A custom component with no size definition should not prevent scrollbars from being shown when its contents is larger than its parent";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2459;
+ }
+
+ @Override
+ protected void setup() {
+
+ TabSheet tabs = new TabSheet();
+ tabs.setSizeFull();
+ MyCustomComponent mcc = new MyCustomComponent();
+ mcc.setSizeUndefined();
+
+ // Doesn't work
+ tabs.addTab(mcc, "Doesn't work (CustomComponent)", null);
+
+ // Works:
+ tabs.addTab(mcc.buildLayout(),
+ "Works (no CustomComponent, same layout)", null);
+
+ addComponent(tabs);
+ getLayout().setSizeFull();
+ }
+
+ private int step = 0;
+
+ public class MyCustomComponent extends CustomComponent {
+ public MyCustomComponent() {
+ setCompositionRoot(buildLayout());
+ }
+
+ public Layout buildLayout() {
+ VerticalLayout layout = new VerticalLayout();
+ final Panel widePanel = new Panel("too big");
+ widePanel.setSizeUndefined();
+ widePanel.setWidth("2000px");
+ widePanel.setHeight("200px");
+ layout.addComponent(widePanel);
+ Button button = new Button("Change panel size",
+ new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ switch (step++ % 4) {
+ case 0:
+ widePanel.setWidth("200px");
+ break;
+ case 1:
+ widePanel.setHeight("2000px");
+ break;
+ case 2:
+ widePanel.setWidth("2000px");
+ break;
+ case 3:
+ widePanel.setHeight("200px");
+ break;
+ }
+
+ }
+ });
+ widePanel.addComponent(button);
+ layout.setSizeUndefined();
+ return layout;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/com/vaadin/tests/components/MultipleDebugIds.java b/src/com/vaadin/tests/components/MultipleDebugIds.java
new file mode 100644
index 0000000000..ebfa29b9e9
--- /dev/null
+++ b/src/com/vaadin/tests/components/MultipleDebugIds.java
@@ -0,0 +1,35 @@
+package com.vaadin.tests.components;
+
+import com.vaadin.ui.Button;
+import com.vaadin.ui.TextField;
+
+public class MultipleDebugIds extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "An exception should be thrown if the same debugId is assigned to several components";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2796;
+ }
+
+ @Override
+ protected void setup() {
+ TextField textField = new TextField();
+ TextField textField2 = new TextField();
+ Button button = new Button();
+ Button button2 = new Button();
+ textField.setDebugId("textfield");
+ button.setDebugId("button");
+ textField2.setDebugId("textfield2");
+ button2.setDebugId("textfield");
+
+ addComponent(textField);
+ addComponent(textField2);
+ addComponent(button);
+ addComponent(button2);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/TestBase.java b/src/com/vaadin/tests/components/TestBase.java
new file mode 100644
index 0000000000..45cc69516d
--- /dev/null
+++ b/src/com/vaadin/tests/components/TestBase.java
@@ -0,0 +1,52 @@
+package com.vaadin.tests.components;
+
+import com.vaadin.Application;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.SplitPanel;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+
+public abstract class TestBase extends Application {
+
+ @Override
+ public final void init() {
+ window = new Window(getClass().getName());
+ setMainWindow(window);
+ window.getLayout().setSizeFull();
+
+ Label label = new Label(getDescription(), Label.CONTENT_XHTML);
+ label.setWidth("100%");
+ window.getLayout().addComponent(label);
+
+ layout = new VerticalLayout();
+ window.getLayout().addComponent(layout);
+ ((VerticalLayout) window.getLayout()).setExpandRatio(layout, 1);
+
+ setup();
+ }
+
+ private Window window;
+ private SplitPanel splitPanel;
+ private Layout layout;
+
+ public TestBase() {
+
+ }
+
+ protected Layout getLayout() {
+ return layout;
+ }
+
+ protected abstract String getDescription();
+
+ protected abstract Integer getTicketNumber();
+
+ protected abstract void setup();
+
+ protected void addComponent(Component c) {
+ getLayout().addComponent(c);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutClipping.java b/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutClipping.java
new file mode 100644
index 0000000000..f6bff579a3
--- /dev/null
+++ b/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutClipping.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.components.absolutelayout;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.Label;
+
+public class AbsoluteLayoutClipping extends TestBase {
+
+ @Override
+ protected void setup() {
+ setTheme("tests-tickets");
+ AbsoluteLayout abs = new AbsoluteLayout();
+ abs.setStyleName("borders");
+ abs.setWidth("100px");
+ abs.setHeight("100px");
+
+ Label l = new Label("This should be clipped at 100px");
+ l.setSizeUndefined();
+ abs.addComponent(l, "top:50px;left:50px");
+
+ Label l2 = new Label("This should not be visible");
+ l2.setSizeUndefined();
+ abs.addComponent(l2, "top:80px;left:150px");
+
+ Label l3 = new Label("This should be clipped vertically at 100px");
+ l3.setWidth("50px");
+ abs.addComponent(l3, "top:20px;left:0px");
+
+ addComponent(abs);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "An AbsoluteLayout with fixed size should clip at its borders. Nothing outside the black square should be visible.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2913;
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java b/src/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java
new file mode 100644
index 0000000000..69705d4143
--- /dev/null
+++ b/src/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java
@@ -0,0 +1,69 @@
+package com.vaadin.tests.components.abstractfield;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.validator.StringLengthValidator;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Window.Notification;
+
+public class AbstractFieldCommitWithInvalidValues extends TestBase {
+
+ private TextField tf;
+
+ @Override
+ protected String getDescription() {
+ return "Commiting a field with invalid values should throw an exception";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2532;
+ }
+
+ @Override
+ protected void setup() {
+ tf = new TextField("A field, must contain 1-2 chars",
+ new ObjectProperty("a"));
+ tf
+ .addValidator(new StringLengthValidator("Invalid length", 1, 2,
+ false));
+ tf.setWriteThrough(false);
+ tf.setRequired(true);
+
+ Button b = new Button("Commit", new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ try {
+ tf.commit();
+ if (tf.isValid()) {
+ getMainWindow().showNotification(
+ "OK! Form validated and no error was thrown",
+ Notification.TYPE_HUMANIZED_MESSAGE);
+ } else {
+ getMainWindow().showNotification(
+ "Form is invalid but no exception was thrown",
+ Notification.TYPE_ERROR_MESSAGE);
+ }
+ } catch (Exception e) {
+ if (tf.isValid()) {
+ getMainWindow().showNotification(
+ "Form is valid but an exception was thrown",
+ Notification.TYPE_ERROR_MESSAGE);
+ } else {
+ getMainWindow().showNotification(
+ "OK! Error was thrown for an invalid input",
+ Notification.TYPE_HUMANIZED_MESSAGE);
+
+ }
+ }
+ }
+
+ });
+
+ addComponent(tf);
+ addComponent(b);
+ }
+}
diff --git a/src/com/vaadin/tests/components/accordion/RemoveTabs.java b/src/com/vaadin/tests/components/accordion/RemoveTabs.java
new file mode 100644
index 0000000000..a345ad61a2
--- /dev/null
+++ b/src/com/vaadin/tests/components/accordion/RemoveTabs.java
@@ -0,0 +1,130 @@
+package com.vaadin.tests.components.accordion;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractComponentContainer;
+import com.vaadin.ui.Accordion;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class RemoveTabs extends TestBase {
+
+ private Accordion accordion;
+
+ protected Component[] tab = new Component[5];
+
+ private Button closeCurrent;
+ private Button closeFirst;
+ private Button closeLast;
+ private Button reorderTabs;
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2425;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Tests the removal of individual tabs from an Accordion. No matter what is done in this test the tab caption \"Tab X\" should always match the content \"Tab X\". Use \"remove first\" and \"remove active\" buttons to remove the first or the active tab. The \"reorder\" button reverses the order by adding and removing all components.";
+ }
+
+ @Override
+ protected void setup() {
+ accordion = new Accordion();
+ for (int i = 1; i <= tab.length; i++) {
+ tab[i - 1] = new Label("This is the contents of tab " + i);
+ tab[i - 1].setCaption("Tab " + i);
+
+ accordion.addComponent(tab[i - 1]);
+ }
+
+ getLayout().addComponent(accordion);
+
+ closeCurrent = new Button("Close current tab");
+ closeCurrent.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ closeCurrentTab();
+
+ }
+ });
+
+ closeFirst = new Button("close first tab");
+ closeFirst.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ closeFirstTab();
+
+ }
+ });
+
+ closeLast = new Button("close last tab");
+ closeLast.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ closeLastTab();
+
+ }
+ });
+
+ reorderTabs = new Button("reorder");
+ reorderTabs.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ reorder();
+
+ }
+ });
+
+ getLayout().addComponent(closeFirst);
+ getLayout().addComponent(closeLast);
+ getLayout().addComponent(closeCurrent);
+ getLayout().addComponent(reorderTabs);
+
+ }
+
+ private void closeCurrentTab() {
+ Component c = accordion.getSelectedTab();
+ if (c != null) {
+ accordion.removeComponent(c);
+ }
+ }
+
+ private void closeFirstTab() {
+ accordion.removeComponent((Component) accordion.getComponentIterator()
+ .next());
+ }
+
+ @SuppressWarnings("unchecked")
+ private void closeLastTab() {
+ Iterator i = accordion.getComponentIterator();
+ Component last = null;
+ while (i.hasNext()) {
+ last = (Component) i.next();
+
+ }
+ accordion.removeComponent(last);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void reorder() {
+ AbstractComponentContainer container = accordion;
+
+ if (container != null) {
+ List<Component> c = new ArrayList<Component>();
+ Iterator<Component> i = container.getComponentIterator();
+ while (i.hasNext()) {
+ Component comp = i.next();
+ c.add(comp);
+ }
+ container.removeAllComponents();
+
+ for (int j = c.size() - 1; j >= 0; j--) {
+ container.addComponent(c.get(j));
+ }
+
+ }
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java b/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java
new file mode 100644
index 0000000000..5a42599005
--- /dev/null
+++ b/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java
@@ -0,0 +1,98 @@
+package com.vaadin.tests.components.beanitemcontainer;
+
+import java.util.Date;
+import java.util.Random;
+
+import com.vaadin.data.util.BeanItemContainer;
+
+public class BeanItemContainerGenerator {
+
+ public static BeanItemContainer<TestBean> createContainer(int size) {
+
+ BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>(
+ TestBean.class);
+ Random r = new Random(new Date().getTime());
+ for (int i = 0; i < size; i++) {
+ container.addBean(new TestBean(r));
+ }
+
+ return container;
+
+ }
+
+ public static class TestBean {
+ private String name, address, city, country;
+ private int age, shoesize;
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public int getShoesize() {
+ return shoesize;
+ }
+
+ public void setShoesize(int shoesize) {
+ this.shoesize = shoesize;
+ }
+
+ public TestBean(Random r) {
+ age = r.nextInt(100) + 5;
+ shoesize = r.nextInt(10) + 35;
+ name = createRandomString(r, r.nextInt(5) + 5);
+ address = createRandomString(r, r.nextInt(15) + 5) + " "
+ + r.nextInt(100) + 1;
+ city = createRandomString(r, r.nextInt(7) + 3);
+ if (r.nextBoolean()) {
+ country = createRandomString(r, r.nextInt(4) + 4);
+ }
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ }
+
+ public static String createRandomString(Random r, int len) {
+ StringBuilder b = new StringBuilder();
+ for (int i = 0; i < len; i++) {
+ b.append((char) (r.nextInt('z' - 'a') + 'a'));
+ }
+
+ return b.toString();
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java b/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java
new file mode 100644
index 0000000000..15f292a6ca
--- /dev/null
+++ b/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java
@@ -0,0 +1,47 @@
+package com.vaadin.tests.components.beanitemcontainer;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class BeanItemContainerNullValues extends TestBase {
+
+ private Table table;
+
+ @Override
+ protected String getDescription() {
+ return "Null values should be sorted first (ascending sort) in a BeanItemContainer. Sort the 'country' column to see that the empty values come first.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2917;
+ }
+
+ @Override
+ protected void setup() {
+ table = new Table();
+ table.setSortDisabled(false);
+ table.setContainerDataSource(BeanItemContainerGenerator
+ .createContainer(100));
+ table.setColumnCollapsingAllowed(true);
+
+ Button b = new Button("Disable sorting", new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ table.setSortDisabled(!table.isSortDisabled());
+ if (table.isSortDisabled()) {
+ event.getButton().setCaption("Enable sorting");
+ } else {
+ event.getButton().setCaption("Disable sorting");
+ }
+ }
+
+ });
+
+ addComponent(table);
+ addComponent(b);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java b/src/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java
new file mode 100644
index 0000000000..20becea974
--- /dev/null
+++ b/src/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java
@@ -0,0 +1,75 @@
+package com.vaadin.tests.components.beanitemcontainer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.vaadin.data.util.BeanItemContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Table;
+
+public class TestBeanItemContainerUsage extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "A test for the BeanItemContainer. The table should contain three persons and show their first and last names and their age.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 1061;
+ }
+
+ @Override
+ protected void setup() {
+ Table t = new Table("Table containing Persons");
+ t.setPageLength(5);
+ t.setWidth("100%");
+ List<Person> persons = new ArrayList<Person>();
+ persons.add(new Person("Jones", "Birchman", 35));
+ persons.add(new Person("Marc", "Smith", 30));
+ persons.add(new Person("Greg", "Sandman", 75));
+
+ BeanItemContainer<Person> bic = new BeanItemContainer<Person>(persons);
+ t.setContainerDataSource(bic);
+
+ addComponent(t);
+ }
+
+ public static class Person {
+ private String firstName;
+ private String lastName;
+ private int age;
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Person(String firstName, String lastName, int age) {
+ super();
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.age = age;
+ }
+
+ }
+}
diff --git a/src/com/vaadin/tests/components/checkbox/CheckboxIcon.java b/src/com/vaadin/tests/components/checkbox/CheckboxIcon.java
new file mode 100644
index 0000000000..b38348e45f
--- /dev/null
+++ b/src/com/vaadin/tests/components/checkbox/CheckboxIcon.java
@@ -0,0 +1,29 @@
+package com.vaadin.tests.components.checkbox;
+
+import com.vaadin.terminal.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.CheckBox;
+
+public class CheckboxIcon extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "The icon of a Checkbox component should have the same cursor as the text and should be clickable. The tooltip should appear when hovering the checkbox, the icon or the caption.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected void setup() {
+ CheckBox checkbox = new CheckBox("A checkbox");
+ checkbox.setIcon(new ThemeResource("icons/32/calendar.png"));
+ checkbox.setDescription("Tooltip for checkbox");
+
+ addComponent(checkbox);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java b/src/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java
new file mode 100644
index 0000000000..9636af0284
--- /dev/null
+++ b/src/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.components.combobox;
+
+import java.util.Map;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.PopupView;
+
+public class ComboBoxInPopupView extends TestBase {
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2508;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Testcase for ComboBox in PopupView. Make the window narrower than the popup: the focused (2) one wraps button to second row AND seems narrower than (1), the unfocused one (1) works as expected.";
+ }
+
+ @Override
+ protected void setup() {
+ final ComboBox cb1 = new ComboBox();
+ cb1.setWidth("260px");
+ // cb.focus();
+ PopupView pv1 = new PopupView("<u>1. expected (click)</u>", cb1);
+ getLayout().addComponent(pv1);
+
+ final ComboBox cb2 = new ComboBox();
+ cb2.setWidth("260px");
+ PopupView pv2 = new PopupView("<u>2. focused (click)</u>", cb2) {
+ public void changeVariables(Object source, Map variables) {
+ super.changeVariables(source, variables);
+ cb2.focus();
+ }
+
+ };
+ getLayout().addComponent(pv2);
+
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java b/src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java
new file mode 100644
index 0000000000..905e9a37c3
--- /dev/null
+++ b/src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java
@@ -0,0 +1,37 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.data.Item;
+import com.vaadin.terminal.ClassResource;
+import com.vaadin.terminal.Resource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxItemIcon extends TestBase {
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2455;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The items in the ComboBox should have icons - also when selected.";
+ }
+
+ @Override
+ protected void setup() {
+ ComboBox cb = new ComboBox();
+ cb.addContainerProperty("icon", Resource.class, null);
+ cb.setItemIconPropertyId("icon");
+ getLayout().addComponent(cb);
+
+ Item item = cb.addItem("FI");
+ item.getItemProperty("icon").setValue(
+ new ClassResource("fi.gif", ComboBoxItemIcon.this));
+ item = cb.addItem("SE");
+ item.getItemProperty("icon").setValue(
+ new ClassResource("se.gif", ComboBoxItemIcon.this));
+
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxLargeIcons.java b/src/com/vaadin/tests/components/combobox/ComboBoxLargeIcons.java
new file mode 100644
index 0000000000..1992c12943
--- /dev/null
+++ b/src/com/vaadin/tests/components/combobox/ComboBoxLargeIcons.java
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.combobox;
+
+import java.util.Date;
+
+import com.vaadin.data.Item;
+import com.vaadin.terminal.Resource;
+import com.vaadin.terminal.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxLargeIcons extends TestBase {
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "<p>All items in the Combobox has large icons. The size of the dropdown should fit the contents, also when changing pages. The height of the dropdown shouldn't exceed the browser's viewport, but fewer items should be visible then.</p><p>The size of the shadow behind the dropdown must also be correctly sized.</p><p>Note that the image URL change for every restart to keep the browser from using cached images.</p>";
+ }
+
+ @Override
+ protected void setup() {
+ ComboBox cb = new ComboBox();
+ cb.addContainerProperty("icon", Resource.class, null);
+ cb.setItemIconPropertyId("icon");
+ getLayout().addComponent(cb);
+ cb.setNullSelectionAllowed(false);
+ String[] icons = new String[] { "folder-add", "folder-delete",
+ "arrow-down", "arrow-left", "arrow-right", "arrow-up",
+ "document-add", "document-delete", "document-doc",
+ "document-edit", "document-image", "document-pdf",
+ "document-ppt", "document-txt", "document-web", "document-xls",
+ "document" };
+ for (String icon : icons) {
+ Item item = cb.addItem(new Object());
+ item.getItemProperty("icon").setValue(
+ new ThemeResource("icons/64/" + icon + ".png?"
+ + new Date().getTime()));
+ }
+
+ }
+}
diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java b/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java
new file mode 100644
index 0000000000..245fc123df
--- /dev/null
+++ b/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxNavigation extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Entering e in the field and scrolling down with the arrow keys should always select the next item, also when the page changes. Scrolling back up should always select the previous item, also when changing pages.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2214;
+ }
+
+ @Override
+ protected void setup() {
+ ComboBox cb = new ComboBox();
+ for (int i = 1; i < 100; i++) {
+ cb.addItem("Item " + i);
+ }
+
+ cb.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS);
+ addComponent(cb);
+
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxValueUpdate.java b/src/com/vaadin/tests/components/combobox/ComboBoxValueUpdate.java
new file mode 100644
index 0000000000..c84179aaf0
--- /dev/null
+++ b/src/com/vaadin/tests/components/combobox/ComboBoxValueUpdate.java
@@ -0,0 +1,45 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Label;
+
+public class ComboBoxValueUpdate extends TestBase {
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2451;
+ }
+
+ private Label selectedLabel;
+
+ @Override
+ protected String getDescription() {
+ return "Testcase for value update for ComboBox. The server-side value should be updated immediately when a new item is selected in the dropdown";
+ }
+
+ @Override
+ protected void setup() {
+ ComboBox combobox = new ComboBox();
+ combobox.setImmediate(true);
+ combobox.addItem("Item 1");
+ combobox.addItem("Item 2");
+ combobox.addItem("Item 3");
+ combobox.addListener(new ValueChangeListener() {
+
+ public void valueChange(ValueChangeEvent event) {
+ Object p = event.getProperty().getValue();
+ selectedLabel.setValue("Server side value: " + p);
+ }
+
+ });
+ selectedLabel = new Label("Server side value: " + combobox.getValue());
+ getLayout().addComponent(selectedLabel);
+
+ getLayout().addComponent(combobox);
+
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/combobox/fi.gif b/src/com/vaadin/tests/components/combobox/fi.gif
new file mode 100755
index 0000000000..8d3a191828
--- /dev/null
+++ b/src/com/vaadin/tests/components/combobox/fi.gif
Binary files differ
diff --git a/src/com/vaadin/tests/components/combobox/se.gif b/src/com/vaadin/tests/components/combobox/se.gif
new file mode 100755
index 0000000000..80f6285228
--- /dev/null
+++ b/src/com/vaadin/tests/components/combobox/se.gif
Binary files differ
diff --git a/src/com/vaadin/tests/components/datefield/TestDatefieldYear.java b/src/com/vaadin/tests/components/datefield/TestDatefieldYear.java
new file mode 100644
index 0000000000..fb1a1934c2
--- /dev/null
+++ b/src/com/vaadin/tests/components/datefield/TestDatefieldYear.java
@@ -0,0 +1,28 @@
+package com.vaadin.tests.components.datefield;
+
+import java.util.Date;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.DateField;
+
+public class TestDatefieldYear extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "A popup with resolution year or month should update the textfield when browsing. The value displayed in the textfield should always be the same as the popup shows.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2813;
+ }
+
+ @Override
+ protected void setup() {
+ DateField df = new DateField("Year", new Date(2009 - 1900, 4 - 1, 1));
+ df.setResolution(DateField.RESOLUTION_YEAR);
+ df.setResolution(DateField.RESOLUTION_MONTH);
+ addComponent(df);
+
+ }
+}
diff --git a/src/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java b/src/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java
new file mode 100644
index 0000000000..e2b4ca5a2e
--- /dev/null
+++ b/src/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java
@@ -0,0 +1,149 @@
+package com.vaadin.tests.components.embedded;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+
+import javax.imageio.ImageIO;
+
+import com.vaadin.terminal.StreamResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Embedded;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class EmbeddedImageRefresh extends TestBase {
+ @Override
+ protected String getDescription() {
+ return "Tests if requestRepaint() makes the browser reload a dynamic resource.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2470;
+ }
+
+ @Override
+ protected void setup() {
+ // Create the embedded.
+ final Embedded embedded = new Embedded();
+ embedded.setDescription("Click on the grid cells to switch them.");
+ addComponent(embedded);
+
+ // Attach it to a resource.
+ final MyImageSource imageSource = new MyImageSource();
+ final StreamResource imageResource = new StreamResource(imageSource,
+ "testimage.png", this);
+ imageResource.setCacheTime(0);
+ embedded.setSource(imageResource);
+
+ // The button requests repainting the embedded.
+ Button button = new Button("refr");
+ button.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ embedded.requestRepaint();
+ }
+ });
+ addComponent(button);
+ button = new Button("refr name");
+ button.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ ((StreamResource) embedded.getSource()).setFilename(new Date()
+ .getTime()
+ + ".png");
+ embedded.requestRepaint();
+ }
+ });
+ addComponent(button);
+ button = new Button("200x200");
+ button.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ embedded.setWidth("200px");
+ embedded.setHeight("200px");
+ }
+ });
+ addComponent(button);
+ button = new Button("undef");
+ button.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ embedded.setSizeUndefined();
+ }
+ });
+ addComponent(button);
+
+ }
+
+ public class MyImageSource implements StreamResource.StreamSource {
+ public MyImageSource() {
+ }
+
+ int intervalPos(int pos, int resolution, int cells) {
+ return (int) Math.round(pos * resolution / (cells * 1.0));
+ }
+
+ public InputStream getStream() {
+ // Create an image and draw some background on it.
+ BufferedImage image = new BufferedImage(640, 480,
+ BufferedImage.TYPE_INT_RGB);
+ Graphics drawable = image.getGraphics();
+
+ // Background
+ drawable.setColor(Color.white);
+ drawable.fillRect(0, 0, 640, 480);
+
+ final int rows = 10;
+ final int cols = 10;
+
+ // Grid
+ for (int row = 0; row < rows; row++) {
+ int gridy = intervalPos(row, 480, rows);
+ int gridynext = intervalPos(row + 1, 480, rows);
+
+ // Horizontal grid line
+ if (row > 0) {
+ drawable.setColor(Color.lightGray);
+ drawable.drawLine(0, gridy, 640 - 1, gridy);
+ }
+
+ for (int col = 0; col < cols; col++) {
+ int gridx = intervalPos(col, 640, cols);
+ int gridxnext = intervalPos(col + 1, 640, cols);
+
+ // Vertical grid line
+ if (row == 0 && col > 0) {
+ drawable.setColor(Color.lightGray);
+ drawable.drawLine(gridx, 0, gridx, 480 - 1);
+ }
+
+ // Cell
+ if (Math.random() < 0.5f) {
+ drawable.setColor(Color.white);
+ } else {
+ drawable.setColor(Color.black);
+ }
+ drawable.fillRect(gridx + 1, gridy + 1, gridxnext - gridx
+ - 1, gridynext - gridy - 1);
+ }
+ }
+
+ try {
+ // Write the image to a buffer.
+ ByteArrayOutputStream imagebuffer = new ByteArrayOutputStream();
+ ImageIO.write(image, "png", imagebuffer);
+
+ // Return a stream from the buffer.
+ ByteArrayInputStream istream = new ByteArrayInputStream(
+ imagebuffer.toByteArray());
+ return istream; // new DownloadStream (istream,null,null);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ }
+}
diff --git a/src/com/vaadin/tests/components/embedded/EmbeddedTooltip.java b/src/com/vaadin/tests/components/embedded/EmbeddedTooltip.java
new file mode 100644
index 0000000000..6ce788f262
--- /dev/null
+++ b/src/com/vaadin/tests/components/embedded/EmbeddedTooltip.java
@@ -0,0 +1,28 @@
+package com.vaadin.tests.components.embedded;
+
+import com.vaadin.terminal.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Embedded;
+
+public class EmbeddedTooltip extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "The tooltip for an Embedded image should be visible also when hovering the image";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2853;
+ }
+
+ @Override
+ protected void setup() {
+ Embedded e = new Embedded("Embedded caption", new ThemeResource(
+ "icons/64/ok.png"));
+ e
+ .setDescription("Embedded tooltip, only shown on caption, not on the image");
+ addComponent(e);
+
+ }
+}
diff --git a/src/com/vaadin/tests/components/form/FormCommitWithInvalidValues.java b/src/com/vaadin/tests/components/form/FormCommitWithInvalidValues.java
new file mode 100644
index 0000000000..6431e0aeb1
--- /dev/null
+++ b/src/com/vaadin/tests/components/form/FormCommitWithInvalidValues.java
@@ -0,0 +1,71 @@
+package com.vaadin.tests.components.form;
+
+import com.vaadin.data.validator.StringLengthValidator;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Form;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Window.Notification;
+
+public class FormCommitWithInvalidValues extends TestBase {
+
+ private Form form;
+
+ @Override
+ protected String getDescription() {
+ return "Commiting a form with invalid values should throw an exception";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2466;
+ }
+
+ @Override
+ protected void setup() {
+ form = new Form();
+ TextField tf = new TextField("A field, must contain 1-2 chars");
+ tf
+ .addValidator(new StringLengthValidator("Invalid length", 1, 2,
+ false));
+ tf.setRequired(true);
+
+ form.addField("a", tf);
+
+ Button b = new Button("Commit", new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ try {
+ form.commit();
+ if (form.isValid()) {
+ getMainWindow().showNotification(
+ "OK! Form validated and no error was thrown",
+ Notification.TYPE_HUMANIZED_MESSAGE);
+ } else {
+ getMainWindow().showNotification(
+ "Form is invalid but no exception was thrown",
+ Notification.TYPE_ERROR_MESSAGE);
+ }
+ } catch (Exception e) {
+ if (form.isValid()) {
+ getMainWindow().showNotification(
+ "Form is valid but an exception was thrown",
+ Notification.TYPE_ERROR_MESSAGE);
+ } else {
+ getMainWindow().showNotification(
+ "OK! Error was thrown for an invalid input",
+ Notification.TYPE_HUMANIZED_MESSAGE);
+
+ }
+ }
+ }
+
+ });
+
+ addComponent(form);
+ addComponent(b);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/form/FormRenderingFlicker.java b/src/com/vaadin/tests/components/form/FormRenderingFlicker.java
new file mode 100644
index 0000000000..6956eee017
--- /dev/null
+++ b/src/com/vaadin/tests/components/form/FormRenderingFlicker.java
@@ -0,0 +1,65 @@
+package com.vaadin.tests.components.form;
+
+import com.vaadin.data.Item;
+import com.vaadin.event.ItemClickEvent;
+import com.vaadin.event.ItemClickEvent.ItemClickListener;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Form;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+
+public class FormRenderingFlicker extends TestBase {
+
+ private VerticalLayout tableLayout;
+ private Table table;
+ private Panel tablePanel;
+ private Form form;
+
+ @Override
+ protected String getDescription() {
+ return "Clicking on an item in the table will replace the panel (surrounding the table) with a form. This should not cause the table rows to move downwards or cause any other visible flicker";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2816;
+ }
+
+ @Override
+ protected void setup() {
+ createTableLayout();
+ form = new Form();
+
+ tablePanel = new Panel();
+ tablePanel.setLayout(tableLayout);
+
+ addComponent(tablePanel);
+ }
+
+ private void createTableLayout() {
+ tableLayout = new VerticalLayout();
+ table = new Table();
+ table.addContainerProperty("name", String.class, "");
+ table.addContainerProperty("age", String.class, "");
+ for (int i = 0; i < 100; i++) {
+ table.addItem(new Object[] { "Name " + i, String.valueOf(i) },
+ new Object());
+ }
+ table.setImmediate(true);
+ table.addListener(new ItemClickListener() {
+
+ public void itemClick(ItemClickEvent event) {
+ clicked(event.getItem());
+ }
+
+ });
+
+ tableLayout.addComponent(table);
+ }
+
+ protected void clicked(Item item) {
+ getLayout().replaceComponent(tablePanel, form);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/label/HundredPercentWideLabelResize.java b/src/com/vaadin/tests/components/label/HundredPercentWideLabelResize.java
new file mode 100644
index 0000000000..d494ac176e
--- /dev/null
+++ b/src/com/vaadin/tests/components/label/HundredPercentWideLabelResize.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.components.label;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class HundredPercentWideLabelResize extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "100% wide label re-wrap should cause re-layout; forceLayout fixes this.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2514;
+ }
+
+ @Override
+ protected void setup() {
+ getLayout().setWidth("500px");
+ Label text = new Label(
+ "This is a fairly long text that will wrap if the width of the layout is narrow enough. Directly below the text is a Button - however, when the layout changes size, the Label re-wraps w/o moving the button, causing eiter clipping or a big space.");
+ text.setWidth("100%");
+ getLayout().addComponent(text);
+
+ getLayout().addComponent(
+ new Button("toggle width", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ if (getLayout().getWidth() == 500) {
+ getLayout().setWidth("100px");
+ } else {
+ getLayout().setWidth("500px");
+ }
+
+ }
+
+ }));
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/label/LabelWrapping.java b/src/com/vaadin/tests/components/label/LabelWrapping.java
new file mode 100644
index 0000000000..d702f2440d
--- /dev/null
+++ b/src/com/vaadin/tests/components/label/LabelWrapping.java
@@ -0,0 +1,46 @@
+package com.vaadin.tests.components.label;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class LabelWrapping extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "A label inside a limited HorizontalLayout should strive to be as wide as possible and only wrap when the size of the layout is reached. The label should look the same if it is rendered initially with the layout or updated later on.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2478;
+ }
+
+ @Override
+ protected void setup() {
+ HorizontalLayout hl = new HorizontalLayout();
+ hl.setWidth("250px");
+
+ final String longString = "this is a somewhat long string.";
+ final Label longLabel = new Label(longString);
+
+ Button changeLength = new Button("Change length");
+ changeLength.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ if (longLabel.getValue().equals(longString)) {
+ longLabel.setValue("");
+ } else {
+ longLabel.setValue(longString);
+ }
+ }
+ });
+
+ hl.addComponent(longLabel);
+ hl.addComponent(changeLength);
+
+ addComponent(hl);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/link/LinkIcon.java b/src/com/vaadin/tests/components/link/LinkIcon.java
new file mode 100644
index 0000000000..345dcf93b4
--- /dev/null
+++ b/src/com/vaadin/tests/components/link/LinkIcon.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.components.link;
+
+import com.vaadin.terminal.ExternalResource;
+import com.vaadin.terminal.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Link;
+
+public class LinkIcon extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "The icon of a Link component should have the same cursor as the text and should be clickable";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected void setup() {
+ Link l = new Link("www.google.com", new ExternalResource(
+ "http://www.itmill.com/"));
+ l.setIcon(new ThemeResource("icons/32/calendar.png"));
+
+ addComponent(l);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/link/LinkTargetSize.java b/src/com/vaadin/tests/components/link/LinkTargetSize.java
new file mode 100644
index 0000000000..d5542cab04
--- /dev/null
+++ b/src/com/vaadin/tests/components/link/LinkTargetSize.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.components.link;
+
+import com.vaadin.terminal.ExternalResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Link;
+
+public class LinkTargetSize extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "This link should open a small window w/o decorations";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2524;
+ }
+
+ @Override
+ protected void setup() {
+ Link l = new Link("Try it!", new ExternalResource(
+ "http://www.google.com/m"));
+ l.setTargetName("_blank");
+ l.setTargetWidth(300);
+ l.setTargetHeight(300);
+ l.setTargetBorder(Link.TARGET_BORDER_NONE);
+ addComponent(l);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java b/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java
new file mode 100644
index 0000000000..b41b192056
--- /dev/null
+++ b/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.components.richtextarea;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.VerticalLayout;
+
+public class RichTextAreaSize extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Test the size of a rich text area. The first area is 100px*100px wide, the second 100%*100% (of 500x500px), the third one has undefined width and height.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2573;
+ }
+
+ @Override
+ protected void setup() {
+ getMainWindow().getLayout().setHeight(null);
+
+ RichTextArea first = new RichTextArea();
+ RichTextArea second = new RichTextArea();
+ RichTextArea third = new RichTextArea();
+
+ first.setWidth("100px");
+ first.setHeight("100px");
+ second.setSizeFull();
+ third.setSizeUndefined();
+
+ VerticalLayout secondLayout = new VerticalLayout();
+ secondLayout.setWidth("500px");
+ secondLayout.setHeight("500px");
+ secondLayout.addComponent(second);
+
+ addComponent(first);
+ addComponent(secondLayout);
+ addComponent(third);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java b/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java
new file mode 100644
index 0000000000..89008754ba
--- /dev/null
+++ b/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java
@@ -0,0 +1,64 @@
+package com.vaadin.tests.components.splitpanel;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.SplitPanel;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Window.Notification;
+
+public class SplitPanelSplitterWidth extends TestBase {
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2510;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "SplitPanel splitter is effectively a 1px wide target after unlocking previously locked splitter.";
+ }
+
+ @Override
+ protected void setup() {
+ final SplitPanel split = new SplitPanel(
+ SplitPanel.ORIENTATION_HORIZONTAL);
+ split.setWidth("200px");
+ split.setHeight("200px");
+ split.setLocked(true);
+ Panel p = new Panel("Left");
+ p.setSizeFull();
+ split.addComponent(p);
+ p = new Panel("Right");
+ p.setSizeFull();
+ split.addComponent(p);
+
+ final SplitPanel split2 = new SplitPanel();
+ split2.setWidth("200px");
+ split2.setHeight("200px");
+ split2.setLocked(true);
+ p = new Panel("Top");
+ p.setSizeFull();
+ split2.addComponent(p);
+ p = new Panel("Bottom");
+ p.setSizeFull();
+ split2.addComponent(p);
+
+ getLayout().addComponent(
+ new Button("Unlock", new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ split.setLocked(false);
+ split2.setLocked(false);
+ getMainWindow().showNotification(
+ "Try moving split. Then reload page.",
+ Notification.TYPE_WARNING_MESSAGE);
+ getLayout().removeComponent(event.getButton());
+ }
+
+ }));
+ getLayout().addComponent(split);
+ getLayout().addComponent(split2);
+
+ }
+}
diff --git a/src/com/vaadin/tests/components/table/ColumnExpandRatio.java b/src/com/vaadin/tests/components/table/ColumnExpandRatio.java
new file mode 100644
index 0000000000..be176d83fa
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/ColumnExpandRatio.java
@@ -0,0 +1,70 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+
+public class ColumnExpandRatio extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Column expand ratios can be used to adjust the way "
+ + "how excess horizontal space is divided among columns.";
+
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2806;
+ }
+
+ private static final int ROWS = 100;
+
+ @Override
+ public void setup() {
+ Table table1 = initTable();
+ addComponent(new Label("Plain table"));
+ addComponent(table1);
+
+ }
+
+ private Table initTable() {
+ Table table = new Table();
+ table.setWidth("100%");
+
+ IndexedContainer idx = new IndexedContainer();
+ idx.addContainerProperty("firstname", String.class, null);
+ idx.addContainerProperty("lastname", String.class, null);
+ Item i = idx.addItem(1);
+ i.getItemProperty("firstname").setValue("John");
+ i.getItemProperty("lastname").setValue("Johnson");
+
+ i = idx.addItem(2);
+ i.getItemProperty("firstname").setValue("Jane");
+ i.getItemProperty("lastname").setValue("Janeine");
+
+ for (int index = 3; index < ROWS; index++) {
+ i = idx.addItem(index);
+ i.getItemProperty("firstname").setValue("Jane");
+ i.getItemProperty("lastname").setValue("Janeine");
+ }
+
+ idx.addContainerProperty("fixed 50px column", String.class, "");
+
+ idx.addContainerProperty("Expanded with 2", String.class, "foobar");
+
+ table.setContainerDataSource(idx);
+
+ table.setColumnHeader("firstname", "FirstName");
+ table.setColumnHeader("lastname", "LastName (1)");
+
+ table.setColumnWidth("fixed 50px column", 50);
+ table.setColumnExpandRatio("Expanded with 2", 2);
+ table.setColumnExpandRatio("lastname", 1);
+
+ return table;
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/table/ColumnGeneratorAddingOrder.java b/src/com/vaadin/tests/components/table/ColumnGeneratorAddingOrder.java
new file mode 100644
index 0000000000..d3dfa61ceb
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/ColumnGeneratorAddingOrder.java
@@ -0,0 +1,52 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Table;
+
+public class ColumnGeneratorAddingOrder extends TestBase {
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2457;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Column generator must be allowed to be added both before and after data source setting and overriding should work. Bugs in 5.3-rc7 if added after DS.";
+ }
+
+ @Override
+ protected void setup() {
+ Table t = new Table();
+
+ t.addGeneratedColumn("col2", new Table.ColumnGenerator() {
+ public Component generateCell(Table source, Object itemId,
+ Object columnId) {
+ return new Button("generated b c2");
+ }
+ });
+
+ IndexedContainer c = new IndexedContainer();
+ c.addContainerProperty("col1", String.class, "col1 ds data");
+ c.addContainerProperty("col2", String.class, "col2 ds data");
+ c.addContainerProperty("col3", String.class, "col3 ds data");
+ for (int i = 0; i < 100; i++) {
+ c.addItem();
+ }
+ t.setContainerDataSource(c);
+
+ t.addGeneratedColumn("col1", new Table.ColumnGenerator() {
+ public Component generateCell(Table source, Object itemId,
+ Object columnId) {
+ return new Button("generated b c1");
+ }
+ });
+
+ getLayout().addComponent(t);
+
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/table/ColumnWidths.java b/src/com/vaadin/tests/components/table/ColumnWidths.java
new file mode 100644
index 0000000000..9fe7a98179
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/ColumnWidths.java
@@ -0,0 +1,69 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+
+public class ColumnWidths extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "On window resize undefined "
+ + "columns (by server or user (dragged)) columns "
+ + "must consume the excess space. Space is divided "
+ + "by default according to natural widths of columns."
+ + "In example last column is fixed width. Other columns"
+ + " should divide excess space relatively to 'natural' width unless user has resized column.";
+
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2804;
+ }
+
+ private static final int ROWS = 100;
+
+ @Override
+ public void setup() {
+ Table table1 = initTable();
+ addComponent(new Label("Plain table"));
+ addComponent(table1);
+
+ }
+
+ private Table initTable() {
+ Table table = new Table();
+ table.setWidth("100%");
+
+ IndexedContainer idx = new IndexedContainer();
+ idx.addContainerProperty("firstname", String.class, null);
+ idx.addContainerProperty("lastname", String.class, null);
+ Item i = idx.addItem(1);
+ i.getItemProperty("firstname").setValue("John");
+ i.getItemProperty("lastname").setValue("Johnson");
+ i = idx.addItem(2);
+ i.getItemProperty("firstname").setValue("Jane");
+ i.getItemProperty("lastname").setValue("Janeine");
+
+ for (int index = 3; index < ROWS; index++) {
+ i = idx.addItem(index);
+ i.getItemProperty("firstname").setValue("Jane");
+ i.getItemProperty("lastname").setValue("Janeine");
+ }
+
+ idx.addContainerProperty("150pxfixedCol", String.class, "foobar");
+
+ table.setContainerDataSource(idx);
+
+ table.setColumnHeader("firstname", "FirstName");
+ table.setColumnHeader("lastname", "LastName with long header");
+
+ table.setColumnWidth("150pxfixedCol", 150);
+
+ return table;
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/table/ContainerSizeChange.java b/src/com/vaadin/tests/components/table/ContainerSizeChange.java
new file mode 100644
index 0000000000..567cde8a54
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/ContainerSizeChange.java
@@ -0,0 +1,91 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class ContainerSizeChange extends TestBase {
+
+ private Table table;
+ private MyDataSource ds;
+
+ @Override
+ protected String getDescription() {
+ return "A table should be able to handle a decrease in the size of the container. The original container here contains 50 items and the decrease button removes 10 of these. To reproduce the problem: Click 'Decrease size' two times to reduce size to 30 and scroll to the end (50). What should happen is the table should notice the container size has decreased and show the last items which now exists in the new container.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2862;
+ }
+
+ @Override
+ protected void setup() {
+ table = new Table("A table");
+ ds = new MyDataSource();
+ table.setContainerDataSource(ds);
+ table.setPageLength(5);
+ addComponent(table);
+
+ Button b = new Button("Decrease size", new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ ds.decreaseSize();
+ }
+
+ });
+
+ addComponent(b);
+
+ b = new Button("Increase size", new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ ds.increaseSize();
+ }
+
+ });
+
+ addComponent(b);
+
+ }
+
+}
+
+class MyDataSource extends IndexedContainer {
+
+ private int size = 0;
+
+ public MyDataSource() {
+ addContainerProperty("a", String.class, "");
+ addContainerProperty("b", String.class, "");
+ addContainerProperty("c", String.class, "");
+
+ for (int i = 0; i < 100; i++) {
+ Item item = addItem(String.valueOf(i));
+ item.getItemProperty("a").setValue("a " + i);
+ item.getItemProperty("b").setValue("b " + i);
+ item.getItemProperty("c").setValue("c " + i);
+ }
+ size = 50;
+ }
+
+ public void increaseSize() {
+ size += 10;
+
+ }
+
+ public void decreaseSize() {
+ if (size > 10) {
+ size -= 10;
+ }
+
+ }
+
+ @Override
+ public int size() {
+ return size;
+ }
+}
diff --git a/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java b/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java
new file mode 100644
index 0000000000..139e9baa35
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java
@@ -0,0 +1,68 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.event.ItemClickEvent;
+import com.vaadin.event.ItemClickEvent.ItemClickListener;
+import com.vaadin.terminal.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Embedded;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+
+public class LabelEmbeddedClickThroughForTable extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Clicking on a Label or Embedded inside a Table should select the row in the same way that clicking on a text selects the row.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2688;
+ }
+
+ @Override
+ protected void setup() {
+ Table table = new Table();
+ table.setSelectable(true);
+ table.addContainerProperty("Column 1", String.class, "");
+ table.addContainerProperty("Column 2", Component.class, "");
+ table.addContainerProperty("Column 3", Component.class, "");
+ table.addContainerProperty("Column 4", Component.class, "");
+
+ Item item = table.addItem("Item 1 (row 1)");
+ item.getItemProperty("Column 1").setValue("String A");
+ item.getItemProperty("Column 2").setValue(new Label("Label A"));
+ item.getItemProperty("Column 3").setValue(
+ new Label("<b>Label A</b>", Label.CONTENT_XHTML));
+ item.getItemProperty("Column 4").setValue(
+ new Embedded("An embedded image", new ThemeResource(
+ "icons/32/ok.png")));
+
+ item = table.addItem("Item 2 (row 2)");
+ item.getItemProperty("Column 1").setValue("String B");
+ item.getItemProperty("Column 2").setValue(new Label("Label B"));
+ item
+ .getItemProperty("Column 3")
+ .setValue(
+ new Label(
+ "<a href=\"http://www.itmill.com\" target=_blank>Label A</a>",
+ Label.CONTENT_XHTML));
+ item.getItemProperty("Column 4").setValue(
+ new Embedded("", new ThemeResource("icons/32/cancel.png")));
+
+ table.addListener(new ItemClickListener() {
+
+ public void itemClick(ItemClickEvent event) {
+ getMainWindow().showNotification(
+ "Clickevent on item " + event.getItemId()
+ + ", column: " + event.getPropertyId());
+
+ }
+
+ });
+ addComponent(table);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/table/PropertyValueChange.java b/src/com/vaadin/tests/components/table/PropertyValueChange.java
new file mode 100644
index 0000000000..353d2f13ef
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/PropertyValueChange.java
@@ -0,0 +1,158 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.BaseFieldFactory;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.FieldFactory;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.AbstractSelect.NewItemHandler;
+import com.vaadin.ui.Table.ColumnGenerator;
+
+public class PropertyValueChange extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Property value change should only update absolutely "
+ + "needed cells. Tables have common datasource. The first is "
+ + "editable, second one has data in disabled fields, the lastone "
+ + "is plain table that directly shows data. Use first table and "
+ + "combobox/sync button to send changed values to server and evaluate "
+ + "given uidl responses.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2823;
+ }
+
+ private IndexedContainer container;
+
+ // Also use column generator in test, to ensure it is possible to build
+ // columns that update automatically.
+ ColumnGenerator multiplier = new ColumnGenerator() {
+ private int getMultipliedValue(Property p) {
+ int i = ((Integer) p.getValue()).intValue();
+ return i * 3;
+ }
+
+ public Component generateCell(Table source, Object itemId,
+ Object columnId) {
+ final Label l = new Label();
+ final Property integer = source.getContainerProperty(itemId,
+ "integer");
+ l.setValue(getMultipliedValue(integer));
+
+ // we must hook value change listener to ensure updates in all use
+ // cases (eg. edit mode)
+ if (integer instanceof Property.ValueChangeNotifier) {
+ Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) integer;
+ notifier.addListener(new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ l.setValue(getMultipliedValue(integer));
+ }
+ });
+ }
+ return l;
+ }
+ };
+
+ FieldFactory ff = new MyFieldFactory();
+
+ @Override
+ public void setup() {
+ container = new IndexedContainer();
+
+ container.addContainerProperty("text", String.class, "sampletext");
+ container.addContainerProperty("integer", Integer.class, 5);
+
+ container.addItem();
+ container.addItem();
+
+ Table t1 = new Table(
+ "Editable table with bells and wistles. See description.");
+ t1.setDescription("Opening combobox should never fire table"
+ + " refresh (for this table). Update from textfield "
+ + "(integer) may be sent to server however. The readonly table"
+ + " my refresh, but not this one.");
+ t1.setPageLength(0);
+ t1.setContainerDataSource(container);
+ t1.addGeneratedColumn("integer x 3", multiplier);
+ t1.setFieldFactory(ff);
+ t1.setEditable(true);
+ t1.setDebugId("editortable");
+
+ Table t2 = new Table(
+ "A clone of table1, but disabled. Properties are in components.");
+ t2
+ .setDescription("This table is in editable mode."
+ + " Updates to common datasource should not affect redraw for this "
+ + "table. Only the components inside table should get updated.");
+ t2.setFieldFactory(ff);
+ t2.setEditable(true);
+ t2.setEnabled(false);
+ t2.setContainerDataSource(container);
+ t2.addGeneratedColumn("integer x 3", multiplier);
+ t2.setPageLength(0);
+ t2.setDebugId("disabled table");
+
+ Table reader = new Table("Reader table");
+ reader
+ .setDescription("This table should be redrawn on container changes as container data is "
+ + "displayed directly in cells.");
+ reader.setContainerDataSource(container);
+ reader.addGeneratedColumn("integer x 3", multiplier);
+ reader.setPageLength(0);
+ reader.setDebugId("reader table");
+
+ getLayout().addComponent(t1);
+ getLayout().addComponent(t2);
+ getLayout().addComponent(reader);
+ getLayout().addComponent(new Button("Sync!"));
+
+ }
+}
+
+class MyFieldFactory extends BaseFieldFactory {
+
+ IndexedContainer texts = new IndexedContainer();
+
+ public MyFieldFactory() {
+ texts.addItem("sampletext");
+ texts.addItem("foo");
+ texts.addItem("bar");
+ for (int i = 0; i < 100; i++) {
+ texts.addItem("foo" + 1);
+ }
+
+ }
+
+ @Override
+ public Field createField(Container container, Object itemId,
+ Object propertyId, Component uiContext) {
+ if (propertyId.equals("text")) {
+ // replace text fields with comboboxes
+ final ComboBox cb = new ComboBox() {
+ };
+ cb.setContainerDataSource(texts);
+ cb.setNewItemsAllowed(true);
+ cb.setNewItemHandler(new NewItemHandler() {
+ public void addNewItem(String newItemCaption) {
+ texts.addItem(newItemCaption);
+ cb.setValue(newItemCaption);
+ }
+ });
+ return cb;
+ }
+
+ return super.createField(container, itemId, propertyId, uiContext);
+ }
+}
diff --git a/src/com/vaadin/tests/components/table/RowAdditionTest.java b/src/com/vaadin/tests/components/table/RowAdditionTest.java
new file mode 100644
index 0000000000..9b600eff7a
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/RowAdditionTest.java
@@ -0,0 +1,59 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class RowAdditionTest extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Adding a row should refresh client area only if newly added row is in the rendered area.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return new Integer(2799);
+ }
+
+ @Override
+ protected void setup() {
+ final Table table = new Table();
+ final IndexedContainer container = (IndexedContainer) table
+ .getContainerDataSource();
+ table.addContainerProperty("column1", String.class, "test");
+
+ for (int i = 0; i < 100; ++i) {
+ table.addItem();
+ }
+
+ HorizontalLayout hl = new HorizontalLayout();
+ hl.addComponent(new Button("Add first", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ Item item = container.addItemAt(0, new Object());
+ item.getItemProperty("column1").setValue("0");
+ }
+ }));
+ hl.addComponent(new Button("Add at position 50",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ Item item = container.addItemAt(50, new Object());
+ item.getItemProperty("column1").setValue("50");
+ }
+ }));
+ hl.addComponent(new Button("Add at position 100",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ Item item = container.addItemAt(100, new Object());
+ item.getItemProperty("column1").setValue("100");
+ }
+ }));
+
+ getLayout().addComponent(table);
+ getLayout().addComponent(hl);
+ }
+}
diff --git a/src/com/vaadin/tests/components/table/TableItemIcon.java b/src/com/vaadin/tests/components/table/TableItemIcon.java
new file mode 100644
index 0000000000..b8a6733e83
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/TableItemIcon.java
@@ -0,0 +1,38 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.terminal.ClassResource;
+import com.vaadin.terminal.Resource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Table;
+
+public class TableItemIcon extends TestBase {
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2457;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The items in the Table should have icons in the first column (rowheader).";
+ }
+
+ @Override
+ protected void setup() {
+ Table table = new Table();
+ table.addContainerProperty("icon", Resource.class, null);
+ table.setItemIconPropertyId("icon");
+ table.setRowHeaderMode(Table.ROW_HEADER_MODE_ICON_ONLY);
+ getLayout().addComponent(table);
+
+ Item item = table.addItem("FI");
+ item.getItemProperty("icon").setValue(
+ new ClassResource("fi.gif", TableItemIcon.this));
+ item = table.addItem("SE");
+ item.getItemProperty("icon").setValue(
+ new ClassResource("se.gif", TableItemIcon.this));
+
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/table/TableRowHeight.java b/src/com/vaadin/tests/components/table/TableRowHeight.java
new file mode 100644
index 0000000000..7e51226094
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/TableRowHeight.java
@@ -0,0 +1,112 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.ColumnGenerator;
+
+public class TableRowHeight extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "This test case contains 4 tables in various configurations. All tables have a pageLength of "
+ + PAGELENGTH
+ + " and thus should show as many rows without any scrollbars (height is undefined for all tables).";
+
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2691;
+ }
+
+ private static final int PAGELENGTH = 2;
+
+ public void setup() {
+ Table table1 = initTable(PAGELENGTH, false, false);
+ addComponent(new Label("Plain table"));
+ addComponent(table1);
+
+ Table table2 = initTable(PAGELENGTH, true, false);
+ addComponent(new Label("Table with label component in generated column"));
+ addComponent(table2);
+
+ Table table3 = initTable(PAGELENGTH, false, true);
+ addComponent(new Label(
+ "Table with layout component in generated column"));
+ addComponent(table3);
+
+ Table table4 = initTable(PAGELENGTH, true, true);
+ addComponent(new Label(
+ "Table with both label and layout component in generated column"));
+ addComponent(table4);
+
+ }
+
+ private Table initTable(int pageLength, boolean addLabelColGen,
+ boolean addLayoutColGen) {
+ Table table = new Table();
+ table.setWidth("100%");
+ table.setPageLength(pageLength);
+
+ IndexedContainer idx = new IndexedContainer();
+ idx.addContainerProperty("firstname", String.class, null);
+ idx.addContainerProperty("lastname", String.class, null);
+ Item i = idx.addItem(1);
+ i.getItemProperty("firstname").setValue("John");
+ i.getItemProperty("lastname").setValue("Johnson");
+ i = idx.addItem(2);
+ i.getItemProperty("firstname").setValue("Jane");
+ i.getItemProperty("lastname").setValue("Janeine");
+
+ table.setContainerDataSource(idx);
+
+ table.setColumnHeader("firstname", "FirstName");
+ table.setColumnHeader("lastname", "LastName");
+ if (addLabelColGen) {
+ table.addGeneratedColumn("name1", new LabelColumnGenerator());
+ }
+ if (addLayoutColGen) {
+ table.addGeneratedColumn("name2", new LayoutColumnGenerator());
+ }
+
+ return table;
+ }
+
+ public class LabelColumnGenerator implements ColumnGenerator {
+
+ public Component generateCell(Table source, Object itemId,
+ Object columnId) {
+ Item item = source.getItem(itemId);
+ String firstname = (String) item.getItemProperty("firstname")
+ .getValue();
+ String lastname = (String) item.getItemProperty("lastname")
+ .getValue();
+ Label label = new Label(firstname + " " + lastname);
+ return label;
+ }
+
+ }
+
+ public class LayoutColumnGenerator implements ColumnGenerator {
+
+ public Component generateCell(Table source, Object itemId,
+ Object columnId) {
+ Item item = source.getItem(itemId);
+ GridLayout layout = new GridLayout(1, 2);
+ String firstname = (String) item.getItemProperty("firstname")
+ .getValue();
+ String lastname = (String) item.getItemProperty("lastname")
+ .getValue();
+ layout.addComponent(new Label(firstname), 0, 0);
+ layout.addComponent(new Label(lastname), 0, 1);
+ return layout;
+ }
+
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/table/TableRowHeight2.java b/src/com/vaadin/tests/components/table/TableRowHeight2.java
new file mode 100644
index 0000000000..2c9d75808b
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/TableRowHeight2.java
@@ -0,0 +1,64 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Table;
+
+public class TableRowHeight2 extends TestBase {
+
+ private static final int TABLE_EXTRA = 2; // borders
+ private static final int COLEXTRASPACE = 6; // cell margins by theme
+
+ @Override
+ protected String getDescription() {
+ return "The table contains 2 rows, which both should be shown completely as the table height is undefined.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2747;
+ }
+
+ @Override
+ protected void setup() {
+ setTheme("tests-tickets");
+ HorizontalLayout vl = new HorizontalLayout();
+ vl.setSizeFull();
+
+ Table table = new Table();
+
+ int COL_TITLE_W = 200;
+ int COL_TEST_W = 98;
+
+ table
+ .setWidth((COL_TEST_W + COL_TITLE_W + 2 * COLEXTRASPACE + TABLE_EXTRA)
+ + "px");
+ table.setPageLength(0);
+ table.setColumnWidth("title", COL_TITLE_W);
+ table.setColumnWidth("test", COL_TEST_W);
+ table.addContainerProperty("title", Button.class, "");
+ table.addContainerProperty("test", Button.class, "");
+ for (int i = 0; i < 2; i++) {
+ Item item = table.addItem(new Object());
+
+ Button b = new Button();
+ b.setWidth("100%");
+ b.setStyleName(Button.STYLE_LINK);
+ b.addStyleName("nowraplink");
+
+ b
+ .setCaption("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper, elit quis elementum iaculis, dui est rutrum risus, at cursus sem leo eget arcu. Proin vel eros ut tortor luctus pretium. Nulla facilisi. Donec in dui. Proin ac diam vitae massa tempus faucibus. Fusce eu risus. Nunc ac risus. Cras libero.");
+
+ item.getItemProperty("title").setValue(b);
+
+ Button c = new Button("test");
+ item.getItemProperty("test").setValue(c);
+ }
+
+ vl.addComponent(table);
+
+ addComponent(vl);
+ }
+}
diff --git a/src/com/vaadin/tests/components/table/TableRowHeight3.java b/src/com/vaadin/tests/components/table/TableRowHeight3.java
new file mode 100644
index 0000000000..d0b7afe94c
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/TableRowHeight3.java
@@ -0,0 +1,61 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Table;
+
+public class TableRowHeight3 extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "All rows should be visible and the table height should match the height of the rows (no vertical scrollbar)";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2747;
+ }
+
+ @Override
+ protected void setup() {
+ setTheme("tests-tickets");
+ HorizontalLayout vl = new HorizontalLayout();
+ vl.setSizeFull();
+
+ Table table = new Table();
+ table.setWidth("320px");
+ table.setPageLength(0);
+ table.setColumnWidth("title", 200);
+ table.setColumnWidth("test", 98);
+ table.addContainerProperty("title", Button.class, "");
+ table.addContainerProperty("test", Button.class, "");
+ for (int i = 0; i < 6; i++) {
+ Item item = table.addItem(new Object());
+
+ Button b = new Button();
+ b.setWidth("100%");
+ b.setStyleName(Button.STYLE_LINK);
+ b.addStyleName("nowraplink");
+ if (i < 2) {
+ b
+ .setCaption("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper, elit quis elementum iaculis, dui est rutrum risus, at cursus sem leo eget arcu. Proin vel eros ut tortor luctus pretium. Nulla facilisi. Donec in dui. Proin ac diam vitae massa tempus faucibus. Fusce eu risus. Nunc ac risus. Cras libero.");
+ } else if (2 <= i && i < 4) {
+ b.setCaption("One line");
+ } else {
+ b.setCaption("This button caption should use up two lines");
+ }
+ item.getItemProperty("title").setValue(b);
+
+ Button c = new Button("test");
+ item.getItemProperty("test").setValue(c);
+ }
+
+ vl.addComponent(table);
+
+ addComponent(vl);
+
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java b/src/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java
new file mode 100644
index 0000000000..d74c3b7238
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java
@@ -0,0 +1,60 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.Application;
+import com.vaadin.data.Container;
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+
+public class TestCurrentPageFirstItem extends Application implements
+ ClickListener {
+
+ private Button buttonIndex;
+ private Button buttonItem;
+ private Table table;
+ private int counter = 0;
+ IndexedContainer container = new IndexedContainer();
+
+ @Override
+ public void init() {
+ try {
+ Window main = new Window("Table header Test");
+ setMainWindow(main);
+ main.setSizeFull();
+ // setTheme("testtheme");
+ VerticalLayout baseLayout = new VerticalLayout();
+ main.setLayout(baseLayout);
+
+ table = new Table();
+ container.addContainerProperty("row", String.class, "");
+ table.setContainerDataSource(container);
+ table.setWidth("100%");
+ table.setPageLength(3);
+ buttonIndex = new Button("Add row and select last index", this);
+ buttonItem = new Button("Add row and select last item", this);
+
+ baseLayout.addComponent(table);
+ baseLayout.addComponent(buttonIndex);
+ baseLayout.addComponent(buttonItem);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void buttonClick(ClickEvent event) {
+ Item item = container.addItem(++counter);
+ item.getItemProperty("row").setValue(counter + "");
+ table.select(counter);
+ if (event.getButton() == buttonIndex) {
+ table.setCurrentPageFirstItemIndex(((Container.Indexed) table
+ .getContainerDataSource()).indexOfId(counter));
+ } else {
+ table.setCurrentPageFirstItemId(counter);
+ }
+ }
+}
diff --git a/src/com/vaadin/tests/components/table/fi.gif b/src/com/vaadin/tests/components/table/fi.gif
new file mode 100755
index 0000000000..8d3a191828
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/fi.gif
Binary files differ
diff --git a/src/com/vaadin/tests/components/table/se.gif b/src/com/vaadin/tests/components/table/se.gif
new file mode 100755
index 0000000000..80f6285228
--- /dev/null
+++ b/src/com/vaadin/tests/components/table/se.gif
Binary files differ
diff --git a/src/com/vaadin/tests/components/tabsheet/AddAndRemoveTabs.java b/src/com/vaadin/tests/components/tabsheet/AddAndRemoveTabs.java
new file mode 100644
index 0000000000..44859fb511
--- /dev/null
+++ b/src/com/vaadin/tests/components/tabsheet/AddAndRemoveTabs.java
@@ -0,0 +1,60 @@
+package com.vaadin.tests.components.tabsheet;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class AddAndRemoveTabs extends TestBase {
+ private TabSheet tabSheet;
+
+ private int counter = 0;
+
+ @Override
+ public void setup() {
+ tabSheet = new TabSheet();
+ addTab();
+ addComponent(tabSheet);
+
+ Button addTabBtn = new Button("Add new tab",
+ new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ addTab();
+ }
+
+ });
+ addComponent(addTabBtn);
+ }
+
+ private void addTab() {
+ final HorizontalLayout layout = new HorizontalLayout();
+ layout.setCaption("Test " + counter);
+
+ Button closeTab = new Button("Close tab", new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ tabSheet.removeComponent(layout);
+
+ }
+
+ });
+
+ layout.addComponent(closeTab);
+
+ tabSheet.addComponent(layout);
+ counter++;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Removing all tabs and then adding new tabs should work properly and without javascript errors. All new tabs should be displayed and not only the first one";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2861;
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/tabsheet/RemoveTabs.java b/src/com/vaadin/tests/components/tabsheet/RemoveTabs.java
new file mode 100644
index 0000000000..c2f8af8454
--- /dev/null
+++ b/src/com/vaadin/tests/components/tabsheet/RemoveTabs.java
@@ -0,0 +1,129 @@
+package com.vaadin.tests.components.tabsheet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractComponentContainer;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class RemoveTabs extends TestBase {
+
+ protected TabSheet tabsheet;
+
+ protected Component[] tab = new Component[5];
+
+ private Button closeCurrent;
+ private Button closeFirst;
+ private Button closeLast;
+ private Button reorderTabs;
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2425;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Tests the removal of individual tabs from a Tabsheet. No matter what is done in this test the tab caption \"Tab X\" should always match the content \"Tab X\". Use \"remove first\" and \"remove active\" buttons to remove the first or the active tab. The \"reorder\" button reverses the order by adding and removing all components.";
+ }
+
+ @Override
+ protected void setup() {
+ tabsheet = new TabSheet();
+ for (int i = 1; i <= tab.length; i++) {
+ tab[i - 1] = new Label("This is the contents of tab " + i);
+ tab[i - 1].setCaption("Tab " + i);
+
+ tabsheet.addComponent(tab[i - 1]);
+ }
+
+ getLayout().addComponent(tabsheet);
+
+ closeCurrent = new Button("Close current tab");
+ closeCurrent.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ closeCurrentTab();
+
+ }
+ });
+
+ closeFirst = new Button("close first tab");
+ closeFirst.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ closeFirstTab();
+
+ }
+ });
+
+ closeLast = new Button("close last tab");
+ closeLast.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ closeLastTab();
+
+ }
+ });
+
+ reorderTabs = new Button("reorder");
+ reorderTabs.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ reorder();
+
+ }
+ });
+
+ getLayout().addComponent(closeFirst);
+ getLayout().addComponent(closeLast);
+ getLayout().addComponent(closeCurrent);
+ getLayout().addComponent(reorderTabs);
+
+ }
+
+ private void closeCurrentTab() {
+ Component c = tabsheet.getSelectedTab();
+ if (c != null) {
+ tabsheet.removeComponent(c);
+ }
+ }
+
+ private void closeFirstTab() {
+ tabsheet.removeComponent((Component) tabsheet.getComponentIterator()
+ .next());
+ }
+
+ @SuppressWarnings("unchecked")
+ private void closeLastTab() {
+ Iterator i = tabsheet.getComponentIterator();
+ Component last = null;
+ while (i.hasNext()) {
+ last = (Component) i.next();
+
+ }
+ tabsheet.removeComponent(last);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void reorder() {
+ AbstractComponentContainer container = tabsheet;
+
+ if (container != null) {
+ List<Component> c = new ArrayList<Component>();
+ Iterator<Component> i = container.getComponentIterator();
+ while (i.hasNext()) {
+ Component comp = i.next();
+ c.add(comp);
+ }
+ container.removeAllComponents();
+
+ for (int j = c.size() - 1; j >= 0; j--) {
+ container.addComponent(c.get(j));
+ }
+
+ }
+ }
+}
diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java b/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java
new file mode 100644
index 0000000000..9e8f4a35f4
--- /dev/null
+++ b/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java
@@ -0,0 +1,55 @@
+package com.vaadin.tests.components.tabsheet;
+
+import java.util.Date;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class TabSheetCaptions extends TestBase {
+
+ Panel panel1;
+
+ @Override
+ protected String getDescription() {
+ return "Updating the tabsheet tab text should not change the caption of the component. Click on the button to change the tab text. This must update the tab and not touch the Panel's caption.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2846;
+ }
+
+ @Override
+ protected void setup() {
+ final TabSheet tabSheet = new TabSheet();
+
+ panel1 = new Panel("Panel initial caption (should also be tab caption)");
+ panel1.setSizeFull();
+ panel1.getLayout().setSizeFull();
+ panel1.addComponent(new Label("This is a panel"));
+ tabSheet.addTab(panel1);
+
+ Button button = new Button("Update tab caption");
+ button.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ tabSheet.setTabCaption(panel1, "This is a new tab caption "
+ + new Date());
+ }
+ });
+
+ Button button2 = new Button("Update panel caption");
+ button2.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ panel1.setCaption("This is a new panel caption " + new Date());
+ }
+ });
+
+ addComponent(tabSheet);
+ addComponent(button);
+ addComponent(button2);
+ }
+}
diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetDisabling.java b/src/com/vaadin/tests/components/tabsheet/TabSheetDisabling.java
new file mode 100644
index 0000000000..612960f2cf
--- /dev/null
+++ b/src/com/vaadin/tests/components/tabsheet/TabSheetDisabling.java
@@ -0,0 +1,62 @@
+package com.vaadin.tests.components.tabsheet;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+
+public class TabSheetDisabling extends TestBase {
+
+ private static final int NR_BUTTONS = 10;
+ private Button buttons[] = new Button[NR_BUTTONS];
+ private TabSheet tabSheet;
+
+ @Override
+ public void setup() {
+ tabSheet = new TabSheet();
+ for (int i = 0; i < NR_BUTTONS; i++) {
+ if (i % 2 == 0) {
+ buttons[i] = new Button("Disable this tab",
+ new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ Button b = event.getButton();
+ tabSheet.getTab(b).setEnabled(false);
+
+ }
+
+ });
+ } else {
+ buttons[i] = new Button("Hide this tab", new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ Button b = event.getButton();
+ tabSheet.getTab(b).setVisible(false);
+ }
+
+ });
+ }
+ tabSheet.addTab(buttons[i]);
+ }
+
+ Button button = new Button("Enable/disable", new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ tabSheet.setEnabled(!tabSheet.isEnabled());
+ }
+ });
+ addComponent(tabSheet);
+ addComponent(button);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Switching the tabsheet between disabled and enabled should not change which tab is selected. Disabling the open tab should select the first enabled tab.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2658;
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java b/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java
new file mode 100644
index 0000000000..c295f1a9e5
--- /dev/null
+++ b/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java
@@ -0,0 +1,54 @@
+package com.vaadin.tests.components.tabsheet;
+
+import com.vaadin.terminal.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TextField;
+
+public class TabSheetIcons extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Tests rendering of a Tabsheet with fixed/dynamic width when the TabSheet contains icons";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+ @Override
+ protected void setup() {
+ TabSheet ts1 = createTabsheet();
+ ts1.setHeight("100px");
+ TabSheet ts2 = createTabsheet();
+ ts2.setHeight("100px");
+ ts2.setWidth("400px");
+
+ addComponent(ts1);
+ addComponent(ts2);
+ }
+
+ private TabSheet createTabsheet() {
+ TabSheet tabsheet = new TabSheet();
+ tabsheet.setSizeUndefined();
+
+ Component[] tab = new Component[3];
+ tab[0] = new Label("This is tab 1");
+ tab[0].setIcon(new ThemeResource("icons/32/folder-add.png"));
+ tab[0].setCaption("tab number 1");
+ tab[1] = new TextField("This is tab 2", "Contents of tab 2 textfield");
+ tab[2] = new Label("This is tab 3");
+ tab[2].setIcon(new ThemeResource("icons/16/folder-add.png"));
+ tab[2].setCaption("tab number 3");
+
+ for (Component c : tab) {
+ tabsheet.addTab(c);
+ }
+
+ return tabsheet;
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/tabsheet/VerticalScrollbarPosition.java b/src/com/vaadin/tests/components/tabsheet/VerticalScrollbarPosition.java
new file mode 100644
index 0000000000..a94aa1cd47
--- /dev/null
+++ b/src/com/vaadin/tests/components/tabsheet/VerticalScrollbarPosition.java
@@ -0,0 +1,40 @@
+package com.vaadin.tests.components.tabsheet;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TextField;
+
+public class VerticalScrollbarPosition extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "A vertical scrollbar in a TabSheet should always be placed at the right edge";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2473;
+ }
+
+ @Override
+ protected void setup() {
+ TabSheet tabsheet = new TabSheet();
+ tabsheet.setWidth(null);
+ tabsheet.setHeight("200px");
+ TextField tf = new TextField();
+ tf.setRows(2);
+ tf.setHeight("300px");
+ tf.setWidth("200px");
+ tabsheet
+ .addTab(
+ tf,
+ "A text field that is 200px wide, the tab bar for the tabsheet is wider",
+ null);
+ TextField tf2 = new TextField("Another tab", "b");
+ tf2.setWidth("1000px");
+ tf2.setHeight("50px");
+ tabsheet.addTab(tf2);
+ addComponent(tabsheet);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java b/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java
new file mode 100644
index 0000000000..51b6568f94
--- /dev/null
+++ b/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java
@@ -0,0 +1,33 @@
+package com.vaadin.tests.components.window;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Window;
+
+public class CenteredWindowWithUndefinedSize extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "The centered sub-window with undefined height and a 100% high layout should be rendered in the center of the screen and not in the top-left corner.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2702;
+ }
+
+ @Override
+ protected void setup() {
+ Window centered = new Window("A window");
+ centered.setSizeUndefined();
+ centered.getLayout().setSizeFull();
+ centered.center();
+
+ Label l = new Label("This window should be centered");
+ l.setSizeUndefined();
+ centered.addComponent(l);
+
+ getMainWindow().addWindow(centered);
+
+ }
+}
diff --git a/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java b/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java
new file mode 100644
index 0000000000..0c6f375645
--- /dev/null
+++ b/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java
@@ -0,0 +1,46 @@
+package com.vaadin.tests.components.window;
+
+import com.vaadin.terminal.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Embedded;
+import com.vaadin.ui.Window;
+
+public class EmbeddedInSubWindow extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected void setup() {
+ setTheme("tests-tickets");
+ Window zoom = new Window("Image Preview");
+ zoom.setSizeUndefined();
+ zoom.getLayout().setSizeUndefined();
+
+ String res = "icons/640ok.png";
+ Embedded imagePreview = new Embedded("", new ThemeResource(res));
+ imagePreview.setSizeUndefined();
+
+ zoom.addComponent(imagePreview);
+ zoom.setModal(true);
+ zoom.setResizable(false);
+
+ zoom.addListener(new Window.CloseListener() {
+ public void windowClose(Window.CloseEvent closeEvent) {
+ getMainWindow().removeWindow(closeEvent.getWindow());
+ }
+ });
+
+ getMainWindow().addWindow(zoom);
+
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java b/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
new file mode 100644
index 0000000000..859c1b4b5d
--- /dev/null
+++ b/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.window;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Window;
+
+public class TestTooSmallSubwindowSize extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "The size of the subwindow (outer size) is set to 60x60 pixels. Minimum size for the content area is 150x100, which means the window and shadow should be around 155x155 and the content area 150x100. The decoration at the lower left corner of the window must not be missing either.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2579;
+ }
+
+ @Override
+ protected void setup() {
+ Window w = new Window("Scroll");
+ Label desc = new Label(
+ "This is a new child window with a preset"
+ + " width, height and position. Resizing has been"
+ + " disabled for this window. Additionally, this text label"
+ + " is intentionally too large to fit the window. You can"
+ + " use the scrollbars to view different parts of the window content.");
+ w.addComponent(desc);
+
+ // Set window position
+ w.setPositionX(100);
+ w.setPositionY(100);
+
+ // Set window size
+ w.setWidth(60, Window.UNITS_PIXELS);
+ w.setHeight(60, Window.UNITS_PIXELS);
+
+ // Disable resizing
+ w.setResizable(true);
+
+ getMainWindow().addWindow(w);
+ }
+
+}
diff --git a/src/com/vaadin/tests/components/window/WindowResizeListener.java b/src/com/vaadin/tests/components/window/WindowResizeListener.java
new file mode 100644
index 0000000000..0ba87336f6
--- /dev/null
+++ b/src/com/vaadin/tests/components/window/WindowResizeListener.java
@@ -0,0 +1,99 @@
+package com.vaadin.tests.components.window;
+
+import com.vaadin.terminal.Sizeable;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Window.ResizeEvent;
+import com.vaadin.ui.Window.ResizeListener;
+
+public class WindowResizeListener extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Size changes from windows (both sub "
+ + "and browsers level) should get back to server."
+ + " If size changes, a separate server side event should occur.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+ Window subwin = new ResizeListenerWindow();
+
+ @Override
+ protected void setup() {
+
+ final Label l = new Label();
+ getLayout().addComponent(l);
+
+ getMainWindow().addListener(new ResizeListener() {
+ public void windowResized(ResizeEvent e) {
+ l.setValue("Current main window size: "
+ + getMainWindow().getWidth() + " x "
+ + getMainWindow().getHeight());
+ }
+ });
+
+ CheckBox subwindow = new CheckBox("show subwindow");
+ subwindow.setImmediate(true);
+ subwindow.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ if (event.getButton().booleanValue()) {
+ getMainWindow().addWindow(subwin);
+ } else {
+ getMainWindow().removeWindow(subwin);
+ }
+ }
+ });
+ getLayout().addComponent(subwindow);
+
+ CheckBox immediate = new CheckBox("immediate");
+ immediate.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ boolean booleanValue = event.getButton().booleanValue();
+ getMainWindow().setImmediate(booleanValue);
+ subwin.setImmediate(booleanValue);
+ }
+ });
+ immediate.setImmediate(true);
+ getLayout().addComponent(immediate);
+
+ getLayout().addComponent(new Button("Sync"));
+
+ }
+}
+
+class ResizeListenerWindow extends Window {
+ Label sizeLabel = new Label();
+
+ public ResizeListenerWindow() {
+ super("Subwindow");
+ setWidth("400px");
+
+ Layout hl = getLayout();
+ hl.addComponent(new Label("Current size: "));
+ hl.addComponent(sizeLabel);
+
+ addListener(new ResizeListener() {
+ public void windowResized(ResizeEvent e) {
+ updateLabel();
+ }
+ });
+
+ updateLabel();
+ }
+
+ public void updateLabel() {
+ sizeLabel
+ .setValue(getWidth() + Sizeable.UNIT_SYMBOLS[getWidthUnits()]
+ + " x " + getHeight()
+ + Sizeable.UNIT_SYMBOLS[getHeightUnits()]);
+ }
+}