Package com.vaadin.ui

Examples of com.vaadin.ui.ComboBox


    protected Integer getTicketNumber() {
        return 11333;
    }

    private void addComboBox(AbstractLayout layout) {
        ComboBox box = new ComboBox();
        for (int i = 0; i < 100; i++) {
            box.addItem("item " + i);
        }
        box.setPageLength(10);
        box.setNullSelectionAllowed(false);
        layout.addComponent(box);
    }
View Full Code Here


    protected void setup() {
        final TextArea addedItems = new TextArea("Last added items:");
        addedItems.setRows(10);
        addComponent(addedItems);

        final ComboBox box = new ComboBox("New items are allowed");
        box.setNewItemsAllowed(true);
        box.setNewItemHandler(new NewItemHandler() {
            @Override
            public void addNewItem(String newItemCaption) {
                String value = addedItems.getValue();
                addedItems.setValue(value + newItemCaption + "\n");
                box.addItem(newItemCaption);
            }
        });
        box.setImmediate(true);
        addComponent(box);
    }
View Full Code Here

        layout.setSpacing(true);
        ArrayList<String> options = new ArrayList<String>();
        options.add("1");
        options.add("2");
        options.add("3");
        ComboBox combo = new ComboBox(null, options);
        layout.addComponent(combo);

        MenuBar menubar = getMenubar();
        layout.addComponent(menubar);
View Full Code Here

    }

    @Override
    protected void setup() {
        {
            ComboBox cb = new ComboBox();
            cb.addContainerProperty("icon", Resource.class, null);
            cb.setItemIconPropertyId("icon");

            Item item = cb.addItem("FI");
            item.getItemProperty("icon").setValue(
                    new ThemeResource("../tests-tickets/icons/fi.gif"));
            item = cb.addItem("SE");
            item.getItemProperty("icon").setValue(
                    new ThemeResource("../tests-tickets/icons/se.gif"));

            addComponent(cb);
        }
        {
            ComboBox cb = new ComboBox();
            cb.addContainerProperty("icon", Resource.class, null);
            cb.setItemIconPropertyId("icon");

            Item item = cb.addItem("Finland");
            item.getItemProperty("icon").setValue(
                    new ThemeResource("../tests-tickets/icons/fi.gif"));
            item = cb.addItem("Australia");
            item.getItemProperty("icon").setValue(
                    new ThemeResource("../tests-tickets/icons/au.gif"));
            item = cb.addItem("Hungary");
            item.getItemProperty("icon").setValue(
                    new ThemeResource("../tests-tickets/icons/hu.gif"));

            cb.setValue("Hungary");
            addComponent(cb);
        }
    }
View Full Code Here

        lo.setExpandRatio(t, 1.0F);
        addComponent(lo);
    }

    private Component createComponent(int x, int y) {
        ComboBox box = new ComboBox();
        // box.setMultiSelect(true);
        box.addContainerProperty("name", String.class, "");
        box.setItemCaptionPropertyId("name");
        for (int ix = 0; ix < 20; ix++) {
            box.addItem(x + 20 * y + ix).getItemProperty("name")
                    .setValue("" + x + ", " + y + " " + ix);
        }
        box.setValue(x + 20 * y);
        return box;
    }
View Full Code Here

        // popupDateField.setTextFieldEnabled(false);
        // components.add(popupDateField);

        components.add(new CheckBox("Default CheckBox"));

        ComboBox comboBox = new ComboBox("Default ComboBox");
        comboBox.addItem("Item1");
        components.add(comboBox);

        OptionGroup radioGroup = new OptionGroup("Single Items");
        radioGroup.addItem("Single Item 1");
        radioGroup.addItem("Single Item 2");
View Full Code Here

public class ComboBoxSetNullWhenNewItemsAllowed extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        final ComboBox comboBox = new ComboBox("My ComboBox");
        comboBox.setImmediate(true);
        comboBox.setNullSelectionAllowed(false);
        comboBox.setNewItemsAllowed(true);
        for (int i = 0; i < 10; i++) {
            comboBox.addItem("Item " + i);
        }

        final Label value = new Label("Selected: ");

        comboBox.addValueChangeListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (comboBox.getValue() != null) {
                    comboBox.setValue(null);
                    value.setValue("Selected: " + (String) comboBox.getValue());
                }
            }
        });
        addComponent(comboBox);
        addComponent(value);
View Full Code Here

        // Create the placeholders for all the components in the top area
        HorizontalLayout playback = new HorizontalLayout();
        HorizontalLayout volume = new HorizontalLayout();
        HorizontalLayout status = new HorizontalLayout();
        HorizontalLayout viewmodes = new HorizontalLayout();
        ComboBox search = new ComboBox();

        // Add the components and align them properly
        top.addComponent(playback);
        top.addComponent(volume);
        top.addComponent(status);
View Full Code Here

    protected void setup(VaadinRequest request) {
        final List<String> items = new ArrayList<String>();
        items.add("A");
        items.add("B");
        items.add("C");
        final ComboBox combo = new ComboBox();
        combo.setImmediate(true);
        combo.setItemIcon(items.get(0), FontAwesome.ALIGN_CENTER);
        combo.setItemIcon(items.get(1), FontAwesome.ALIGN_CENTER);
        combo.setItemIcon(items.get(2), FontAwesome.ALIGN_CENTER);
        combo.addItems(items);
        combo.setTextInputAllowed(false);
        addComponent(combo);
    }
View Full Code Here

        addComponent(createComboBox("Do not touch this"));
        addComponent(createComboBox("Browse this (check that width does not change)"));
    }

    private ComboBox createComboBox(String caption) {
        ComboBox cb = new ComboBox(caption);
        cb.addContainerProperty("caption", String.class, null);
        cb.addContainerProperty("icon", Resource.class, null);
        for (int i = 1; i < 200 + 1; i++) {
            Item item = cb.addItem(i);
            item.getItemProperty("caption").setValue("Item " + i);
            item.getItemProperty("icon").setValue(
                    new ThemeResource("../runo/icons/16/users.png"));
        }
        cb.setItemIconPropertyId("icon");
        cb.setItemCaptionPropertyId("caption");
        return cb;
    }
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.