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.

PanelShouldNotScroll.java 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package com.vaadin.tests.components.panel;
  2. import com.vaadin.shared.ui.ContentMode;
  3. import com.vaadin.tests.components.TestBase;
  4. import com.vaadin.ui.Button;
  5. import com.vaadin.ui.Button.ClickEvent;
  6. import com.vaadin.ui.Button.ClickListener;
  7. import com.vaadin.ui.Component;
  8. import com.vaadin.ui.CssLayout;
  9. import com.vaadin.ui.Label;
  10. import com.vaadin.ui.Panel;
  11. import com.vaadin.ui.VerticalLayout;
  12. public class PanelShouldNotScroll extends TestBase {
  13. private Button addMore;
  14. @Override
  15. protected void setup() {
  16. final CssLayout pl = new CssLayout();
  17. final Panel p = new Panel(pl);
  18. p.setSizeFull();
  19. p.setHeight("600px");
  20. pl.addComponent(foo());
  21. addMore = new Button("Add");
  22. addMore.addClickListener(new ClickListener() {
  23. @Override
  24. public void buttonClick(ClickEvent event) {
  25. pl.removeComponent(addMore);
  26. pl.addComponent(foo());
  27. pl.addComponent(addMore);
  28. }
  29. });
  30. pl.addComponent(addMore);
  31. addComponent(p);
  32. ((VerticalLayout) getMainWindow().getContent()).setSizeFull();
  33. }
  34. private Component foo() {
  35. VerticalLayout layout = new VerticalLayout();
  36. layout.setMargin(true);
  37. Panel panel = new Panel(layout);
  38. layout.addComponent(new Label(
  39. "fooooooooo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>"
  40. + "foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>",
  41. ContentMode.HTML));
  42. return panel;
  43. }
  44. @Override
  45. protected String getDescription() {
  46. return "adding a panel to the bottom of the scrolling panel should not scroll up to the top";
  47. }
  48. @Override
  49. protected Integer getTicketNumber() {
  50. return 7462;
  51. }
  52. }