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.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.vaadin.tests.components.panel;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.Button;
  4. import com.vaadin.ui.Button.ClickEvent;
  5. import com.vaadin.ui.Button.ClickListener;
  6. import com.vaadin.ui.Component;
  7. import com.vaadin.ui.CssLayout;
  8. import com.vaadin.ui.Label;
  9. import com.vaadin.ui.Label.ContentMode;
  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 Panel p = new Panel(new CssLayout());
  17. p.setSizeFull();
  18. p.setHeight("600px");
  19. p.addComponent(foo());
  20. addMore = new Button("Add");
  21. addMore.addListener(new ClickListener() {
  22. public void buttonClick(ClickEvent event) {
  23. p.removeComponent(addMore);
  24. p.addComponent(foo());
  25. p.addComponent(addMore);
  26. }
  27. });
  28. p.addComponent(addMore);
  29. addComponent(p);
  30. ((VerticalLayout) getMainWindow().getContent()).setSizeFull();
  31. }
  32. private Component foo() {
  33. Panel panel = new Panel();
  34. panel.addComponent(new Label(
  35. "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/>"
  36. + "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/>",
  37. ContentMode.XHTML));
  38. return panel;
  39. }
  40. @Override
  41. protected String getDescription() {
  42. return "adding a panel to the bottom of the scrolling panel should not scroll up to the top";
  43. }
  44. @Override
  45. protected Integer getTicketNumber() {
  46. return 7462;
  47. }
  48. }