From: Matti Tahvonen Date: Thu, 5 Jun 2008 16:03:14 +0000 (+0000) Subject: #1572 : updated test case and spacing implementation X-Git-Tag: 6.7.0.beta1~4654 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dfea95fc3e51267e373b3fc3f5e2dde5412092e0;p=vaadin-framework.git #1572 : updated test case and spacing implementation svn changeset:4769/svn branch:trunk --- diff --git a/WebContent/ITMILL/themes/default/gridlayout/gridlayout.css b/WebContent/ITMILL/themes/default/gridlayout/gridlayout.css index a4634c1e1e..ab0cd36f74 100644 --- a/WebContent/ITMILL/themes/default/gridlayout/gridlayout.css +++ b/WebContent/ITMILL/themes/default/gridlayout/gridlayout.css @@ -10,3 +10,27 @@ .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; +} diff --git a/WebContent/ITMILL/themes/default/styles.css b/WebContent/ITMILL/themes/default/styles.css index 92d2005ca3..63f297fa09 100644 --- a/WebContent/ITMILL/themes/default/styles.css +++ b/WebContent/ITMILL/themes/default/styles.css @@ -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; 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 e238bbd685..10e385e308 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java @@ -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; diff --git a/src/com/itmill/toolkit/tests/tickets/Ticket1572.java b/src/com/itmill/toolkit/tests/tickets/Ticket1572.java index 4f0791a4e0..6de0fd56d3 100644 --- a/src/com/itmill/toolkit/tests/tickets/Ticket1572.java +++ b/src/com/itmill/toolkit/tests/tickets/Ticket1572.java @@ -46,7 +46,7 @@ public class Ticket1572 extends com.itmill.toolkit.Application { main.addComponent(b); Button b2 = new Button("next spacing state"); - b.addListener(new Button.ClickListener() { + b2.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { nextSpacingState(); } @@ -101,8 +101,17 @@ public class Ticket1572 extends com.itmill.toolkit.Application { } } + private boolean spacing = true; + private void nextSpacingState() { - spacingstate.setValue(" // TODO Auto-generated method stub"); + spacing = !spacing; + if (spacing) { + gl.setSpacing(true); + spacingstate.setValue("Spacing on"); + } else { + gl.setSpacing(false); + spacingstate.setValue("Spacing off"); + } } }