Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

RadioButtonGroupDisablingAndReadOnly.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. package com.vaadin.tests.components.radiobuttongroup;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.tests.components.AbstractTestUI;
  4. import com.vaadin.ui.Button;
  5. import com.vaadin.ui.RadioButtonGroup;
  6. public class RadioButtonGroupDisablingAndReadOnly extends AbstractTestUI {
  7. @Override
  8. protected void setup(VaadinRequest request) {
  9. RadioButtonGroup<String> group = new RadioButtonGroup<>();
  10. group.setEnabled(false);
  11. group.setReadOnly(true);
  12. group.setItems("a", "b", "c");
  13. addComponent(group);
  14. addComponent(new Button("Toggle enabled", e -> {
  15. group.setEnabled(!group.isEnabled());
  16. }));
  17. addComponent(new Button("Toggle readOnly", e -> {
  18. group.setReadOnly(!group.isReadOnly());
  19. }));
  20. addComponent(new Button("Clear selection", e -> {
  21. group.setValue(null);
  22. }));
  23. }
  24. @Override
  25. protected String getTestDescription() {
  26. return "Options should only be selectable when the group is "
  27. + "neither disabled nor readOnly";
  28. }
  29. }