Package com.vaadin.tests.components.optiongroup

Source Code of com.vaadin.tests.components.optiongroup.OptionGroupMultipleValueChange

package com.vaadin.tests.components.optiongroup;

import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Label;
import com.vaadin.ui.OptionGroup;

public class OptionGroupMultipleValueChange extends TestBase {

    @Override
    protected String getDescription() {
        return "Clicking on the description of an option should behave exactly like clicking on the radio button. No extra 'null' valuechange event should be sent";
    }

    @Override
    protected Integer getTicketNumber() {
        return 3066;
    }

    @Override
    protected void setup() {
        final OptionGroup og = new OptionGroup();
        og.addItem("Clicking on the text might cause an extra valuechange event");
        og.addItem("Second option, same thing");
        og.setImmediate(true);
        addComponent(og);

        final Label events = new Label("", ContentMode.PREFORMATTED);
        events.setWidth(null);
        addComponent(events);

        og.addListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                String s = "ValueChange: " + event.getProperty().getValue();
                events.setValue(events.getValue() + "\n" + s);
            }
        });
    }
}
TOP

Related Classes of com.vaadin.tests.components.optiongroup.OptionGroupMultipleValueChange

TOP
Copyright © 2018 www.massapi.com. 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.