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.

TableRowHeight3.java 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package com.vaadin.tests.components.table;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.Button;
  4. import com.vaadin.ui.HorizontalLayout;
  5. import com.vaadin.v7.data.Item;
  6. import com.vaadin.v7.ui.Table;
  7. import com.vaadin.v7.ui.themes.BaseTheme;
  8. public class TableRowHeight3 extends TestBase {
  9. @Override
  10. protected String getDescription() {
  11. return "All rows should be visible and the table height should match the height of the rows (no vertical scrollbar)";
  12. }
  13. @Override
  14. protected Integer getTicketNumber() {
  15. return 2747;
  16. }
  17. @Override
  18. protected void setup() {
  19. setTheme("tests-tickets");
  20. HorizontalLayout vl = new HorizontalLayout();
  21. vl.setSizeFull();
  22. Table table = new Table();
  23. table.setWidth("320px");
  24. table.setPageLength(0);
  25. table.setColumnWidth("title", 200);
  26. table.setColumnWidth("test", 98);
  27. table.addContainerProperty("title", Button.class, "");
  28. table.addContainerProperty("test", Button.class, "");
  29. for (int i = 0; i < 6; i++) {
  30. Item item = table.addItem(new Object());
  31. Button b = new Button();
  32. b.setWidth("100%");
  33. b.setStyleName(BaseTheme.BUTTON_LINK);
  34. b.addStyleName("nowraplink");
  35. if (i < 2) {
  36. b.setCaption(
  37. "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper, elit quis elementum iaculis, dui est rutrum risus, at cursus sem leo eget arcu. Proin vel eros ut tortor luctus pretium. Nulla facilisi. Donec in dui. Proin ac diam vitae massa tempus faucibus. Fusce eu risus. Nunc ac risus. Cras libero.");
  38. } else if (2 <= i && i < 4) {
  39. b.setCaption("One line");
  40. } else {
  41. b.setCaption("This button caption should use up two lines");
  42. }
  43. item.getItemProperty("title").setValue(b);
  44. Button c = new Button("test");
  45. item.getItemProperty("test").setValue(c);
  46. }
  47. vl.addComponent(table);
  48. addComponent(vl);
  49. }
  50. }