Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

PopupDateFieldExtendedRange.java 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package com.vaadin.tests.components.datefield;
  2. import java.time.LocalDate;
  3. import java.util.Locale;
  4. import java.util.stream.Stream;
  5. import com.vaadin.server.VaadinRequest;
  6. import com.vaadin.shared.ui.datefield.DateResolution;
  7. import com.vaadin.tests.components.AbstractReindeerTestUI;
  8. import com.vaadin.ui.Button;
  9. import com.vaadin.ui.DateField;
  10. @SuppressWarnings("serial")
  11. public class PopupDateFieldExtendedRange extends AbstractReindeerTestUI {
  12. @Override
  13. protected void setup(VaadinRequest request) {
  14. getLayout().setSpacing(true);
  15. final DateField[] fields = new DateField[3];
  16. fields[0] = makeDateField();
  17. fields[0].setLocale(new Locale("fi", "FI"));
  18. fields[0].setCaption("Finnish locale");
  19. fields[1] = makeDateField();
  20. fields[1].setLocale(new Locale("en", "US"));
  21. fields[1].setCaption("US English locale");
  22. fields[2] = makeDateField();
  23. fields[2].setLocale(new Locale("fi", "FI"));
  24. fields[2].setShowISOWeekNumbers(true);
  25. fields[2].setCaption("Finnish locale with week numbers");
  26. for (DateField f : fields) {
  27. addComponent(f);
  28. }
  29. addComponent(new Button("Change date", event -> Stream.of(fields)
  30. .forEach(field -> field.setValue(LocalDate.of(2010, 2, 16)))));
  31. }
  32. @Override
  33. protected String getTestDescription() {
  34. return "Show a few days of the preceding and following months in the datefield popup";
  35. }
  36. @Override
  37. protected Integer getTicketNumber() {
  38. return 6718;
  39. }
  40. private DateField makeDateField() {
  41. DateField pdf = new DateField();
  42. pdf.setResolution(DateResolution.DAY);
  43. pdf.setValue(LocalDate.of(2011, 1, 1));
  44. return pdf;
  45. }
  46. }