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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Copyright 2000-2016 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.shared.ui.datefield.DateResolution;
  20. import com.vaadin.tests.components.TestDateField;
  21. import com.vaadin.ui.AbstractDateField;
  22. import com.vaadin.ui.Button;
  23. import com.vaadin.ui.Button.ClickEvent;
  24. import com.vaadin.ui.Button.ClickListener;
  25. import com.vaadin.ui.CustomComponent;
  26. import com.vaadin.ui.HorizontalSplitPanel;
  27. import com.vaadin.ui.Label;
  28. import com.vaadin.ui.Panel;
  29. import com.vaadin.ui.TabSheet;
  30. import com.vaadin.ui.VerticalLayout;
  31. import com.vaadin.v7.ui.Table;
  32. import com.vaadin.v7.ui.themes.Reindeer;
  33. public class TestForBasicApplicationLayout extends CustomComponent {
  34. private final Button click;
  35. private final Button click2;
  36. private final TabSheet tab;
  37. public TestForBasicApplicationLayout() {
  38. click = new Button("Set height -1", new ClickListener() {
  39. @Override
  40. public void buttonClick(ClickEvent event) {
  41. tab.setHeight(null);
  42. }
  43. });
  44. click2 = new Button("Set height 100%", new ClickListener() {
  45. @Override
  46. public void buttonClick(ClickEvent event) {
  47. tab.setHeight(100, TabSheet.UNITS_PERCENTAGE);
  48. }
  49. });
  50. final HorizontalSplitPanel sp = new HorizontalSplitPanel();
  51. sp.setSplitPosition(290, Sizeable.UNITS_PIXELS);
  52. final HorizontalSplitPanel sp2 = new HorizontalSplitPanel();
  53. sp2.setSplitPosition(255, Sizeable.UNITS_PIXELS);
  54. VerticalLayout pl = new VerticalLayout();
  55. pl.setMargin(true);
  56. final Panel p = new Panel("Accordion Panel", pl);
  57. p.setSizeFull();
  58. tab = new TabSheet();
  59. tab.setSizeFull();
  60. VerticalLayout reportLayout = new VerticalLayout();
  61. final Panel report = new Panel("Monthly Program Runs", reportLayout);
  62. final VerticalLayout controls = reportLayout;
  63. controls.setMargin(true);
  64. controls.addComponent(new Label("Report tab"));
  65. controls.addComponent(click);
  66. controls.addComponent(click2);
  67. reportLayout.addComponent(controls);
  68. final AbstractDateField cal = new TestDateField();
  69. cal.setResolution(DateResolution.DAY);
  70. cal.setLocale(new Locale("en", "US"));
  71. reportLayout.addComponent(cal);
  72. reportLayout.setExpandRatio(controls, 1);
  73. report.addStyleName(Reindeer.PANEL_LIGHT);
  74. report.setHeight(100, Sizeable.UNITS_PERCENTAGE);
  75. sp2.setFirstComponent(report);
  76. final Table table = TestForTablesInitialColumnWidthLogicRendering
  77. .getTestTable(5, 200);
  78. table.setPageLength(15);
  79. table.setSelectable(true);
  80. table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
  81. table.setColumnCollapsingAllowed(true);
  82. table.setColumnReorderingAllowed(true);
  83. table.setSortDisabled(false);
  84. table.setSizeFull();
  85. table.addStyleName("table-inline");
  86. sp2.setSecondComponent(table);
  87. tab.addTab(new Label("Tab1"), "Summary", null);
  88. tab.addTab(sp2, "Reports", null);
  89. tab.addTab(new Label("Tab 3"), "Statistics", null);
  90. tab.addTab(new Label("Tab 4"), "Error Tracking", null);
  91. tab.setSelectedTab(sp2);
  92. sp.setFirstComponent(p);
  93. sp.setSecondComponent(tab);
  94. setCompositionRoot(sp);
  95. }
  96. }