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.

GridLayoutFractionalSizeAndAlignment.java 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package com.vaadin.tests.components.gridlayout;
  2. import com.vaadin.annotations.Widgetset;
  3. import com.vaadin.server.VaadinRequest;
  4. import com.vaadin.tests.components.AbstractReindeerTestUIWithLog;
  5. import com.vaadin.tests.widgetset.TestingWidgetSet;
  6. import com.vaadin.tests.widgetset.server.ScrollableGridLayout;
  7. import com.vaadin.ui.Alignment;
  8. import com.vaadin.ui.Button;
  9. import com.vaadin.ui.GridLayout;
  10. @Widgetset(TestingWidgetSet.NAME)
  11. public class GridLayoutFractionalSizeAndAlignment
  12. extends AbstractReindeerTestUIWithLog {
  13. @Override
  14. protected void setup(VaadinRequest request) {
  15. widthTest();
  16. heightTest();
  17. }
  18. private void widthTest() {
  19. final GridLayout layout = new ScrollableGridLayout(1, 1);
  20. layout.setMargin(false);
  21. layout.setSpacing(true);
  22. layout.setWidth(525.04f, Unit.PIXELS);
  23. Button button = new Button("Button");
  24. layout.addComponent(button);
  25. layout.setComponentAlignment(button, Alignment.BOTTOM_RIGHT);
  26. addComponent(layout);
  27. }
  28. private void heightTest() {
  29. final GridLayout layout = new ScrollableGridLayout(1, 1);
  30. layout.setMargin(false);
  31. layout.setSpacing(true);
  32. layout.setWidth(525.04f, Unit.PIXELS);
  33. layout.setHeight(525.04f, Unit.PIXELS);
  34. Button button = new Button("Button");
  35. layout.addComponent(button);
  36. layout.setComponentAlignment(button, Alignment.BOTTOM_RIGHT);
  37. addComponent(layout);
  38. }
  39. }