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.

TableInTabsheet.java 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package com.vaadin.tests.components.table;
  2. import java.net.MalformedURLException;
  3. import com.vaadin.server.VaadinRequest;
  4. import com.vaadin.shared.ui.ContentMode;
  5. import com.vaadin.tests.components.AbstractReindeerTestUI;
  6. import com.vaadin.ui.AbsoluteLayout;
  7. import com.vaadin.ui.HorizontalLayout;
  8. import com.vaadin.ui.Label;
  9. import com.vaadin.ui.TabSheet;
  10. import com.vaadin.ui.VerticalLayout;
  11. import com.vaadin.v7.ui.Table;
  12. import com.vaadin.v7.ui.Table.Align;
  13. import com.vaadin.v7.ui.themes.Reindeer;
  14. public class TableInTabsheet extends AbstractReindeerTestUI {
  15. @Override
  16. protected void setup(VaadinRequest request) {
  17. VerticalLayout vPrinc = new VerticalLayout();
  18. vPrinc.setStyleName(Reindeer.LAYOUT_BLUE);
  19. vPrinc.addComponent(title());
  20. vPrinc.addComponent(page());
  21. vPrinc.addComponent(new Label("Dvlop Tecnologia."));
  22. setContent(vPrinc);
  23. }
  24. private VerticalLayout title() {
  25. VerticalLayout vP = new VerticalLayout();
  26. vP.setStyleName(Reindeer.LAYOUT_BLACK);
  27. Label tit = new Label("<h1> Tab/Table Test</h1>", ContentMode.HTML);
  28. vP.addComponent(tit);
  29. return vP;
  30. }
  31. private VerticalLayout page() {
  32. VerticalLayout vP = new VerticalLayout();
  33. vP.setStyleName(Reindeer.LAYOUT_BLUE);
  34. TabSheet t = new TabSheet();
  35. t.setWidth(1000, Unit.PIXELS);
  36. HorizontalLayout hP = new HorizontalLayout();
  37. t.addTab(Ranking(), "Ranking");
  38. try {
  39. t.addTab(GDocs(""), "Dez 2011");
  40. t.addTab(GDocs(""), "Jan 2012");
  41. t.addTab(GDocs(""), "Abr 2012");
  42. } catch (MalformedURLException e) {
  43. // TODO Auto-generated catch block
  44. e.printStackTrace();
  45. }
  46. hP.addComponent(t);
  47. vP.addComponent(hP);
  48. return vP;
  49. }
  50. private AbsoluteLayout Ranking() {
  51. AbsoluteLayout vT = new AbsoluteLayout();
  52. vT.setHeight(500, Unit.PIXELS);
  53. vT.setWidth(900, Unit.PIXELS);
  54. vT.setStyleName(Reindeer.LAYOUT_BLUE);
  55. final Table table = new Table("Ranking Oficial");
  56. table.addContainerProperty("Atleta", String.class, null);
  57. table.addContainerProperty("P", String.class, null);
  58. table.addContainerProperty("Dez/11", Integer.class, null);
  59. table.setColumnAlignment("Dez/11", Align.CENTER);
  60. table.addContainerProperty("Jan/12", Integer.class, null);
  61. table.setColumnAlignment("Jan/12", Align.CENTER);
  62. table.addContainerProperty("Abr/12", String.class, null);
  63. table.addContainerProperty("Total", Integer.class, null);
  64. table.setColumnAlignment("Total", Align.CENTER);
  65. table.addItem(new Object[] { "Araujo", "D.1", 8, 8, " ", 16 }, 1);
  66. table.addItem(new Object[] { "Claudio", "D.2", 2, 10, " ", 12 }, 2);
  67. table.setPageLength(12);
  68. vT.addComponent(table, "left: 50px; top: 50px;");
  69. return vT;
  70. }
  71. private VerticalLayout GDocs(String end) throws MalformedURLException {
  72. VerticalLayout vT = new VerticalLayout();
  73. vT.setHeight(500, Unit.PIXELS);
  74. vT.setWidth(900, Unit.PIXELS);
  75. return vT;
  76. }
  77. @Override
  78. protected String getTestDescription() {
  79. return "Chaning to a different tab and then back to the first tab should properly render the table.";
  80. }
  81. @Override
  82. protected Integer getTicketNumber() {
  83. return Integer.valueOf(8714);
  84. }
  85. }