diff options
author | Marc Englund <marc.englund@itmill.com> | 2008-12-16 13:28:27 +0000 |
---|---|---|
committer | Marc Englund <marc.englund@itmill.com> | 2008-12-16 13:28:27 +0000 |
commit | f5ab96c4ebca557e7f98c85f5c3e904f11e1366b (patch) | |
tree | 5d67d90f662ad4e5538766067d47c4f1c1eb3c3a /src | |
parent | 265ce730b42982b4d79643cf426aad76cda962f7 (diff) | |
download | vaadin-framework-f5ab96c4ebca557e7f98c85f5c3e904f11e1366b.tar.gz vaadin-framework-f5ab96c4ebca557e7f98c85f5c3e904f11e1366b.zip |
Testcase & fix for #2337
svn changeset:6229/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/com/itmill/toolkit/tests/tickets/Ticket2337.java | 43 | ||||
-rw-r--r-- | src/com/itmill/toolkit/ui/GridLayout.java | 13 |
2 files changed, 52 insertions, 4 deletions
diff --git a/src/com/itmill/toolkit/tests/tickets/Ticket2337.java b/src/com/itmill/toolkit/tests/tickets/Ticket2337.java new file mode 100644 index 0000000000..6747968482 --- /dev/null +++ b/src/com/itmill/toolkit/tests/tickets/Ticket2337.java @@ -0,0 +1,43 @@ +package com.itmill.toolkit.tests.tickets; + +import com.itmill.toolkit.Application; +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.GridLayout; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; + +public class Ticket2337 extends Application { + + GridLayout gl = new GridLayout(3, 1); + + public void init() { + Window w = new Window(); + setMainWindow(w); + Button b = new Button("add", new Button.ClickListener() { + + public void buttonClick(ClickEvent event) { + gl.addComponent(new Label("asd"), 0, gl.getCursorY(), 2, gl + .getCursorY()); + + } + + }); + w.addComponent(b); + + b = new Button("empty", new Button.ClickListener() { + + public void buttonClick(ClickEvent event) { + gl.removeAllComponents(); + ; + + } + + }); + w.addComponent(b); + + w.addComponent(gl); + + } + +} diff --git a/src/com/itmill/toolkit/ui/GridLayout.java b/src/com/itmill/toolkit/ui/GridLayout.java index 0b43cb6ba5..114d3dce9c 100644 --- a/src/com/itmill/toolkit/ui/GridLayout.java +++ b/src/com/itmill/toolkit/ui/GridLayout.java @@ -203,12 +203,17 @@ public class GridLayout extends AbstractLayout implements // outside this area, even if it's occupied if (cursorX >= column1 && cursorX <= column2 && cursorY >= row1 && cursorY <= row2) { - cursorX = column2 + 1; + // cursor within area + cursorX = column2 + 1; // one right of area if (cursorX >= cols) { - cursorX = 0; + // overflowed columns + cursorX = 0; // first col + // move one row down, or one row under the area cursorY = (column1 == 0 ? row2 : row1) + 1; - } else { - cursorY = row1; + if (cursorY >= rows) { + // rows overflow, increase + rows = cursorY + 1; + } } } |