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.

LayoutExample.java 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.automatedtests.featurebrowser;
  5. import com.vaadin.ui.CustomComponent;
  6. import com.vaadin.ui.GridLayout;
  7. import com.vaadin.ui.HorizontalLayout;
  8. import com.vaadin.ui.Label;
  9. import com.vaadin.ui.Panel;
  10. import com.vaadin.ui.TabSheet;
  11. import com.vaadin.ui.VerticalLayout;
  12. /**
  13. * A few examples of layout possibilities.
  14. *
  15. * @author IT Mill Ltd.
  16. */
  17. public class LayoutExample extends CustomComponent {
  18. public LayoutExample() {
  19. final VerticalLayout main = new VerticalLayout();
  20. main.setMargin(true);
  21. setCompositionRoot(main);
  22. final GridLayout g = new GridLayout(2, 5);
  23. g.setWidth("100%");
  24. main.addComponent(g);
  25. // panel
  26. Panel p = new Panel("This is a normal panel");
  27. p.setDebugId("NormalPanel");
  28. Label l = new Label("A normal panel.");
  29. p.addComponent(l);
  30. g.addComponent(p);
  31. // lightpanel
  32. p = new Panel("This is a light panel");
  33. p.setDebugId("LightPanel");
  34. p.setStyleName(Panel.STYLE_LIGHT);
  35. l = new Label("A light-style panel.");
  36. p.addComponent(l);
  37. g.addComponent(p);
  38. TabSheet ts = new TabSheet();
  39. g.addComponent(ts, 0, 1, 1, 1);
  40. VerticalLayout ol = new VerticalLayout();
  41. ol.setDebugId("VerticalOrderedLayout");
  42. ol.setMargin(true);
  43. ol.addComponent(new Label("Component 1"));
  44. ol.addComponent(new Label("Component 2"));
  45. ol.addComponent(new Label("Component 3"));
  46. ts.addTab(ol, "Vertical OrderedLayout", null);
  47. HorizontalLayout hl = new HorizontalLayout();
  48. hl.setDebugId("HorizontalOrderedLayout");
  49. hl.setMargin(true);
  50. hl.addComponent(new Label("Component 1"));
  51. hl.addComponent(new Label("Component 2"));
  52. hl.addComponent(new Label("Component 3"));
  53. ts.addTab(hl, "Horizontal OrderedLayout", null);
  54. final GridLayout gl = new GridLayout(3, 3);
  55. gl.setDebugId("GridLayout");
  56. gl.setMargin(true);
  57. gl.addComponent(new Label("Component 1.1"));
  58. gl.addComponent(new Label("Component 1.2"));
  59. gl.addComponent(new Label("Component 1.3"));
  60. gl.addComponent(new Label("Component 2.2"), 1, 1);
  61. gl.addComponent(new Label("Component 3.1"), 0, 2);
  62. gl.addComponent(new Label("Component 3.3"), 2, 2);
  63. ts.addTab(gl, "GridLayout", null);
  64. /*- TODO spitpanel removed for now - do we need it here?
  65. ts = new TabSheet();
  66. ts.setHeight(150);
  67. g.addComponent(ts, 0, 2, 1, 2);
  68. SplitPanel sp = new SplitPanel();
  69. sp.addComponent(new Label("Component 1"));
  70. sp.addComponent(new Label("Component 2"));
  71. ts.addTab(sp, "Vertical SplitPanel", null);
  72. sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
  73. sp.addComponent(new Label("Component 1"));
  74. sp.addComponent(new Label("Component 2"));
  75. ts.addTab(sp, "Horizontal SplitPanel", null);
  76. -*/
  77. }
  78. }