]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added possibility to show/hide layout tests from #1710 test
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>
Fri, 11 Jul 2008 08:12:37 +0000 (08:12 +0000)
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>
Fri, 11 Jul 2008 08:12:37 +0000 (08:12 +0000)
svn changeset:5086/svn branch:trunk

src/com/itmill/toolkit/tests/tickets/Ticket1710.java

index d6908294f4e6d7a638a760b3a1361fabcf0193ee..bd369b93775c3ad2fa8273209316a83158d31e62 100644 (file)
@@ -39,10 +39,17 @@ public class Ticket1710 extends com.itmill.toolkit.Application {
         lo.setMargin(true);\r
         lo.setSpacing(true);\r
 \r
+        // Hiding controls\r
+        OrderedLayout hidingControls = new OrderedLayout(\r
+                OrderedLayout.ORIENTATION_HORIZONTAL);\r
+        lo.addComponent(hidingControls);\r
+\r
         // OrderedLayout\r
         final OrderedLayout orderedLayout = new OrderedLayout();\r
         LayoutTestingPanel oltp = new LayoutTestingPanel("OrderedLayout",\r
                 orderedLayout);\r
+        hidingControls.addComponent(new Button("OrderedLayout",\r
+                new MethodProperty(oltp, "visible")));\r
         lo.addComponent(oltp);\r
         orderedLayout.setSpacing(false);\r
         addFields(orderedLayout);\r
@@ -60,14 +67,19 @@ public class Ticket1710 extends com.itmill.toolkit.Application {
 \r
         // GridLayout\r
         GridLayout grid = new GridLayout(1, 1);\r
-        lo\r
-                .addComponent(new LayoutTestingPanel(\r
-                        "Gridlayout with 1 column", grid));\r
+        Panel g1tp = new LayoutTestingPanel("Gridlayout with 1 column", grid);\r
+        hidingControls.addComponent(new Button("GridLayout (1col)",\r
+                new MethodProperty(g1tp, "visible")));\r
+        g1tp.setVisible(false);\r
+        lo.addComponent(g1tp);\r
         grid.setSpacing(true);\r
         addFields(grid);\r
         GridLayout grid2 = new GridLayout(2, 1);\r
-        lo.addComponent(new LayoutTestingPanel("Gridlayout with 2 columns",\r
-                grid2));\r
+        Panel g2tp = new LayoutTestingPanel("Gridlayout with 2 columns", grid2);\r
+        hidingControls.addComponent(new Button("GridLayout (2cols)",\r
+                new MethodProperty(g2tp, "visible")));\r
+        g2tp.setVisible(false);\r
+        lo.addComponent(g2tp);\r
         grid2.setSpacing(true);\r
         addFields(grid2);\r
 \r
@@ -75,6 +87,9 @@ public class Ticket1710 extends com.itmill.toolkit.Application {
         ExpandLayout el = new ExpandLayout();\r
         Panel elp = new LayoutTestingPanel(\r
                 "ExpandLayout width first component expanded", el);\r
+        hidingControls.addComponent(new Button("ExpandLayout (vertical)",\r
+                new MethodProperty(elp, "visible")));\r
+        elp.setVisible(false);\r
         el.setHeight(700);\r
         addFields(el);\r
         Component firstComponent = (Component) el.getComponentIterator().next();\r
@@ -84,6 +99,9 @@ public class Ticket1710 extends com.itmill.toolkit.Application {
         ExpandLayout elh = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);\r
         Panel elhp = new LayoutTestingPanel(\r
                 "ExpandLayout width first component expanded; horizontal", elh);\r
+        hidingControls.addComponent(new Button("ExpandLayout (horizontal)",\r
+                new MethodProperty(elhp, "visible")));\r
+        elhp.setVisible(false);\r
         elhp.setScrollable(true);\r
         elh.setWidth(2000);\r
         elh.setHeight(100);\r
@@ -97,14 +115,24 @@ public class Ticket1710 extends com.itmill.toolkit.Application {
         // CustomLayout\r
         OrderedLayout cl = new OrderedLayout();\r
         Panel clp = new LayoutTestingPanel("CustomLayout", cl);\r
+        hidingControls.addComponent(new Button("CustomLayout",\r
+                new MethodProperty(clp, "visible")));\r
+        clp.setVisible(false);\r
         lo.addComponent(clp);\r
         cl.addComponent(new Label("<<< Add customlayout testcase here >>>"));\r
 \r
         // Form\r
         Panel formPanel = new Panel("Form");\r
+        hidingControls.addComponent(new Button("Form", new MethodProperty(\r
+                formPanel, "visible")));\r
+        formPanel.setVisible(false);\r
         formPanel.addComponent(getFormPanelExample());\r
         lo.addComponent(formPanel);\r
 \r
+        for (Iterator i = hidingControls.getComponentIterator(); i.hasNext();) {\r
+            ((AbstractComponent) i.next()).setImmediate(true);\r
+        }\r
+\r
     }\r
 \r
     private Form getFormPanelExample() {\r