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.

CompositeVerticalLayoutGridResize.java 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package com.vaadin.tests.components.composite;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import com.vaadin.server.VaadinRequest;
  5. import com.vaadin.tests.components.AbstractTestUI;
  6. import com.vaadin.ui.Component;
  7. import com.vaadin.ui.Composite;
  8. import com.vaadin.ui.Grid;
  9. import com.vaadin.ui.VerticalLayout;
  10. public class CompositeVerticalLayoutGridResize extends AbstractTestUI {
  11. @Override
  12. protected void setup(VaadinRequest request) {
  13. addComponent(new CompositeGrid());
  14. getLayout().setSizeFull();
  15. getLayout().getParent().setSizeFull();
  16. }
  17. public class CompositeGrid extends Composite {
  18. public CompositeGrid() {
  19. VerticalLayout root = new VerticalLayout();
  20. root.setId("root");
  21. root.setMargin(false);
  22. root.addComponentsAndExpand(buildGrid());
  23. setCompositionRoot(root);
  24. setSizeFull();
  25. }
  26. private Component buildGrid() {
  27. List<Person> persons = new ArrayList<>();
  28. for (int i = 0; i < 100; i++) {
  29. persons.add(new Person("Firstname" + i, "Lastname" + i));
  30. }
  31. Grid<Person> grid = new Grid<Person>(Person.class);
  32. grid.setItems(persons);
  33. grid.setSizeFull();
  34. return grid;
  35. }
  36. }
  37. public class Person {
  38. private String firstName, lastName;
  39. public Person(String firstName, String lastName) {
  40. this.firstName = firstName;
  41. this.lastName = lastName;
  42. }
  43. public String getLastName() {
  44. return lastName;
  45. }
  46. public void setLastName(String lastName) {
  47. this.lastName = lastName;
  48. }
  49. public String getFirstName() {
  50. return firstName;
  51. }
  52. public void setFirstName(String firstName) {
  53. this.firstName = firstName;
  54. }
  55. }
  56. @Override
  57. protected String getTestDescription() {
  58. return "Composite contents should resize without a delay when the"
  59. + " browser is resized, not only when interacted with.";
  60. }
  61. @Override
  62. protected Integer getTicketNumber() {
  63. return 12153;
  64. }
  65. }