From 1a30320913e8b9ea851af3ed4a659f969aa92ee6 Mon Sep 17 00:00:00 2001 From: Tien Nguyen Date: Tue, 4 Apr 2017 17:39:24 +0300 Subject: Fix bug column and row expand ratio are not persisted Fixes #9009 --- server/src/main/java/com/vaadin/ui/GridLayout.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'server/src/main/java/com/vaadin') diff --git a/server/src/main/java/com/vaadin/ui/GridLayout.java b/server/src/main/java/com/vaadin/ui/GridLayout.java index a9607ca96f..5a02f49fb8 100644 --- a/server/src/main/java/com/vaadin/ui/GridLayout.java +++ b/server/src/main/java/com/vaadin/ui/GridLayout.java @@ -1277,14 +1277,14 @@ public class GridLayout extends AbstractLayout } setRows(Math.max(rows.size(), 1)); Map alignments = new HashMap<>(); - List columnExpandRatios = new ArrayList<>(); + List columnExpandRatios = new ArrayList<>(); for (int row = 0; row < rowElements.size(); ++row) { Element rowElement = rowElements.get(row); // Row Expand if (rowElement.hasAttr("expand")) { - int expand = DesignAttributeHandler.readAttribute("expand", - rowElement.attributes(), int.class); + float expand = DesignAttributeHandler.readAttribute("expand", + rowElement.attributes(), float.class); setRowExpandRatio(row, expand); } @@ -1334,11 +1334,11 @@ public class GridLayout extends AbstractLayout if (row == 0) { if (col.hasAttr("expand")) { for (String expand : col.attr("expand").split(",")) { - columnExpandRatios.add(Integer.parseInt(expand)); + columnExpandRatios.add(Float.parseFloat(expand)); } } else { for (int c = 0; c < colspan; ++c) { - columnExpandRatios.add(0); + columnExpandRatios.add(0f); } } } @@ -1442,7 +1442,7 @@ public class GridLayout extends AbstractLayout // Row Expand DesignAttributeHandler.writeAttribute("expand", row.attributes(), - (int) getRowExpandRatio(i), 0, int.class, designContext); + getRowExpandRatio(i), 0.0f, float.class, designContext); int colspan = 1; Element col; @@ -1483,7 +1483,7 @@ public class GridLayout extends AbstractLayout // A column with expand and no content in the end of // first row needs to be present. for (int c = j; c < componentMap[i].length; ++c) { - if ((int) getColumnExpandRatio(c) > 0) { + if (getColumnExpandRatio(c) > 0) { hasExpands = true; } } @@ -1525,7 +1525,7 @@ public class GridLayout extends AbstractLayout String expands = ""; boolean expandRatios = false; for (int c = 0; c < colspan; ++c) { - int colExpand = (int) getColumnExpandRatio(j + c); + float colExpand = getColumnExpandRatio(j + c); if (colExpand > 0) { expandRatios = true; } -- cgit v1.2.3