Package com.vaadin.ui

Examples of com.vaadin.ui.OptionGroup


            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();
            t.setSelectable(true);
            select = t;
View Full Code Here


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

        OptionGroup options = new OptionGroup("Choose one, explicit width");
        options.setWidth("200px");
        options.addItem("Option One");
        Item two = options
                .addItem("Option Two, with a longer caption that should wrap when the components width is explicitly set.");
        options.addItem("Option Three");
        options.select("Option One");
        options.setItemIcon("Option One", testIcon.get());
        options.setItemIcon(two, testIcon.get());
        options.setItemIcon("Option Three", testIcon.get(true));
        row.addComponent(options);

        options = new OptionGroup("Choose many, explicit width");
        options.setMultiSelect(true);
        options.setWidth("200px");
        options.addItem("Option One");
        two = options
                .addItem("Option Two, with a longer caption that should wrap when the components width is explicitly set.");
        options.addItem("Option Three");
        options.select("Option One");
        options.setItemIcon("Option One", testIcon.get());
        options.setItemIcon(two, testIcon.get());
        options.setItemIcon("Option Three", testIcon.get(true));
        row.addComponent(options);

        options = new OptionGroup("Choose one, small");
        options.addStyleName("small");
        options.setMultiSelect(false);
        options.addItem("Option One");
        options.addItem("Option Two");
        options.addItem("Option Three");
        options.select("Option One");
        options.setItemIcon("Option One", testIcon.get());
        options.setItemIcon("Option Two", testIcon.get());
        options.setItemIcon("Option Three", testIcon.get(true));
        row.addComponent(options);

        options = new OptionGroup("Choose many, small");
        options.addStyleName("small");
        options.setMultiSelect(true);
        options.addItem("Option One");
        options.addItem("Option Two");
        options.addItem("Option Three");
        options.select("Option One");
        options.setItemIcon("Option One", testIcon.get());
        options.setItemIcon("Option Two", testIcon.get());
        options.setItemIcon("Option Three", testIcon.get(true));
        row.addComponent(options);

        options = new OptionGroup("Choose one, large");
        options.addStyleName("large");
        options.setMultiSelect(false);
        options.addItem("Option One");
        options.addItem("Option Two");
        options.addItem("Option Three");
        options.select("Option One");
        options.setItemIcon("Option One", testIcon.get());
        options.setItemIcon("Option Two", testIcon.get());
        options.setItemIcon("Option Three", testIcon.get(true));
        row.addComponent(options);

        options = new OptionGroup("Choose many, large");
        options.addStyleName("large");
        options.setMultiSelect(true);
        options.addItem("Option One");
        options.addItem("Option Two");
        options.addItem("Option Three");
        options.select("Option One");
        options.setItemIcon("Option One", testIcon.get());
        options.setItemIcon("Option Two", testIcon.get());
        options.setItemIcon("Option Three", testIcon.get(true));
        row.addComponent(options);

        options = new OptionGroup("Horizontal items");
        options.addStyleName("horizontal");
        options.addItem("Option One");
        two = options.addItem("Option Two, with a longer caption");
        options.addItem("Option Three");
        options.select("Option One");
        options.setItemIcon("Option One", testIcon.get());
        options.setItemIcon(two, testIcon.get());
        options.setItemIcon("Option Three", testIcon.get());
        row.addComponent(options);

        options = new OptionGroup("Horizontal items, explicit width");
        options.setMultiSelect(true);
        options.setWidth("500px");
        options.addStyleName("horizontal");
        options.addItem("Option One");
        two = options.addItem("Option Two, with a longer caption");
        options.addItem("Option Three");
        options.select("Option One");
        options.setItemIcon("Option One", testIcon.get());
        options.setItemIcon(two, testIcon.get());
        options.setItemIcon("Option Three", testIcon.get());
        row.addComponent(options);
    }
View Full Code Here

            table.addContainerProperty("optiongroup", TextField.class, null);
            table.addGeneratedColumn("optiongroup", new ColumnGenerator() {
                @Override
                public Object generateCell(Table source, Object itemId,
                        Object columnId) {
                    OptionGroup op = new OptionGroup();
                    op.addItem("Male");
                    op.addItem("Female");
                    op.addStyleName("horizontal");
                    return op;
                }
            });

            table.addContainerProperty("slider", TextField.class, null);
