Package com.vaadin.ui

Examples of com.vaadin.ui.ComboBox


        recreateTable();

    }

    private ComboBox createLocaleSelect() {
        ComboBox cb = new ComboBox();
        cb.setNullSelectionAllowed(false);
        for (Locale l : Locale.getAvailableLocales()) {
            cb.addItem(l);
        }
        cb.setImmediate(true);
        cb.setValue(Locale.US);
        cb.addListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                recreateTable();
            }
View Full Code Here


        gl = new GridLayout(1, 2);
        gl.setStyleName("borders");
        getMainWindow().addComponent(gl);
        setTheme("tests-tickets");
        combo = new ComboBox("Combo caption");
        labelLong = new Label(
                "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");
        gl.addComponent(combo);
        gl.addComponent(labelLong);
View Full Code Here

        }

        private Map<Object, ComboBox> workoutIdToCombobox = new HashMap<Object, ComboBox>();

        private Field<?> getTrainingTypeComboboxFor(Object itemId) {
            ComboBox cb = workoutIdToCombobox.get(itemId);
            if (cb == null) {
                final ComboBox cb2 = new ComboBox();
                cb2.addItem("value1");
                cb2.addItem("value2");
                cb2.addItem("value3");
                cb2.addItem("value4");
                cb2.setNewItemsAllowed(true);

                workoutIdToCombobox.put(itemId, cb2);
                cb = cb2;
            }
            return cb;
View Full Code Here

        t2.setContainerDataSource(t.getContainerDataSource());

        testContainer.addComponent(t2);

        for (int i = 0; i < INITIAL_COMPONENTS; i++) {
            ComboBox cb = new ComboBox("Combobox " + i);
            for (int j = 0; j < INITIAL_COMPONENTS; j++) {
                cb.addItem("option " + i + " " + j);
            }
            testContainer.addComponent(cb);

            TextField tf = new TextField("TextField " + i);
            tf.setDescription("DESC SDKJSDF");
View Full Code Here

*/
public class TestComboBoxValueChange extends
        AbstractTestFieldValueChange<Object> {
    @Override
    protected void setUp() throws Exception {
        ComboBox combo = new ComboBox();
        combo.addItem("myvalue");
        super.setUp(combo);
    }
View Full Code Here

            myContainer.addContainerFilter(new Equal("PFX", "C"));

            VerticalLayout layout = new VerticalLayout();
            mainWindow.setContent(layout);

            final ComboBox myCombo = new ComboBox("MyCaption");
            myCombo.setDescription("Description");
            myCombo.setContainerDataSource(myContainer);
            myCombo.setItemCaptionPropertyId("MYFIELD");
            myCombo.setFilteringMode(FilteringMode.CONTAINS);
            myCombo.setImmediate(true);
            myCombo.setWidth("100.0%");
            myCombo.setHeight("-1px");
            myCombo.addValueChangeListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(ValueChangeEvent event) {
                    if (myCombo.getValue() != null) {
                        Item item = myCombo.getItem(event.getProperty()
                                .getValue());
                        String selected = item.getItemProperty("MYFIELD")
                                .getValue().toString();
                        System.out.println("Selected " + selected);
                    }
View Full Code Here

        w.center();

        VerticalLayout content = new VerticalLayout();
        w.setContent(content);
        content.setHeight("1000px");
        ComboBox cb = new ComboBox();
        cb.setId(COMBOBOX_ID);
        content.addComponent(cb);
        content.setComponentAlignment(cb, Alignment.BOTTOM_CENTER);

        addWindow(w);
View Full Code Here

        // setTheme("tests-tickets");
        createUI((AbstractOrderedLayout) w.getContent());
    }

    private void createUI(AbstractOrderedLayout layout) {
        ComboBox combo = new ComboBox("Combobox caption");
        combo.addContainerProperty("blah", String.class, "");
        combo.setItemCaptionPropertyId("blah");

        Item item;
        for (int i = 0; i < 100; i++) {
            item = combo.addItem(new Object());
            item.getItemProperty("blah").setValue("Item " + i);
        }

        layout.addComponent(combo);

        combo = new ComboBox("Combobox caption");
        combo.addContainerProperty("blah", String.class, "");
        combo.setItemCaptionPropertyId("blah");

        for (int i = 0; i < 5; i++) {
            item = combo.addItem(new Object());
            item.getItemProperty("blah").setValue("Item " + i);
        }

        layout.addComponent(combo);
    }
View Full Code Here

    @Override
    public void init() {
        setMainWindow(new LegacyWindow("Test window"));

        ComboBox combo = new ComboBox("Names",
                databaseHelper.getTestContainer());
        combo.setItemCaptionPropertyId("FIELD1");
        combo.setFilteringMode(FilteringMode.CONTAINS);
        combo.setImmediate(true);

        getMainWindow().addComponent(combo);
    }
View Full Code Here

    @Override
    public void init() {
        LegacyWindow main = new LegacyWindow();
        setMainWindow(main);

        ComboBox combobox = new ComboBox("My ComboBox");

        // Enable null selection
        combobox.setNullSelectionAllowed(true);
        // Add the item that marks 'null' value
        String nullitem = "-- none --";
        combobox.addItem(nullitem);
        // Designate it was the 'null' value marker
        combobox.setNullSelectionItemId(nullitem);

        // Add some other items
        for (int i = 0; i < 10; i++) {
            combobox.addItem("Item " + i);
        }

        main.addComponent(combobox);
    }
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.