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.

TableSortingStopsWorkingOnChrome.java 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. package com.vaadin.tests.components.table;
  2. import java.io.Serializable;
  3. import com.vaadin.event.dd.DragAndDropEvent;
  4. import com.vaadin.event.dd.DropHandler;
  5. import com.vaadin.event.dd.acceptcriteria.AcceptAll;
  6. import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
  7. import com.vaadin.server.VaadinRequest;
  8. import com.vaadin.tests.components.AbstractTestUI;
  9. import com.vaadin.ui.VerticalLayout;
  10. import com.vaadin.v7.data.util.BeanItemContainer;
  11. import com.vaadin.v7.ui.Table;
  12. @SuppressWarnings("serial")
  13. public class TableSortingStopsWorkingOnChrome extends AbstractTestUI {
  14. protected static final int ROW_COUNT = 100;
  15. @Override
  16. protected void setup(VaadinRequest request) {
  17. VerticalLayout layout = new VerticalLayout();
  18. layout.setSizeFull();
  19. final Table table = new Table();
  20. table.setColumnReorderingAllowed(true);
  21. table.setSizeFull();
  22. BeanItemContainer<TestItem> cont = new BeanItemContainer<>(
  23. TestItem.class);
  24. for (int i = 0; i < ROW_COUNT; i++) {
  25. TestItem ti = new TestItem();
  26. ti.setValue1("Value1_" + i);
  27. ti.setValue2("Value2_" + (ROW_COUNT - i));
  28. ti.setValue3("Value3_" + i);
  29. ti.setValue4("Value4_" + (ROW_COUNT - i));
  30. ti.setValue5("Value5_" + i);
  31. cont.addBean(ti);
  32. }
  33. table.setContainerDataSource(cont);
  34. table.setImmediate(true);
  35. table.setSelectable(true);
  36. table.setMultiSelect(false);
  37. table.setPageLength(10);
  38. table.setDragMode(Table.TableDragMode.ROW);
  39. table.setDropHandler(new DropHandler() {
  40. @Override
  41. public void drop(DragAndDropEvent dragAndDropEvent) {
  42. }
  43. @Override
  44. public AcceptCriterion getAcceptCriterion() {
  45. return AcceptAll.get();
  46. }
  47. });
  48. table.addColumnReorderListener(
  49. event -> System.out.println("columnReorder"));
  50. table.addHeaderClickListener(
  51. event -> System.out.println("Header was clicked"));
  52. layout.addComponent(table);
  53. addComponent(layout);
  54. }
  55. public class TestItem implements Serializable {
  56. private static final long serialVersionUID = -745849615488792221L;
  57. private String value1;
  58. private String value2;
  59. private String value3;
  60. private String value4;
  61. private String value5;
  62. public String getValue1() {
  63. return value1;
  64. }
  65. public void setValue1(String value1) {
  66. this.value1 = value1;
  67. }
  68. public String getValue2() {
  69. return value2;
  70. }
  71. public void setValue2(String value2) {
  72. this.value2 = value2;
  73. }
  74. public String getValue3() {
  75. return value3;
  76. }
  77. public void setValue3(String value3) {
  78. this.value3 = value3;
  79. }
  80. public String getValue4() {
  81. return value4;
  82. }
  83. public void setValue4(String value4) {
  84. this.value4 = value4;
  85. }
  86. public String getValue5() {
  87. return value5;
  88. }
  89. public void setValue5(String value5) {
  90. this.value5 = value5;
  91. }
  92. }
  93. @Override
  94. protected String getTestDescription() {
  95. return "After an indeterminate period of time sorting tables via clicking on the column header should not stop working on Chrome";
  96. }
  97. @Override
  98. protected Integer getTicketNumber() {
  99. return 14796;
  100. }
  101. }