View Full Code Here

                        if (asModal.getValue().booleanValue()) {
                            w.setModal(true);
                        }

                        AbstractSelect s1 = new OptionGroup();
                        s1.setCaption("1. Select output format");
                        s1.addItem("Excel sheet");
                        s1.addItem("CSV plain text");
                        s1.setValue("Excel sheet");
                        s1.setImmediate(true);

                        s2 = new Select();
                        s2.addItem("Separate by comma (,)");
                        s2.addItem("Separate by colon (:)");
                        s2.addItem("Separate by semicolon (;)");
                        s2.setEnabled(false);

                        s1.addListener(new ValueChangeListener() {

                            @Override
                            public void valueChange(ValueChangeEvent event) {
                                String v = (String) event.getProperty()
                                        .getValue();
View Full Code Here

        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(
                "Option Group, disabled"), false));

        layout.addComponent(createSelect(new TwinColSelect(
                "Twin Column Select, enabled"), true));
        layout.addComponent(createSelect(new TwinColSelect(
View Full Code Here

*/
public class OptionGroupRetainFocusKeyboardValueChange extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        final OptionGroup optiongroup = new OptionGroup();
        optiongroup.addItem(1);
        optiongroup.addItem(2);
        optiongroup.addItem(3);
        optiongroup.setItemCaption(1, "A");
        optiongroup.setItemCaption(2, "B");
        optiongroup.setItemCaption(3, "C");
        optiongroup.setImmediate(true);

        optiongroup.addValueChangeListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                if (optiongroup.isSelected(2)) {
                    optiongroup.setItemCaption(1, "A+");
                } else if (optiongroup.isSelected(3)) {
                    optiongroup.removeItem(2);
                    optiongroup.addItem(2);
                    optiongroup.setItemCaption(2, "B");
                }
            }
        });

        addComponent(optiongroup);

        optiongroup.focus();
    }
View Full Code Here

    }

    @Override
    protected void initializeComponents() {

        OptionGroup og = createOptionGroup("");
        og.setItemEnabled("Helsinki", false);
        og.setItemEnabled("Paris", false);
        og.setValue(Arrays.asList("Helsinki"));
        og.setNullSelectionAllowed(true);
        og.setNullSelectionItemId(NULL_SELECTION_ID);
        addTestComponent(og);

        og = createOptionGroup("");
        og.setMultiSelect(true);
        og.setValue(Arrays.asList("Helsinki"));
        og.setNullSelectionAllowed(true);
        og.setItemEnabled("Helsinki", false);
        og.setItemEnabled("Paris", false);
        addTestComponent(og);

    }
View Full Code Here

                    }
                });
    }

    private OptionGroup createOptionGroup(String caption) {
        OptionGroup og = new OptionGroup(caption, cities);
        og.setImmediate(true);
        return og;
    }
View Full Code Here

*/
public class ReadOnlyOptionGroup extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        final OptionGroup optionGroup = new OptionGroup("test field",
                Collections.singletonList("Option"));
        optionGroup.setNewItemsAllowed(true);

        final CheckBox readOnlyCheckbox = new CheckBox("read-only");
        readOnlyCheckbox.setImmediate(true);
        readOnlyCheckbox
                .addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(Property.ValueChangeEvent event) {
                        optionGroup.setReadOnly(readOnlyCheckbox.getValue());
                    }
                });
        readOnlyCheckbox.setValue(Boolean.TRUE);

        addComponent(optionGroup);
View Full Code Here

    }

    @Override
    protected void initializeComponents() {

        OptionGroup og = createOptionGroup("");
        og.setItemEnabled(cities.get(2), false);
        og.setItemEnabled(cities.get(5), false);
        og.setValue(Arrays.asList(cities.get(2)));
        og.setNullSelectionAllowed(true);
        og.setNullSelectionItemId(NULL_SELECTION_ID);
        addTestComponent(og);

        og = createOptionGroup("");
        og.setMultiSelect(true);
        og.setHtmlContentAllowed(true);
        og.setValue(Arrays.asList(cities.get(2)));
        og.setNullSelectionAllowed(true);
        og.setItemEnabled(cities.get(2), false);
        og.setItemEnabled(cities.get(5), false);
        addTestComponent(og);

    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.OptionGroup

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.