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.

GridClientMemoryLeak.java 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.vaadin.tests.components.grid;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.shared.ui.ContentMode;
  4. import com.vaadin.tests.components.AbstractTestUI;
  5. import com.vaadin.ui.Button;
  6. import com.vaadin.ui.Button.ClickEvent;
  7. import com.vaadin.ui.Grid;
  8. import com.vaadin.ui.Label;
  9. import com.vaadin.ui.VerticalLayout;
  10. public class GridClientMemoryLeak extends AbstractTestUI {
  11. private static final String INSTRUCTIONS = "This UI is for manually testing that the client side grid does not leak memory. "
  12. + "Steps to take:\n"
  13. + "\t1. Click the newGrid button 1-n times\n"
  14. + "\t2. Capture a JS heap dump in your browser\n"
  15. + "\t3. The heap dump should only contain 1 instance of each of the following:\n"
  16. + "\t\tGrid, GridKeyDownEvent, GridKeyPressEvent, GridKeyUpEvent, GridClickEvent, GridDoubleClickEvent";
  17. @Override
  18. protected void setup(VaadinRequest request) {
  19. final Label instructionLabel = new Label(INSTRUCTIONS,
  20. ContentMode.PREFORMATTED);
  21. final VerticalLayout layout = new VerticalLayout();
  22. final Button btn = new Button("newGrid");
  23. btn.addClickListener(new Button.ClickListener() {
  24. @Override
  25. public void buttonClick(ClickEvent event) {
  26. layout.removeComponent(layout.getComponent(1));
  27. layout.addComponent(new Grid<String>());
  28. }
  29. });
  30. layout.addComponent(instructionLabel);
  31. layout.addComponent(btn);
  32. layout.addComponent(new Grid<String>());
  33. addComponent(layout);
  34. }
  35. }