Package com.vaadin.ui

Examples of com.vaadin.ui.ComboBox


    private void createUI(AbstractOrderedLayout layout) {

        VerticalLayout ol = new VerticalLayout();
        ol.setWidth(null);

        ComboBox cb = new ComboBox("Asiakas");
        cb.setWidth("100%");

        Button b = new Button("View CSV-tiedostoon");

        ol.addComponent(cb);
        ol.addComponent(b);
View Full Code Here


        addComponent(role);

        tf = new TextArea("Text", "Hello world");
        tf.setRows(10);
        addComponent(tf);
        type = new ComboBox();
        type.setNullSelectionAllowed(false);
        type.addContainerProperty(CAPTION, String.class, "");

        type.setItemCaptionPropertyId(CAPTION);
View Full Code Here

public class InsertComponentInHorizontalLayout extends AbstractTestUI {
    private VerticalLayout layout;
    int added = 1;

    private Component getTestLayout() {
        ComboBox a = new ComboBox("initial");
        Button b = new Button("x", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                layout.markAsDirty();
            }
        });
        final HorizontalLayout hl = new HorizontalLayout(a, b);
        hl.setSpacing(true);
        Button add = new Button(
                "Insert 2 comboboxes between combobox(es) and button 'x'");
        add.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                hl.addComponent(new ComboBox("Added " + added++), 1);
                hl.addComponent(new ComboBox("Added " + added++), 2);
            }
        });
        layout = new VerticalLayout(hl, add);
        return layout;
    }
View Full Code Here

                    tf.setCaption(DefaultFieldFactory
                            .createCaptionByPropertyId(propertyId));
                    tf.setWidth("3em");
                    c = tf;
                } else if ("city".equals(propertyId)) {
                    ComboBox cb = new ComboBox();
                    cb.setNullSelectionAllowed(false);
                    cb.addItem("Turku");
                    cb.addItem("New York");
                    cb.addItem("Moscow");
                    cb.setCaption(DefaultFieldFactory
                            .createCaptionByPropertyId(propertyId));
                    c = cb;
                    c.setWidth("200px");
                }
View Full Code Here

        Button button = new Button("Click Me");
        button.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                final FormLayout content = new FormLayout();
                ComboBox cb = new ComboBox();
                cb.addItem("foo");
                cb.addItem("bar");
                content.addComponent(cb);
                window.setContent(content);
                window.setCloseShortcut(KeyCode.ESCAPE);
                UI.getCurrent().addWindow(window);
            }
View Full Code Here

        return "Testcase for ComboBox. Test especially edge values(of page changes) when selecting items with keyboard only.";
    }

    @Override
    protected void setup() {
        ComboBox select = new ComboBox("");
        select.setImmediate(true);
        for (int i = 0; i < 100; i++) {
            select.addItem("item " + i);
        }

        final Label value = new Label();

        select.addListener(new ComboBox.ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                System.err
                        .println("Selected " + event.getProperty().getValue());
View Full Code Here

import com.vaadin.ui.ComboBox;

public class ComboBoxUndefinedWidthAndIcon extends TestBase {
    @Override
    protected void setup() {
        ComboBox cb = new ComboBox();
        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");

        addComponent(cb);
    }
View Full Code Here

        List<String> list = new ArrayList<String>();
        for (int i = 0; i < 100; i++) {
            list.add("Item " + i);
        }

        final ComboBox cb = new ComboBox("Combobox", list);
        cb.setImmediate(true);
        cb.setInputPrompt("Enter text");
        cb.setDescription("Some Combobox");
        addComponent(cb);

        final ObjectProperty<String> log = new ObjectProperty<String>("");

        cb.addListener(new FieldEvents.FocusListener() {
            @Override
            public void focus(FocusEvent event) {
                log.setValue(log.getValue().toString() + "<br>" + counter
                        + ": Focus event!");
                counter++;
                changeValue(cb);
            }
        });

        cb.addListener(new FieldEvents.BlurListener() {
            @Override
            public void blur(BlurEvent event) {
                log.setValue(log.getValue().toString() + "<br>" + counter
                        + ": Blur event!");
                counter++;
View Full Code Here

        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        layout.setSizeUndefined();
        popup.setContent(layout);

        ComboBox comboBox = new ComboBox("Combo box", Arrays.asList("Option 1",
                "Option 2", "Option 3"));
        comboBox.addListener(new FieldEvents.FocusListener() {
            @Override
            public void focus(FocusEvent event) {
                popup.close();
            }
        });
View Full Code Here

    protected static final String ITEM_NAME_TEMPLATE = "Item %d";

    @Override
    protected void setup(VaadinRequest request) {
        Label value = getLabel();
        ComboBox combobox = getComboBox(value);

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