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.

GridScrollOuterLayoutAfterContents.java 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package com.vaadin.tests.components.grid;
  2. import java.util.stream.IntStream;
  3. import com.vaadin.annotations.Widgetset;
  4. import com.vaadin.server.VaadinRequest;
  5. import com.vaadin.shared.ui.grid.HeightMode;
  6. import com.vaadin.tests.components.AbstractTestUI;
  7. import com.vaadin.ui.Grid;
  8. import com.vaadin.ui.Panel;
  9. import com.vaadin.ui.TextArea;
  10. import com.vaadin.ui.VerticalLayout;
  11. @Widgetset("com.vaadin.DefaultWidgetSet")
  12. public class GridScrollOuterLayoutAfterContents extends AbstractTestUI {
  13. @Override
  14. protected void setup(VaadinRequest request) {
  15. Grid<Integer> grid = new Grid<>();
  16. // create column and fill rows
  17. grid.addColumn(item -> "name" + item).setCaption("Name");
  18. grid.addColumn(item -> "content" + item).setCaption("Content");
  19. grid.setItems(IntStream.range(1, 21).boxed());
  20. // set height mode and height
  21. grid.setHeightMode(HeightMode.ROW);
  22. grid.setHeightByRows(10);
  23. VerticalLayout layout = new VerticalLayout(grid, new TextArea());
  24. layout.setSpacing(true);
  25. layout.setMargin(false);
  26. layout.setSizeUndefined();
  27. Panel panel = new Panel();
  28. panel.setContent(layout);
  29. panel.setHeight("200px");
  30. panel.setWidthUndefined();
  31. addComponent(panel);
  32. }
  33. @Override
  34. protected String getTestDescription() {
  35. return "Should be possible to scroll to the TextArea underneath the Grid even on mobile";
  36. }
  37. @Override
  38. protected Integer getTicketNumber() {
  39. return 9477;
  40. }
  41. }