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.

TreePerformanceTest.java 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package com.vaadin.tests.components.tree;
  2. import com.vaadin.tests.components.AbstractTestCase;
  3. import com.vaadin.ui.Layout;
  4. import com.vaadin.ui.LegacyWindow;
  5. import com.vaadin.ui.Tree;
  6. import com.vaadin.ui.VerticalLayout;
  7. public class TreePerformanceTest extends AbstractTestCase {
  8. @Override
  9. protected String getDescription() {
  10. return "Trees rendering type may become slow escpecially with FF and big tree in a deep component tree.";
  11. }
  12. @Override
  13. protected Integer getTicketNumber() {
  14. return null;
  15. }
  16. @Override
  17. public void init() {
  18. LegacyWindow w = new LegacyWindow();
  19. setMainWindow(w);
  20. Layout layout = null;
  21. for (int i = 0; i < getLayoutCount(); i++) {
  22. Layout newlayout = createLayout();
  23. // newlayout.setHeight("100%");
  24. if (i == 0) {
  25. w.setContent(newlayout);
  26. } else {
  27. layout.addComponent(newlayout);
  28. }
  29. layout = newlayout;
  30. }
  31. Tree tree = new Tree();
  32. for (int i = 0; i < getItemCount(); i++) {
  33. String text = "ITEM " + i;
  34. tree.addItem(text);
  35. for (int j = 0; j < getSubItemCount(); j++) {
  36. String subtext = " SUBITEM " + j + " for " + text;
  37. tree.addItem(subtext);
  38. tree.setParent(subtext, text);
  39. }
  40. tree.expandItemsRecursively(text);
  41. }
  42. // One can test that the slugginesh is actually verticallayout issue
  43. // Table testTable = TestForTablesInitialColumnWidthLogicRendering
  44. // .getTestTable(12, 60);
  45. // testTable.setPageLength(0);
  46. layout.addComponent(tree);
  47. }
  48. private Layout createLayout() {
  49. return new VerticalLayout();
  50. }
  51. private int getLayoutCount() {
  52. return 10;
  53. }
  54. private int getSubItemCount() {
  55. return 3;
  56. }
  57. private int getItemCount() {
  58. return 200;
  59. }
  60. }