From: Matti Tahvonen Date: Mon, 9 Jun 2008 12:19:14 +0000 (+0000) Subject: margins + component spacings for formlayout, removed obsolete comment X-Git-Tag: 6.7.0.beta1~4639 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=aa5369d224ff07a9039ee1fe1c216c49861a7dde;p=vaadin-framework.git margins + component spacings for formlayout, removed obsolete comment svn changeset:4815/svn branch:trunk --- diff --git a/WebContent/ITMILL/themes/default/formlayout/formlayout.css b/WebContent/ITMILL/themes/default/formlayout/formlayout.css index 574e85e21f..e5a27ade38 100644 --- a/WebContent/ITMILL/themes/default/formlayout/formlayout.css +++ b/WebContent/ITMILL/themes/default/formlayout/formlayout.css @@ -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; diff --git a/WebContent/ITMILL/themes/default/styles.css b/WebContent/ITMILL/themes/default/styles.css index fc01584d30..e326282343 100644 --- a/WebContent/ITMILL/themes/default/styles.css +++ b/WebContent/ITMILL/themes/default/styles.css @@ -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; diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IFormLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IFormLayout.java index 3df74d99cc..22a9d6cb8b 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IFormLayout.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IFormLayout.java @@ -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) { diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java index 10e385e308..4789d9d8aa 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java @@ -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());