Package com.vaadin.ui

Examples of com.vaadin.ui.ComboBox


    private static List<String> items = Arrays.asList("abc", "cde", "efg",
            "ghi", "ijk");

    @Override
    protected void setup(VaadinRequest request) {
        ComboBox cb = new ComboBox("Page length 0", items);
        cb.setPageLength(0);
        cb.setFilteringMode(FilteringMode.CONTAINS);
        addComponent(cb);

        cb = new ComboBox("Page length 2", items);
        cb.setPageLength(2);
        cb.setFilteringMode(FilteringMode.CONTAINS);
        addComponent(cb);
    }
View Full Code Here


        return 2214;
    }

    @Override
    protected void setup() {
        ComboBox cb = new ComboBox();
        for (int i = 1; i < 100; i++) {
            cb.addItem("Item " + i);
        }

        cb.setFilteringMode(FilteringMode.CONTAINS);
        addComponent(cb);

    }
View Full Code Here

        dateField.setResolution(Resolution.SECOND);

        ArrayList<String> timeZoneCodes = new ArrayList<String>();
        timeZoneCodes.add(nullValue);
        timeZoneCodes.addAll(Arrays.asList(TimeZone.getAvailableIDs()));
        ComboBox timezoneSelector = new ComboBox("Select time zone",
                timeZoneCodes) {
            @Override
            public String getItemCaption(Object itemId) {
                if (itemId == nullValue || itemId == null) {
                    TimeZone timeZone = TimeZone.getDefault();
                    return "Default time zone (" + timeZone.getDisplayName()
                            + ")";
                } else {
                    TimeZone timeZone = TimeZone.getTimeZone((String) itemId);
                    return itemId + " (" + timeZone.getDisplayName() + ")";
                }
            }
        };
        timezoneSelector.setValue("UTC");
        timezoneSelector.setImmediate(true);
        timezoneSelector.setNullSelectionAllowed(true);
        timezoneSelector.setNullSelectionItemId(nullValue);
        timezoneSelector.setFilteringMode(FilteringMode.CONTAINS);
        timezoneSelector.addListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                Object value = event.getProperty().getValue();
                TimeZone timeZone;
                if (value == nullValue || value == null) {
View Full Code Here

public class WidthToggleReadOnly extends TestBase {

    @Override
    protected void setup() {
        ComboBox combo = createNewComboBoxA("Untouched combobox");
        addComponent(combo);

        combo = createNewComboBoxA("Toggled combobox");
        addComponent(combo);
        addComponent(createReadOnlyForComboBox(combo));
View Full Code Here

        addComponent(combo);
        addComponent(createReadOnlyForComboBox(combo));
    }

    private ComboBox createNewComboBoxA(String caption) {
        ComboBox combo = new ComboBox(caption);
        combo.addItem("first");
        combo.setValue("first");

        addComponent(combo);

        return combo;
    }
View Full Code Here

        getLayout().getUI().addWindow(w);

    }

    private Component createComboBox() {
        ComboBox cb = new ComboBox("A combo box");

        cb.addItem("Yes");
        cb.addItem("No");
        cb.addItem("Maybe");
        return cb;
    }
View Full Code Here

*/
public class ComboboxStyleChangeWidth extends AbstractTestUIWithLog {

    @Override
    protected void setup(VaadinRequest request) {
        final ComboBox cbFoo = new ComboBox();
        cbFoo.setImmediate(true);
        cbFoo.setSizeUndefined();
        cbFoo.addItem("A really long string that causes an inline width to be set");

        Button btn = new Button("Click to break CB",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        cbFoo.addStyleName("foofoo");

                    }
                });

        addComponent(cbFoo);
View Full Code Here

    @Override
    protected void setup() {
        setTheme("tests-tickets");

        final ComboBox cb = new ComboBox("All errors", Arrays.asList("Error",
                "Error 2"));
        cb.setStyleName("ComboBoxBorder");
        cb.setImmediate(true);
        cb.setWidth("200px"); // must have with to reproduce

        cb.addListener(new ValueChangeListener() {
            public void valueChange(ValueChangeEvent event) {
                cb.setComponentError(new UserError("Error"));
            }
        });

        addComponent(cb);
View Full Code Here

        layout.setMargin(true);
        setContent(layout);

        final FormLayout formLayout = new FormLayout();

        final ComboBox combo = new ComboBox("Item:");
        combo.addItem("Item 1");
        combo.addItem("Item 2");
        combo.addItem("Item 3");
        combo.addItem("Item 4");
        combo.addValueChangeListener(new MyValueChangeListener());
        combo.setImmediate(true);

        Button btn1 = new Button("Click me");
        btn1.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                log.log("you clicked me");
            }
        });

        formLayout.addComponent(combo);
        formLayout.addComponent(btn1);

        layout.addComponent(formLayout);

        Button btn = new Button("Enable/Disable combobox",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        combo.setEnabled(!combo.isEnabled());
                    }
                });
        layout.addComponent(btn);
        btn = new Button("Enable/Disable parent", new Button.ClickListener() {
            @Override
View Full Code Here

        getLayout()
                .addComponent(
                        new Label(
                                "Select first ANTIGUA AND BARBUDA from the first combobox. Then select ANTIGUA AND BARBUDA from the second combobox. Finally, click the popup button on the first combobox. Before fix you would see UA AND BAR in the field."));

        ComboBox combobox = new ComboBox("Text input enabled:");
        combobox.setWidth("100px");

        combobox.addItem("AMERICAN SAMOA");
        combobox.addItem("ANTIGUA AND BARBUDA");

        ComboBox combobox2 = new ComboBox("Text input disabled:");
        combobox2.setWidth("100px");
        combobox2.setTextInputAllowed(false);

        combobox2.addItem("AMERICAN SAMOA");
        combobox2.addItem("ANTIGUA AND BARBUDA");

        getLayout().addComponent(combobox);
        getLayout().addComponent(combobox2);
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.ComboBox

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.