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.

TableWidthItemRemove.java 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package com.vaadin.tests.components.table;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.tests.components.AbstractReindeerTestUI;
  4. import com.vaadin.v7.ui.Table;
  5. /**
  6. * Test whether adding the first item to a table calculates the table width
  7. * correctly
  8. *
  9. * @author Vaadin Ltd
  10. */
  11. public class TableWidthItemRemove extends AbstractReindeerTestUI {
  12. /*
  13. * (non-Javadoc)
  14. *
  15. * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
  16. * VaadinRequest)
  17. */
  18. @Override
  19. protected void setup(VaadinRequest request) {
  20. final Table table = new Table("My table");
  21. table.addContainerProperty("firstName", String.class, null);
  22. table.addContainerProperty("lastName", String.class, null);
  23. table.addContainerProperty("year", Integer.class, null);
  24. table.setColumnWidth("firstName", 200);
  25. table.setColumnWidth("lastName", 100);
  26. table.setColumnWidth("year", 50);
  27. addButton("Clean", event -> table.removeAllItems());
  28. addButton("Populate",
  29. event -> table.addItem(
  30. new Object[] { "John", "Doe", new Integer(1980) },
  31. Math.random() * 1000));
  32. addComponent(table);
  33. }
  34. /*
  35. * (non-Javadoc)
  36. *
  37. * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
  38. */
  39. @Override
  40. protected String getTestDescription() {
  41. return "The table should retain the correct width on item remove and add.";
  42. }
  43. /*
  44. * (non-Javadoc)
  45. *
  46. * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
  47. */
  48. @Override
  49. protected Integer getTicketNumber() {
  50. return 13592;
  51. }
  52. }