]> source.dussan.org Git - vaadin-framework.git/commitdiff
New test for basic application layout.
authorJouni Koivuviita <jouni.koivuviita@itmill.com>
Mon, 8 Oct 2007 10:47:18 +0000 (10:47 +0000)
committerJouni Koivuviita <jouni.koivuviita@itmill.com>
Mon, 8 Oct 2007 10:47:18 +0000 (10:47 +0000)
svn changeset:2457/svn branch:trunk

src/com/itmill/toolkit/tests/TestForBasicApplicationLayout.java [new file with mode: 0644]

diff --git a/src/com/itmill/toolkit/tests/TestForBasicApplicationLayout.java b/src/com/itmill/toolkit/tests/TestForBasicApplicationLayout.java
new file mode 100644 (file)
index 0000000..afa51e1
--- /dev/null
@@ -0,0 +1,105 @@
+package com.itmill.toolkit.tests;\r
+\r
+import java.util.Locale;\r
+\r
+import com.itmill.toolkit.terminal.Sizeable;\r
+import com.itmill.toolkit.ui.Button;\r
+import com.itmill.toolkit.ui.CustomComponent;\r
+import com.itmill.toolkit.ui.DateField;\r
+import com.itmill.toolkit.ui.ExpandLayout;\r
+import com.itmill.toolkit.ui.Label;\r
+import com.itmill.toolkit.ui.OrderedLayout;\r
+import com.itmill.toolkit.ui.Panel;\r
+import com.itmill.toolkit.ui.SplitPanel;\r
+import com.itmill.toolkit.ui.TabSheet;\r
+import com.itmill.toolkit.ui.Table;\r
+import com.itmill.toolkit.ui.Button.ClickEvent;\r
+import com.itmill.toolkit.ui.Button.ClickListener;\r
+\r
+public class TestForBasicApplicationLayout extends CustomComponent {\r
+       \r
+       private Button click;\r
+       private Button click2;\r
+       private TabSheet tab;\r
+       \r
+       public TestForBasicApplicationLayout() {\r
+               OrderedLayout main = new OrderedLayout();       \r
+               setCompositionRoot(main);\r
+               \r
+               click = new Button("Set height -1", new ClickListener() {\r
+\r
+                       public void buttonClick(ClickEvent event) {\r
+                               tab.setHeight(-1);\r
+                       }\r
+                       \r
+               });\r
+               \r
+               click2 = new Button("Set height 100%", new ClickListener() {\r
+\r
+                       public void buttonClick(ClickEvent event) {\r
+                               tab.setHeight(100);\r
+                               tab.setHeightUnits(Sizeable.UNITS_PERCENTAGE);\r
+                       }\r
+                       \r
+               });\r
+               \r
+               SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);\r
+               sp.setSplitPosition(290, Sizeable.UNITS_PIXELS); // Width of left side area\r
+               \r
+               SplitPanel sp2 = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);\r
+               sp2.setSplitPosition(255, Sizeable.UNITS_PIXELS); // Height of right-top area\r
+               \r
+               Panel p = new Panel("Accordion Panel");\r
+               p.setHeight(100);\r
+               p.setHeightUnits(Panel.UNITS_PERCENTAGE);\r
+               \r
+               tab = new TabSheet();\r
+               tab.setWidth(100);\r
+               tab.setWidthUnits(Sizeable.UNITS_PERCENTAGE);\r
+               tab.setHeight(740);\r
+               tab.setHeightUnits(Sizeable.UNITS_PIXELS);\r
+               \r
+               Panel report = new Panel("Monthly Program Runs", new ExpandLayout());\r
+               OrderedLayout controls = new OrderedLayout();\r
+               controls.addComponent(new Label("Report tab"));\r
+               controls.addComponent(click);\r
+               controls.addComponent(click2);\r
+               report.addComponent(controls);\r
+               DateField cal = new DateField();\r
+               cal.setResolution(DateField.RESOLUTION_DAY);\r
+               cal.setLocale(new Locale("en","US"));\r
+               report.addComponent(cal);\r
+               ((ExpandLayout)report.getLayout()).expand(controls);\r
+               report.setStyle("light");\r
+               report.setHeight(100);\r
+               report.setHeightUnits(Sizeable.UNITS_PERCENTAGE);\r
+               \r
+               sp2.setFirstComponent(report);\r
+               \r
+               Table table = TestForTablesInitialColumnWidthLogicRendering.getTestTable(5,200);\r
+               table.setPageLength(15);\r
+               table.setSelectable(true);\r
+               table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);\r
+               table.setColumnCollapsingAllowed(true);\r
+               table.setColumnReorderingAllowed(true);\r
+               table.setSortDisabled(false);\r
+               table.setWidth(100);\r
+               table.setWidthUnits(Sizeable.UNITS_PERCENTAGE);\r
+               table.setHeight(100);\r
+               table.setHeightUnits(Sizeable.UNITS_PERCENTAGE);\r
+               table.addStyleName("table-inline");\r
+               sp2.setSecondComponent(table);\r
+               \r
+               tab.addTab(new Label("Tab1"), "Summary", null);\r
+               tab.addTab(sp2, "Reports", null);\r
+               tab.addTab(new Label("Tab 3"), "Statistics", null);\r
+               tab.addTab(new Label("Tab 4"), "Error Tracking", null);\r
+               tab.setSelectedTab(sp2);\r
+               \r
+               sp.setFirstComponent(p);\r
+               sp.setSecondComponent(tab);\r
+               \r
+               main.addComponent(sp);\r
+       }\r
+       \r
+}\r