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.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Copyright 2000-2013 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests;
  17. import java.util.Locale;
  18. import com.vaadin.server.Sizeable;
  19. import com.vaadin.ui.Button;
  20. import com.vaadin.ui.Button.ClickEvent;
  21. import com.vaadin.ui.Button.ClickListener;
  22. import com.vaadin.ui.CustomComponent;
  23. import com.vaadin.ui.DateField;
  24. import com.vaadin.ui.HorizontalSplitPanel;
  25. import com.vaadin.ui.Label;
  26. import com.vaadin.ui.Panel;
  27. import com.vaadin.ui.TabSheet;
  28. import com.vaadin.ui.Table;
  29. import com.vaadin.ui.VerticalLayout;
  30. import com.vaadin.ui.themes.Reindeer;
  31. public class TestForBasicApplicationLayout extends CustomComponent {
  32. private final Button click;
  33. private final Button click2;
  34. private final TabSheet tab;
  35. public TestForBasicApplicationLayout() {
  36. click = new Button("Set height -1", new ClickListener() {
  37. @Override
  38. public void buttonClick(ClickEvent event) {
  39. tab.setHeight(null);
  40. }
  41. });
  42. click2 = new Button("Set height 100%", new ClickListener() {
  43. @Override
  44. public void buttonClick(ClickEvent event) {
  45. tab.setHeight(100, TabSheet.UNITS_PERCENTAGE);
  46. }
  47. });
  48. final HorizontalSplitPanel sp = new HorizontalSplitPanel();
  49. sp.setSplitPosition(290, Sizeable.UNITS_PIXELS);
  50. final HorizontalSplitPanel sp2 = new HorizontalSplitPanel();
  51. sp2.setSplitPosition(255, Sizeable.UNITS_PIXELS);
  52. VerticalLayout pl = new VerticalLayout();
  53. pl.setMargin(true);
  54. final Panel p = new Panel("Accordion Panel", pl);
  55. p.setSizeFull();
  56. tab = new TabSheet();
  57. tab.setSizeFull();
  58. VerticalLayout reportLayout = new VerticalLayout();
  59. final Panel report = new Panel("Monthly Program Runs", reportLayout);
  60. final VerticalLayout controls = reportLayout;
  61. controls.setMargin(true);
  62. controls.addComponent(new Label("Report tab"));
  63. controls.addComponent(click);
  64. controls.addComponent(click2);
  65. reportLayout.addComponent(controls);
  66. final DateField cal = new DateField();
  67. cal.setResolution(DateField.RESOLUTION_DAY);
  68. cal.setLocale(new Locale("en", "US"));
  69. reportLayout.addComponent(cal);
  70. reportLayout.setExpandRatio(controls, 1);
  71. report.addStyleName(Reindeer.PANEL_LIGHT);
  72. report.setHeight(100, Sizeable.UNITS_PERCENTAGE);
  73. sp2.setFirstComponent(report);
  74. final Table table = TestForTablesInitialColumnWidthLogicRendering
  75. .getTestTable(5, 200);
  76. table.setPageLength(15);
  77. table.setSelectable(true);
  78. table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
  79. table.setColumnCollapsingAllowed(true);
  80. table.setColumnReorderingAllowed(true);
  81. table.setSortDisabled(false);
  82. table.setSizeFull();
  83. table.addStyleName("table-inline");
  84. sp2.setSecondComponent(table);
  85. tab.addTab(new Label("Tab1"), "Summary", null);
  86. tab.addTab(sp2, "Reports", null);
  87. tab.addTab(new Label("Tab 3"), "Statistics", null);
  88. tab.addTab(new Label("Tab 4"), "Error Tracking", null);
  89. tab.setSelectedTab(sp2);
  90. sp.setFirstComponent(p);
  91. sp.setSecondComponent(tab);
  92. setCompositionRoot(sp);
  93. }
  94. }