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.

GridLayoutCellSizesUI.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package com.vaadin.tests.components.gridlayout;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.shared.ui.datefield.DateResolution;
  4. import com.vaadin.tests.components.AbstractReindeerTestUI;
  5. import com.vaadin.ui.Button;
  6. import com.vaadin.ui.GridLayout;
  7. import com.vaadin.ui.InlineDateField;
  8. import com.vaadin.ui.Label;
  9. @SuppressWarnings("serial")
  10. public class GridLayoutCellSizesUI extends AbstractReindeerTestUI {
  11. @Override
  12. protected void setup(VaadinRequest request) {
  13. // Create a 4 by 4 grid layout
  14. final GridLayout grid = new GridLayout(4, 4);
  15. // Fill out the first row using the cursor
  16. grid.addComponent(new Button("R/C 1"));
  17. for (int i = 0; i < 3; i++) {
  18. grid.addComponent(new Button("Col " + (grid.getCursorX() + 1)));
  19. }
  20. // Fill out the first column using coordinates
  21. for (int i = 1; i < 4; i++) {
  22. grid.addComponent(new Button("Row " + i), 0, i);
  23. }
  24. // Add some components of various shapes.
  25. grid.addComponent(new Button("3x1 button"), 1, 1, 3, 1);
  26. grid.addComponent(new Label("1x2 cell"), 1, 2, 1, 3);
  27. final InlineDateField date = new InlineDateField("A 2x2 date field");
  28. date.setResolution(DateResolution.DAY);
  29. grid.addComponent(date, 2, 2, 3, 3);
  30. grid.setMargin(true);
  31. grid.setSizeUndefined();
  32. addComponent(grid);
  33. }
  34. @Override
  35. protected Integer getTicketNumber() {
  36. return 17039;
  37. }
  38. @Override
  39. protected String getTestDescription() {
  40. return "Grid cells should be full size when adding borders around the cells";
  41. }
  42. }