Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

TestForBasicApplicationLayout.java 4.0KB

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