diff options
-rw-r--r-- | server/src/com/vaadin/ui/Window.java | 15 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/window/WindowTest.java | 7 |
2 files changed, 22 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index 61664fc95d..4d63f40043 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -268,6 +268,21 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, } /** + * Sets the position of the window on the screen using + * {@link #setPositionX(int)} and {@link #setPositionY(int)} + * + * @since + * @param x + * The new x coordinate for the window + * @param y + * The new y coordinate for the window + */ + public void setPosition(int x, int y) { + setPositionX(x); + setPositionY(y); + } + + /** * Sets the distance of Window left border in pixels from left border of the * containing (main window). Has effect only if in {@link WindowMode#NORMAL} * mode. diff --git a/server/tests/src/com/vaadin/tests/server/component/window/WindowTest.java b/server/tests/src/com/vaadin/tests/server/component/window/WindowTest.java index b74896b7a1..e9e73c1e0f 100644 --- a/server/tests/src/com/vaadin/tests/server/component/window/WindowTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/window/WindowTest.java @@ -50,4 +50,11 @@ public class WindowTest { Assert.assertEquals(b2, window.getAssistiveDescription()[1]); } + + @Test + public void testSetPosition() { + window.setPosition(100, 200); + Assert.assertEquals(100, window.getPositionX()); + Assert.assertEquals(200, window.getPositionY()); + } } |