diff options
author | Jouni Koivuviita <jouni.koivuviita@itmill.com> | 2007-12-13 10:11:49 +0000 |
---|---|---|
committer | Jouni Koivuviita <jouni.koivuviita@itmill.com> | 2007-12-13 10:11:49 +0000 |
commit | c4dbcb707ce15346c1c6e297eaa2e42bbe186d8c (patch) | |
tree | 88f7e72df4492c5c3ada45dd1d4368459ab1d300 /src/com/itmill/toolkit/ui/GridLayout.java | |
parent | f5f2e1116704d9019c99e17691889f70621e6b4c (diff) | |
download | vaadin-framework-c4dbcb707ce15346c1c6e297eaa2e42bbe186d8c.tar.gz vaadin-framework-c4dbcb707ce15346c1c6e297eaa2e42bbe186d8c.zip |
Major layout API changes: Sizeable is now deprecated. Use HasSize-interface instead in combination with Size object (see ExpandLayout.java for example). OrderedLayout is no longer sizable. Table and Panel implement compatibility methods to proxy old size calls to the new Size object.
svn changeset:3228/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/GridLayout.java')
-rw-r--r-- | src/com/itmill/toolkit/ui/GridLayout.java | 66 |
1 files changed, 26 insertions, 40 deletions
diff --git a/src/com/itmill/toolkit/ui/GridLayout.java b/src/com/itmill/toolkit/ui/GridLayout.java index e7f5293b23..990ba634e2 100644 --- a/src/com/itmill/toolkit/ui/GridLayout.java +++ b/src/com/itmill/toolkit/ui/GridLayout.java @@ -10,9 +10,10 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.Map; +import com.itmill.toolkit.terminal.HasSize; import com.itmill.toolkit.terminal.PaintException; import com.itmill.toolkit.terminal.PaintTarget; -import com.itmill.toolkit.terminal.Sizeable; +import com.itmill.toolkit.terminal.Size; import com.itmill.toolkit.terminal.gwt.client.ui.AlignmentInfo; /** @@ -35,7 +36,7 @@ import com.itmill.toolkit.terminal.gwt.client.ui.AlignmentInfo; * @VERSION@ * @since 3.0 */ -public class GridLayout extends AbstractLayout { +public class GridLayout extends AbstractLayout implements HasSize { /** * Initial grid columns. @@ -111,6 +112,11 @@ public class GridLayout extends AbstractLayout { private boolean spacing = false; /** + * Sizing object. + */ + private Size size; + + /** * Constructor for grid of given size (number of cells). Note that grid's * final size depends on the items that are added into the grid. Grid grows * if you add components outside the grid's area. @@ -123,6 +129,7 @@ public class GridLayout extends AbstractLayout { public GridLayout(int columns, int rows) { setColumns(columns); setRows(rows); + size = new Size(this); } /** @@ -386,6 +393,9 @@ public class GridLayout extends AbstractLayout { super.paintContent(target); + // Size + size.paint(target); + // TODO refactor attribute names in future release. target.addAttribute("h", rows); target.addAttribute("w", cols); @@ -801,31 +811,17 @@ public class GridLayout extends AbstractLayout { } /** - * Sets the width of the layout. - * <p> - * <strong>NOTE:</strong> The behaviour of this methdod has changed in - * version 5.0. Now this method won't set the number of columns in the grid - * like it used to (use {@link #setColumns()} for that). Instead, it sets - * the actual visual width of the layout in pixels or in another unit - * specified in {@link Sizeable}.UNIT_SYMBOLS. - * </p> + * @deprecated use setColumns instead. */ - public void setWidth(int width) { - super.setWidth(width); + public void setWidth(int columns) { + setColumns(columns); } /** - * Gets the width of the layout. - * <p> - * <strong>NOTE:</strong> The behaviour of this methdod has changed in - * version 5.0. Now this method won't return the number of columns in the - * grid like it used to (use {@link #getColumns()} for that). Instead, it - * returns the actual visual width of the layout in pixels or in another - * unit specified in {@link Sizeable}.UNIT_SYMBOLS. - * </p> + * @deprecated use getColumns instead. */ public int getWidth() { - return super.getWidth(); + return getColumns(); } /** @@ -873,31 +869,17 @@ public class GridLayout extends AbstractLayout { } /** - * Set the height of the layout. - * <p> - * <strong>NOTE:</strong> The behaviour of this methdod has changed in - * version 5.0. Now this method won't set the number of rows in the grid - * like it used to (use {@link #setRows()} for that). Instead, it sets the - * actual visual height of the layout in pixels or in another unit specified - * in {@link Sizeable}.UNIT_SYMBOLS. - * </p> + * @deprecated use setRows() instead. */ - public void setHeight(int height) { - super.setHeight(height); + public void setHeight(int rows) { + setRows(rows); } /** - * Gets the height of the layout. - * <p> - * <strong>NOTE:</strong> The behaviour of this methdod has changed in - * version 5.0. Now this method won't return the number of rows in the grid - * like it used to (use {@link #getRows()} for that). Instead, it returns - * the actual visual height of the layout in pixels or in another unit - * specified in {@link Sizeable}.UNIT_SYMBOLS. - * </p> + * @deprecated use getRows() instead. */ public int getHeight() { - return super.getHeight(); + return getRows(); } /** @@ -1044,4 +1026,8 @@ public class GridLayout extends AbstractLayout { spacing = enabled; } + public Size getSize() { + return size; + } + } |