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.

HeaderUpdateWhenNoRows.java 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.vaadin.tests.components.table;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.tests.components.AbstractReindeerTestUI;
  4. import com.vaadin.ui.CheckBox;
  5. import com.vaadin.v7.ui.Table;
  6. import com.vaadin.v7.ui.Table.ColumnHeaderMode;
  7. public class HeaderUpdateWhenNoRows extends AbstractReindeerTestUI {
  8. @Override
  9. protected void setup(VaadinRequest request) {
  10. final Table table = new Table("Test table");
  11. table.addContainerProperty("Name", String.class, null, "Name", null,
  12. null);
  13. table.setItemCaptionPropertyId("Name");
  14. table.setHeight("100px");
  15. table.setImmediate(true);
  16. final CheckBox showHeaders = new CheckBox("Show headers");
  17. showHeaders.addValueChangeListener(event -> {
  18. if (showHeaders.getValue()) {
  19. table.setColumnHeaderMode(
  20. ColumnHeaderMode.EXPLICIT_DEFAULTS_ID);
  21. } else {
  22. table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
  23. }
  24. });
  25. showHeaders.setValue(true);
  26. addComponent(showHeaders);
  27. addComponent(table);
  28. }
  29. @Override
  30. protected String getTestDescription() {
  31. return "The header should be updated when toggling column header mode";
  32. }
  33. @Override
  34. protected Integer getTicketNumber() {
  35. return 2974;
  36. }
  37. }