Package com.vaadin.ui

Examples of com.vaadin.ui.NativeSelect


        AbstractSelect select;
        if (fieldType.isAssignableFrom(ListSelect.class)) {
            select = new ListSelect();
            select.setMultiSelect(false);
        } else if (fieldType.isAssignableFrom(NativeSelect.class)) {
            select = new NativeSelect();
        } else if (fieldType.isAssignableFrom(OptionGroup.class)) {
            select = new OptionGroup();
            select.setMultiSelect(false);
        } else if (fieldType.isAssignableFrom(Table.class)) {
            Table t = new Table();
View Full Code Here


        return menu;
    }

    private Component createThemeSelect() {
        final NativeSelect ns = new NativeSelect();
        ns.setNullSelectionAllowed(false);
        ns.setId("themeSelect");
        ns.addContainerProperty("caption", String.class, "");
        ns.setItemCaptionPropertyId("caption");
        for (String identifier : themeVariants.keySet()) {
            ns.addItem(identifier).getItemProperty("caption")
                    .setValue(themeVariants.get(identifier));
        }

        ns.setValue("tests-valo");
        ns.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                setTheme((String) ns.getValue());
            }
        });
        return ns;
    }
View Full Code Here

        HorizontalLayout row = new HorizontalLayout();
        row.addStyleName("wrapping");
        row.setSpacing(true);
        addComponent(row);

        NativeSelect select = new NativeSelect("Drop Down Select");
        row.addComponent(select);

        ListSelect list = new ListSelect("List Select");
        list.setNewItemsAllowed(true);
        row.addComponent(list);

        TwinColSelect tcs = new TwinColSelect("TwinCol Select");
        tcs.setLeftColumnCaption("Left Column");
        tcs.setRightColumnCaption("Right Column");
        tcs.setNewItemsAllowed(true);
        row.addComponent(tcs);

        TwinColSelect tcs2 = new TwinColSelect("Sized TwinCol Select");
        tcs2.setLeftColumnCaption("Left Column");
        tcs2.setRightColumnCaption("Right Column");
        tcs2.setNewItemsAllowed(true);
        tcs2.setWidth("280px");
        tcs2.setHeight("200px");
        row.addComponent(tcs2);

        for (int i = 1; i <= 10; i++) {
            select.addItem("Option " + i);
            list.addItem("Option " + i);
            tcs.addItem("Option " + i);
            tcs2.addItem("Option " + i);
        }
    }
View Full Code Here

                        tbl.setSizeUndefined();
                        log.log("Size undefined");
                    }
                }));

        NativeSelect pageLength = new NativeSelect("PageLength", Arrays.asList(
                0, 1, 2, 4, 8, 10));
        pageLength.setImmediate(true);
        pageLength.setNullSelectionAllowed(false);
        pageLength.addListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                int pageLength = Integer.valueOf(event.getProperty().getValue()
                        .toString());
                tbl.setPageLength(pageLength);
