1 package com.vaadin.tests.components.datefield;
3 import java.time.LocalDate;
5 import com.vaadin.tests.components.TestBase;
6 import com.vaadin.tests.components.TestDateField;
7 import com.vaadin.ui.AbstractDateField;
8 import com.vaadin.ui.Button;
9 import com.vaadin.ui.Button.ClickEvent;
11 public class WidthRecalculationOnEnableStateChange extends TestBase {
14 setTheme("reindeer-tests");
16 final AbstractDateField df = new TestDateField();
17 df.setValue(LocalDate.of(1970, 1, 15));
19 df.addStyleName("enabled-readonly-styled");
21 addComponent(new Button("Toggle disabled for date field",
22 new Button.ClickListener() {
24 public void buttonClick(ClickEvent event) {
25 df.setEnabled(!df.isEnabled());
28 addComponent(new Button("Toggle read only for date field",
29 new Button.ClickListener() {
31 public void buttonClick(ClickEvent event) {
32 df.setReadOnly(!df.isReadOnly());
38 protected String getDescription() {
39 return "Setting the disabled state doesn't recalculate the input element width. Setting the read-only state instead recalculates the width. In both cases, the popup button is hidden using CSS.<br><br>The DateField is also given a style name 'test', but that style isn't applied on the calendar popup element.";
43 protected Integer getTicketNumber() {