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.

UnnecessaryPaddingInResponsiveUI.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package com.vaadin.tests.components.ui;
  2. import com.vaadin.server.Responsive;
  3. import com.vaadin.server.VaadinRequest;
  4. import com.vaadin.ui.Button;
  5. import com.vaadin.ui.CssLayout;
  6. import com.vaadin.ui.HorizontalLayout;
  7. import com.vaadin.ui.Label;
  8. import com.vaadin.ui.UI;
  9. import com.vaadin.ui.VerticalLayout;
  10. import com.vaadin.ui.themes.ValoTheme;
  11. public class UnnecessaryPaddingInResponsiveUI extends UI {
  12. @Override
  13. protected void init(VaadinRequest request) {
  14. Responsive.makeResponsive(this);
  15. HorizontalLayout root = new HorizontalLayout();
  16. root.setSpacing(true);
  17. MenuLayout menu = new MenuLayout();
  18. root.addComponent(menu);
  19. setContent(root);
  20. setWidth(799, Unit.PIXELS);
  21. setId("UI");
  22. // Uncomment this to enable responsive features in Valo Menu and
  23. // introduce a padding-top to the UI. When this is commented the
  24. // padding-top should be 0 and the related test should pass.
  25. // addStyleName(ValoTheme.UI_WITH_MENU);
  26. }
  27. class MenuLayout extends VerticalLayout {
  28. public MenuLayout() {
  29. setSizeFull();
  30. setPrimaryStyleName(ValoTheme.MENU_ROOT);
  31. CssLayout titleLo = new CssLayout();
  32. titleLo.addStyleName(ValoTheme.MENU_TITLE);
  33. titleLo.addComponent(new Label("menu-title"));
  34. addComponent(titleLo);
  35. for (int i = 1; i <= 5; i++) {
  36. Button button = new Button("Menu Item " + i);
  37. button.setPrimaryStyleName(ValoTheme.MENU_ITEM);
  38. addComponent(button);
  39. }
  40. }
  41. }
  42. }