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.

TestForBasicApplicationLayout.java 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. package com.itmill.toolkit.tests;
  2. import java.util.Locale;
  3. import com.itmill.toolkit.terminal.Sizeable;
  4. import com.itmill.toolkit.ui.Button;
  5. import com.itmill.toolkit.ui.CustomComponent;
  6. import com.itmill.toolkit.ui.DateField;
  7. import com.itmill.toolkit.ui.ExpandLayout;
  8. import com.itmill.toolkit.ui.Label;
  9. import com.itmill.toolkit.ui.OrderedLayout;
  10. import com.itmill.toolkit.ui.Panel;
  11. import com.itmill.toolkit.ui.SplitPanel;
  12. import com.itmill.toolkit.ui.TabSheet;
  13. import com.itmill.toolkit.ui.Table;
  14. import com.itmill.toolkit.ui.Button.ClickEvent;
  15. import com.itmill.toolkit.ui.Button.ClickListener;
  16. public class TestForBasicApplicationLayout extends CustomComponent {
  17. private Button click;
  18. private Button click2;
  19. private TabSheet tab;
  20. public TestForBasicApplicationLayout() {
  21. click = new Button("Set height -1", new ClickListener() {
  22. public void buttonClick(ClickEvent event) {
  23. tab.setHeight(-1);
  24. }
  25. });
  26. click2 = new Button("Set height 100%", new ClickListener() {
  27. public void buttonClick(ClickEvent event) {
  28. tab.setHeight(100);
  29. tab.setHeightUnits(Sizeable.UNITS_PERCENTAGE);
  30. }
  31. });
  32. SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
  33. sp.setSplitPosition(290, Sizeable.UNITS_PIXELS);
  34. SplitPanel sp2 = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);
  35. sp2.setSplitPosition(255, Sizeable.UNITS_PIXELS);
  36. Panel p = new Panel("Accordion Panel");
  37. p.setHeight(100);
  38. p.setHeightUnits(Panel.UNITS_PERCENTAGE);
  39. tab = new TabSheet();
  40. tab.setWidth(100);
  41. tab.setWidthUnits(Sizeable.UNITS_PERCENTAGE);
  42. tab.setHeight(740);
  43. tab.setHeightUnits(Sizeable.UNITS_PIXELS);
  44. tab.addStyleName(TabSheet.STYLE_NO_PADDING);
  45. Panel report = new Panel("Monthly Program Runs", new ExpandLayout());
  46. OrderedLayout controls = new OrderedLayout();
  47. controls.addComponent(new Label("Report tab"));
  48. controls.addComponent(click);
  49. controls.addComponent(click2);
  50. report.addComponent(controls);
  51. DateField cal = new DateField();
  52. cal.setResolution(DateField.RESOLUTION_DAY);
  53. cal.setLocale(new Locale("en", "US"));
  54. report.addComponent(cal);
  55. ((ExpandLayout) report.getLayout()).expand(controls);
  56. report.addStyleName(Panel.STYLE_LIGHT);
  57. report.setHeight(100);
  58. report.setHeightUnits(Sizeable.UNITS_PERCENTAGE);
  59. sp2.setFirstComponent(report);
  60. Table table = TestForTablesInitialColumnWidthLogicRendering
  61. .getTestTable(5, 200);
  62. table.setPageLength(15);
  63. table.setSelectable(true);
  64. table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
  65. table.setColumnCollapsingAllowed(true);
  66. table.setColumnReorderingAllowed(true);
  67. table.setSortDisabled(false);
  68. table.setWidth(100);
  69. table.setWidthUnits(Sizeable.UNITS_PERCENTAGE);
  70. table.setHeight(100);
  71. table.setHeightUnits(Sizeable.UNITS_PERCENTAGE);
  72. table.addStyleName("table-inline");
  73. sp2.setSecondComponent(table);
  74. tab.addTab(new Label("Tab1"), "Summary", null);
  75. tab.addTab(sp2, "Reports", null);
  76. tab.addTab(new Label("Tab 3"), "Statistics", null);
  77. tab.addTab(new Label("Tab 4"), "Error Tracking", null);
  78. tab.setSelectedTab(sp2);
  79. sp.setFirstComponent(p);
  80. sp.setSecondComponent(tab);
  81. setCompositionRoot(sp);
  82. }
  83. }