1 package com.vaadin.tests.components.combobox;
3 import com.vaadin.server.VaadinRequest;
4 import com.vaadin.tests.components.AbstractTestUI;
5 import com.vaadin.ui.Label;
6 import com.vaadin.v7.data.Property.ValueChangeEvent;
7 import com.vaadin.v7.data.Property.ValueChangeListener;
8 import com.vaadin.v7.ui.ComboBox;
10 @SuppressWarnings("serial")
11 public class ComboSelectedValueBeyondTheFirstDropdownPage
12 extends AbstractTestUI {
14 protected static final int ITEM_COUNT = 21;
15 protected static final String ITEM_NAME_TEMPLATE = "Item %d";
18 protected void setup(VaadinRequest request) {
19 Label value = getLabel();
20 ComboBox combobox = getComboBox(value);
22 addComponent(combobox);
26 private Label getLabel() {
27 final Label value = new Label();
33 private ComboBox getComboBox(final Label value) {
34 final ComboBox combobox = new ComboBox("MyCaption");
35 combobox.setDescription(
36 "ComboBox with more than 10 elements in it's dropdown list.");
38 combobox.setImmediate(true);
40 for (int i = 1; i <= ITEM_COUNT; i++) {
41 combobox.addItem(String.format(ITEM_NAME_TEMPLATE, i));
44 combobox.addValueChangeListener(new ValueChangeListener() {
46 public void valueChange(ValueChangeEvent event) {
47 value.setValue(String.valueOf(event.getProperty().getValue()));
55 protected String getTestDescription() {
56 return "Test for ensuring that ComboBox shows selected value beyound the first dropdown page";
60 protected Integer getTicketNumber() {