View Full Code Here

        layout.addComponent(createSelect(
                new ListSelect("List Select, enabled"), true));
        layout.addComponent(createSelect(
                new ListSelect("List Select, disabled"), false));

        layout.addComponent(createSelect(new NativeSelect(
                "Native Select, enabled"), true));
        layout.addComponent(createSelect(new NativeSelect(
                "Native Select, disabled"), false));

        layout.addComponent(createSelect(new OptionGroup(
                "Option Group, enabled"), true));
        layout.addComponent(createSelect(new OptionGroup(
View Full Code Here

    }

    @Override
    protected void setup(VaadinRequest request) {
        final NativeSelect localeSelect = new NativeSelect("UI locale");
        localeSelect.setImmediate(true);
        localeSelect.addItem(new Locale("en", "US"));
        localeSelect.addItem(new Locale("fi", "FI"));
        localeSelect.addItem(Locale.GERMANY);
        localeSelect.addValueChangeListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                setLocale((Locale) localeSelect.getValue());
                getSession().getService().setSystemMessagesProvider(
                        new SystemMessagesProvider() {

                            @Override
                            public SystemMessages getSystemMessages(
                                    SystemMessagesInfo systemMessagesInfo) {
                                CustomizedSystemMessages csm = new CustomizedSystemMessages();
                                // csm.setInternalErrorCaption("Request query string: "
                                // + ((VaadinServletRequest) systemMessagesInfo
                                // .getRequest()).getQueryString());
                                csm.setInternalErrorMessage("MessagesInfo locale: "
                                        + systemMessagesInfo.getLocale());
                                return csm;

                            }
                        });
            }
        });
        localeSelect.setValue(new Locale("fi", "FI"));
        addComponent(localeSelect);
        final MyButton failButton = new MyButton();
        failButton.setCaption("Generate server side error");
        failButton.addClickListener(new ClickListener() {
View Full Code Here

        final ComboBox combobox = new ComboBox("Combobox");
        combobox.setEnabled(false);
        layout.addComponent(combobox);

        final NativeSelect nativeSelect = new NativeSelect("NativeSelect");
        nativeSelect.setEnabled(false);
        layout.addComponent(nativeSelect);

        final CheckBox checkBox = new CheckBox("Checkbox");
        checkBox.setEnabled(false);
        layout.addComponent(checkBox);

        layout.addComponent(new Button("Toggle components enabled",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        combobox.setEnabled(!combobox.isEnabled());
                        textField.setEnabled(!textField.isEnabled());
                        checkBox.setEnabled(!checkBox.isEnabled());
                        nativeSelect.setEnabled(!nativeSelect.isEnabled());
                    }
                }));
        return layout;
    }
View Full Code Here

    }

    @Override
    protected void initializeComponents() {

        NativeSelect s;

        s = createNativeSelect(null);
        s.setWidth(null);
        addTestComponent(s);

        s = createNativeSelect("Undefined wide, empty select");
        s.setWidth(null);
        addTestComponent(s);

        s = createNativeSelect("Undefined wide select with 5 items");
        s.setWidth(null);
        addItem(s, "The first item");
        addItem(s, "The second item");
        addItem(s, "The third item");
        addItem(s, "The fourth item");
        addItem(s, "The fifth item");
        addTestComponent(s);

        s = createNativeSelect("Undefined wide select with 50 items");
        s.setWidth(null);
        populate(s, 50);
        addTestComponent(s);

        s = createNativeSelect(null);
        s.setWidth("100px");
        addTestComponent(s);

        s = createNativeSelect("100px wide, empty select");
        s.setWidth("100px");
        addTestComponent(s);

        s = createNativeSelect("150px wide select with 5 items");
        s.setWidth("150px");
        addItem(s, "The first item");
        addItem(s, "The second item");
        addItem(s, "The third item");
        addItem(s, "The fourth item");
        addItem(s, "The fifth item");
        addTestComponent(s);

        s = createNativeSelect("200px wide select with 50 items");
        s.setWidth("200px");
        populate(s, 50);
        addTestComponent(s);

    }
View Full Code Here

        s.getItem(id).getItemProperty(CAPTION).setValue(string);

    }

    private NativeSelect createNativeSelect(String caption) {
        NativeSelect s = new NativeSelect();

        s.addContainerProperty(CAPTION, String.class, "");
        s.setItemCaptionPropertyId(CAPTION);
        s.setCaption(caption);
        s.setNullSelectionAllowed(false);
        return s;
    }
View Full Code Here

public class ModalWindowNativeSelect extends TestBase {

    @Override
    protected void setup() {
        NativeSelect ns = new NativeSelect();

        Window modalWindow = new Window();
        modalWindow.setModal(true);
        modalWindow.center();
View Full Code Here

TOP

Related Classes of com.vaadin.ui.NativeSelect

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.