You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OptionGroupMultipleValueChange.java 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.vaadin.tests.components.optiongroup;
  2. import com.vaadin.shared.ui.ContentMode;
  3. import com.vaadin.tests.components.TestBase;
  4. import com.vaadin.ui.Label;
  5. import com.vaadin.v7.data.Property;
  6. import com.vaadin.v7.data.Property.ValueChangeEvent;
  7. import com.vaadin.v7.ui.OptionGroup;
  8. public class OptionGroupMultipleValueChange extends TestBase {
  9. @Override
  10. protected String getDescription() {
  11. 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";
  12. }
  13. @Override
  14. protected Integer getTicketNumber() {
  15. return 3066;
  16. }
  17. @Override
  18. protected void setup() {
  19. final OptionGroup og = new OptionGroup();
  20. og.addItem(
  21. "Clicking on the text might cause an extra valuechange event");
  22. og.addItem("Second option, same thing");
  23. og.setImmediate(true);
  24. addComponent(og);
  25. final Label events = new Label("", ContentMode.PREFORMATTED);
  26. events.setWidth(null);
  27. addComponent(events);
  28. og.addListener(new Property.ValueChangeListener() {
  29. @Override
  30. public void valueChange(ValueChangeEvent event) {
  31. String s = "ValueChange: " + event.getProperty().getValue();
  32. events.setValue(events.getValue() + "\n" + s);
  33. }
  34. });
  35. }
  36. }