]> source.dussan.org Git - vaadin-framework.git/commitdiff
#1572 : updated test case and spacing implementation
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 5 Jun 2008 16:03:14 +0000 (16:03 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 5 Jun 2008 16:03:14 +0000 (16:03 +0000)
svn changeset:4769/svn branch:trunk

WebContent/ITMILL/themes/default/gridlayout/gridlayout.css
WebContent/ITMILL/themes/default/styles.css
src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java
src/com/itmill/toolkit/tests/tickets/Ticket1572.java

index a4634c1e1eeec5bffb042d67bc02b61bd63e9971..ab0cd36f744cfb72ec5138602b9df5eb957c7ab9 100644 (file)
 .i-gridlayout-margin-right {
        padding-right: 18px;
 }
+
+.i-gridlayout-grid {
+       margin:0;
+       padding:0;
+       border-collapse: collapse;
+       border:0;
+}
+
+.i-gridlayout-cell {
+       margin:0;
+       padding:0;
+}
+
+.i-gridlayout-spacing .i-gridlayout-cell {
+       padding-left: 15px;
+       padding-top:15px;
+}
+
+.i-gridlayout-spacing .i-gridlayout-firstcol {
+       padding-left: 0;
+}
+.i-gridlayout-spacing .i-gridlayout-firstrow {
+       padding-top: 0;
+}
index 92d2005ca32f3002332cddaface6edcd384c0cbf..63f297fa09047890e98050dae665c666218fb36e 100644 (file)
@@ -512,6 +512,29 @@ input.i-modified,
        padding-right: 18px;
 }
 
+.i-gridlayout-grid {
+       margin:0;
+       padding:0;
+       border-collapse: collapse;
+       border:0;
+}
+
+.i-gridlayout-cell {
+       margin:0;
+       padding:0;
+}
+
+.i-gridlayout-spacing .i-gridlayout-cell {
+       padding-left: 15px;
+       padding-top:15px;
+}
+.i-gridlayout-spacing .i-gridlayout-firstcol {
+       padding-left: 0;
+}
+.i-gridlayout-spacing .i-gridlayout-firstrow {
+       padding-top: 0;
+}
+
 .i-Notification {
        font-family: "Trebuchet MS", geneva, helvetica, arial, tahoma, verdana, sans-serif;
        background-color: #999999;
index e238bbd6858f4f28758cf9423bf56d24b066e306..10e385e308d416fde9f690d82be9b5070eb4f5aa 100644 (file)
@@ -56,6 +56,9 @@ public class IGridLayout extends SimplePanel implements Paintable, Container {
         setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_LEFT,
                 margins.hasLeft());
 
+        setStyleName(margin, CLASSNAME + "-" + "spacing", uidl
+                .hasAttribute("spacing"));
+
         grid.updateFromUIDL(uidl, client);
     }
 
@@ -78,7 +81,7 @@ public class IGridLayout extends SimplePanel implements Paintable, Container {
 
         public Grid() {
             super();
-            setStyleName(CLASSNAME);
+            setStyleName(CLASSNAME + "-grid");
         }
 
         public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
@@ -132,12 +135,21 @@ public class IGridLayout extends SimplePanel implements Paintable, Container {
                                 ha = HasHorizontalAlignment.ALIGN_RIGHT;
                             }
 
-                            getCellFormatter()
-                                    .setAlignment(row, column, ha, va);
+                            FlexCellFormatter formatter = (FlexCellFormatter) getCellFormatter();
+
+                            formatter.setAlignment(row, column, ha, va);
 
                             // set col span
-                            ((FlexCellFormatter) getCellFormatter())
-                                    .setColSpan(row, column, w);
+                            formatter.setColSpan(row, column, w);
+
+                            String styleNames = CLASSNAME + "-cell";
+                            if (column == 0) {
+                                styleNames += " " + CLASSNAME + "-firstcol";
+                            }
+                            if (row == 0) {
+                                styleNames += " " + CLASSNAME + "-firstrow";
+                            }
+                            formatter.setStyleName(row, column, styleNames);
 
                             // Set cell height
                             int h;
index 4f0791a4e08c26280682de621e0ba05585b9515b..6de0fd56d3dd3dccb4a6e02249f3b63394cce0ab 100644 (file)
@@ -46,7 +46,7 @@ public class Ticket1572 extends com.itmill.toolkit.Application {
         main.addComponent(b);\r
 \r
         Button b2 = new Button("next spacing state");\r
-        b.addListener(new Button.ClickListener() {\r
+        b2.addListener(new Button.ClickListener() {\r
             public void buttonClick(ClickEvent event) {\r
                 nextSpacingState();\r
             }\r
@@ -101,8 +101,17 @@ public class Ticket1572 extends com.itmill.toolkit.Application {
         }\r
     }\r
 \r
+    private boolean spacing = true;\r
+\r
     private void nextSpacingState() {\r
-        spacingstate.setValue("        // TODO Auto-generated method stub");\r
+        spacing = !spacing;\r
+        if (spacing) {\r
+            gl.setSpacing(true);\r
+            spacingstate.setValue("Spacing on");\r
+        } else {\r
+            gl.setSpacing(false);\r
+            spacingstate.setValue("Spacing off");\r
+        }\r
     }\r
 \r
 }\r