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.

DateFieldTextEnabled.java 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.vaadin.tests.components.datefield;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.CheckBox;
  4. import com.vaadin.ui.DateField;
  5. public class DateFieldTextEnabled extends TestBase {
  6. private static final String ENABLED = "DateField text box enabled";
  7. private static final String DISABLED = "DateField text box disabled";
  8. @Override
  9. public void setup() {
  10. final DateField field = new DateField();
  11. final CheckBox box = new CheckBox(ENABLED, true);
  12. box.addValueChangeListener(event -> {
  13. field.setTextFieldEnabled(event.getValue());
  14. if (field.isTextFieldEnabled()) {
  15. box.setCaption(ENABLED);
  16. } else {
  17. box.setCaption(DISABLED);
  18. }
  19. });
  20. addComponent(box);
  21. addComponent(field);
  22. }
  23. @Override
  24. protected String getDescription() {
  25. return "tests whether or not enabling text field in the component works";
  26. }
  27. @Override
  28. protected Integer getTicketNumber() {
  29. return 6790;
  30. }
  31. }