]> source.dussan.org Git - vaadin-framework.git/commitdiff
margins + component spacings for formlayout, removed obsolete comment
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 9 Jun 2008 12:19:14 +0000 (12:19 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 9 Jun 2008 12:19:14 +0000 (12:19 +0000)
svn changeset:4815/svn branch:trunk

WebContent/ITMILL/themes/default/formlayout/formlayout.css
WebContent/ITMILL/themes/default/styles.css
src/com/itmill/toolkit/terminal/gwt/client/ui/IFormLayout.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java

index 574e85e21f70f170c68ca8aad6ded30c53891bb2..e5a27ade3897985ec360a9fe78fe822b13d2b785 100644 (file)
@@ -7,6 +7,38 @@
 .i-formlayout-captioncell {
        text-align:right;
 }
+
+.i-formlayout-spacing .i-formlayout-row .i-formlayout-captioncell, 
+.i-formlayout-spacing .i-formlayout-row .i-formlayout-contentcell,
+.i-formlayout-spacing .i-formlayout-row .i-formlayout-errorcell {
+       padding-top: 8px;
+}
+
+.i-formlayout-spacing .i-formlayout-firstrow .i-formlayout-captioncell, 
+.i-formlayout-spacing .i-formlayout-firstrow .i-formlayout-contentcell,
+.i-formlayout-spacing .i-formlayout-firstrow .i-formlayout-errorcell {
+       padding-top: 0;
+}
+
+.i-formlayout-margin-top .i-formlayout-firstrow .i-formlayout-captioncell, 
+.i-formlayout-margin-top .i-formlayout-firstrow .i-formlayout-contentcell,
+.i-formlayout-margin-top .i-formlayout-firstrow .i-formlayout-errorcell {
+       padding-top: 15px;
+}
+.i-formlayout-margin-bottom .i-formlayout-lastrow .i-formlayout-captioncell,
+.i-formlayout-margin-bottom .i-formlayout-lastrow .i-formlayout-contentcell,
+.i-formlayout-margin-bottom .i-formlayout-lastrow .i-formlayout-errorcell {
+       padding-bottom: 15px;
+}
+.i-formlayout-margin-left .i-formlayout-captioncell {
+       padding-left: 18px;
+} 
+.i-formlayout-margin-right .i-formlayout-contentcell {
+       padding-right: 18px;
+}
+
+/* form */
+
 .i-form-errormessage {
        background: transparent url(../icons/16/error.png) no-repeat top left;
        padding-left: 20px;
index fc01584d30b9084070a3d5d04bb587d2be579b08..e3262823438d42e5465d933f044e0b41b2cb0680 100644 (file)
@@ -508,6 +508,38 @@ input.i-modified,
 .i-formlayout-captioncell {
        text-align:right;
 }
+
+.i-formlayout-spacing .i-formlayout-row .i-formlayout-captioncell, 
+.i-formlayout-spacing .i-formlayout-row .i-formlayout-contentcell,
+.i-formlayout-spacing .i-formlayout-row .i-formlayout-errorcell {
+       padding-top: 8px;
+}
+
+.i-formlayout-spacing .i-formlayout-firstrow .i-formlayout-captioncell, 
+.i-formlayout-spacing .i-formlayout-firstrow .i-formlayout-contentcell,
+.i-formlayout-spacing .i-formlayout-firstrow .i-formlayout-errorcell {
+       padding-top: 0;
+}
+
+.i-formlayout-margin-top .i-formlayout-firstrow .i-formlayout-captioncell, 
+.i-formlayout-margin-top .i-formlayout-firstrow .i-formlayout-contentcell,
+.i-formlayout-margin-top .i-formlayout-firstrow .i-formlayout-errorcell {
+       padding-top: 15px;
+}
+.i-formlayout-margin-bottom .i-formlayout-lastrow .i-formlayout-captioncell,
+.i-formlayout-margin-bottom .i-formlayout-lastrow .i-formlayout-contentcell,
+.i-formlayout-margin-bottom .i-formlayout-lastrow .i-formlayout-errorcell {
+       padding-bottom: 15px;
+}
+.i-formlayout-margin-left .i-formlayout-captioncell {
+       padding-left: 18px;
+} 
+.i-formlayout-margin-right .i-formlayout-contentcell {
+       padding-right: 18px;
+}
+
+/* form */
+
 .i-form-errormessage {
        background: transparent url(icons/16/error.png) no-repeat top left;
        padding-left: 20px;
index 3df74d99cc81d48e0d1e3c3299479335be8fba0f..22a9d6cb8b31f1f97cea605d667f1981d3dcc7ee 100644 (file)
@@ -16,6 +16,7 @@ import com.google.gwt.user.client.ui.Widget;
 import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
 import com.itmill.toolkit.terminal.gwt.client.Container;
 import com.itmill.toolkit.terminal.gwt.client.Paintable;
+import com.itmill.toolkit.terminal.gwt.client.StyleConstants;
 import com.itmill.toolkit.terminal.gwt.client.UIDL;
 import com.itmill.toolkit.terminal.gwt.client.Util;
 
@@ -24,6 +25,8 @@ import com.itmill.toolkit.terminal.gwt.client.Util;
  */
 public class IFormLayout extends FlexTable implements Container {
 
+    private final static String CLASSNAME = "i-formlayout";
+
     HashMap componentToCaption = new HashMap();
     private ApplicationConnection client;
     private HashMap componentToError = new HashMap();
@@ -35,6 +38,22 @@ public class IFormLayout extends FlexTable implements Container {
             return;
         }
 
+        final MarginInfo margins = new MarginInfo(uidl
+                .getIntAttribute("margins"));
+
+        Element margin = getElement();
+        setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_TOP,
+                margins.hasTop());
+        setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_RIGHT,
+                margins.hasRight());
+        setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_BOTTOM,
+                margins.hasBottom());
+        setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_LEFT,
+                margins.hasLeft());
+
+        setStyleName(margin, CLASSNAME + "-" + "spacing", uidl
+                .hasAttribute("spacing"));
+
         int i = 0;
         for (final Iterator it = uidl.getChildIterator(); it.hasNext(); i++) {
             prepareCell(i, 1);
@@ -58,14 +77,25 @@ public class IFormLayout extends FlexTable implements Container {
                 client.unregisterPaintable(oldComponent);
                 setWidget(i, 2, (Widget) p);
             }
-            getCellFormatter().setStyleName(i, 0, "i-formlayout-captioncell");
+            getCellFormatter().setStyleName(i, 2, CLASSNAME + "-contentcell");
+            getCellFormatter().setStyleName(i, 0, CLASSNAME + "-captioncell");
             setWidget(i, 0, caption);
 
-            getCellFormatter().setStyleName(i, 1, "i-formlayout-errorcell");
+            getCellFormatter().setStyleName(i, 1, CLASSNAME + "-errorcell");
             setWidget(i, 1, error);
 
             p.updateFromUIDL(childUidl, client);
 
+            String rowstyles = CLASSNAME + "-row";
+            if (i == 0) {
+                rowstyles += " " + CLASSNAME + "-firstrow";
+            }
+            if (!it.hasNext()) {
+                rowstyles += " " + CLASSNAME + "-lastrow";
+            }
+
+            getRowFormatter().setStyleName(i, rowstyles);
+
         }
 
         while (getRowCount() > i) {
index 10e385e308d416fde9f690d82be9b5070eb4f5aa..4789d9d8aab2d469cd07b6df8d7f0415e5923400 100644 (file)
@@ -45,7 +45,6 @@ public class IGridLayout extends SimplePanel implements Paintable, Container {
         final MarginInfo margins = new MarginInfo(uidl
                 .getIntAttribute("margins"));
 
-        // 1572
         Element margin = getElement();
         setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_TOP,
                 margins.hasTop());