Package com.vaadin.ui

Examples of com.vaadin.ui.ComboBox


    protected void setup(VaadinRequest request) {
        Button addButton = new Button("Add new Window");
        addButton.addListener(addListener);
        addComponent(addButton);

        addWindowAgain = new ComboBox("Add Window Again");
        addWindowAgain.setBuffered(false);
        addWindowAgain.setImmediate(true);
        addWindowAgain.addValueChangeListener(new ValueChangeListener() {

            @Override
View Full Code Here


        gl = new VerticalLayout();
        gl.setSizeUndefined();
        gl.setStyleName("borders");
        getMainWindow().addComponent(gl);
        setTheme("tests-tickets");
        combo = new ComboBox("Combo caption");
        labelLong = new Label(
                "This should stay on one line or to wrap to multiple lines? At leas it should display all the text?. "
                        + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
                        + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
                        + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
View Full Code Here

        } else if (fieldType.isAssignableFrom(Table.class)) {
            Table t = new Table();
            t.setSelectable(true);
            select = t;
        } else {
            select = new ComboBox(null);
        }
        select.setImmediate(true);
        select.setNullSelectionAllowed(false);

        return select;
View Full Code Here

            table.addContainerProperty("combobox", TextField.class, null);
            table.addGeneratedColumn("combobox", new ColumnGenerator() {
                @Override
                public Object generateCell(Table source, Object itemId,
                        Object columnId) {
                    ComboBox tf = new ComboBox();
                    tf.setInputPrompt("Select");
                    tf.addStyleName("compact");
                    if ((Integer) itemId % 2 == 0) {
                        tf.addStyleName("borderless");
                    }
                    return tf;
                }
            });
View Full Code Here

    @Override
    public Field<?> createField(Container container, Object itemId,
            Object propertyId, Component uiContext) {
        if (propertyId.equals("text")) {
            // replace text fields with comboboxes
            final ComboBox cb = new ComboBox() {
            };
            cb.setContainerDataSource(texts);
            cb.setNewItemsAllowed(true);
            cb.setNewItemHandler(new NewItemHandler() {
                @Override
                public void addNewItem(String newItemCaption) {
                    texts.addItem(newItemCaption);
                    cb.setValue(newItemCaption);
                }
            });
            return cb;
        }
View Full Code Here

        }
        return f;
    }

    private ComboBox createStyleNameComboBox() {
        ComboBox s = new ComboBox("Calendar");
        s.addContainerProperty("c", String.class, "");
        s.setItemCaptionPropertyId("c");
        Item i = s.addItem("color1");
        i.getItemProperty("c").setValue("Work");
        i = s.addItem("color2");
        i.getItemProperty("c").setValue("Personal");
        i = s.addItem("color3");
        i.getItemProperty("c").setValue("Family");
        i = s.addItem("color4");
        i.getItemProperty("c").setValue("Hobbies");
        return s;
    }
View Full Code Here

            }
        });
    }

    private ComboBox createTimeZoneSelect() {
        ComboBox s = new ComboBox("Timezone");
        s.addContainerProperty("caption", String.class, "");
        s.setItemCaptionPropertyId("caption");
        s.setFilteringMode(FilteringMode.CONTAINS);

        Item i = s.addItem(DEFAULT_ITEMID);
        i.getItemProperty("caption").setValue(
                "Default (" + TimeZone.getDefault().getID() + ")");
        for (String id : TimeZone.getAvailableIDs()) {
            if (!s.containsId(id)) {
                i = s.addItem(id);
                i.getItemProperty("caption").setValue(id);
            }
        }

        if (testBench) {
            s.select("America/New_York");
        } else {
            s.select(DEFAULT_ITEMID);
        }
        s.setImmediate(true);
        s.addValueChangeListener(new ValueChangeListener() {

            private static final long serialVersionUID = 1L;

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

        return s;
    }

    private ComboBox createCalendarFormatSelect() {
        ComboBox s = new ComboBox("Calendar format");
        s.addContainerProperty("caption", String.class, "");
        s.setItemCaptionPropertyId("caption");

        Item i = s.addItem(DEFAULT_ITEMID);
        i.getItemProperty("caption").setValue("Default by locale");
        i = s.addItem(TimeFormat.Format12H);
        i.getItemProperty("caption").setValue("12H");
        i = s.addItem(TimeFormat.Format24H);
        i.getItemProperty("caption").setValue("24H");

        s.select(DEFAULT_ITEMID);
        s.setImmediate(true);
        s.addValueChangeListener(new ValueChangeListener() {

            private static final long serialVersionUID = 1L;

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

        return s;
    }

    private ComboBox createLocaleSelect() {
        ComboBox s = new ComboBox("Locale");
        s.addContainerProperty("caption", String.class, "");
        s.setItemCaptionPropertyId("caption");
        s.setFilteringMode(FilteringMode.CONTAINS);

        for (Locale l : Locale.getAvailableLocales()) {
            if (!s.containsId(l)) {
                Item i = s.addItem(l);
                i.getItemProperty("caption").setValue(getLocaleItemCaption(l));
            }
        }

        s.select(getLocale());
        s.setImmediate(true);
        s.addValueChangeListener(new ValueChangeListener() {

            private static final long serialVersionUID = 1L;

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

        final TextArea descriptionField = createTextArea("Description");
        descriptionField.setInputPrompt("Describe the event");
        descriptionField.setRows(3);
        // descriptionField.setRequired(true);

        final ComboBox styleNameField = createStyleNameComboBox();
        styleNameField.setInputPrompt("Choose calendar");
        styleNameField.setTextInputAllowed(false);

        formLayout.addComponent(startDateField);
        // startDateField.setRequired(true);
        formLayout.addComponent(endDateField);
        formLayout.addComponent(allDayField);
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.