]> source.dussan.org Git - vaadin-framework.git/commitdiff
Convenience Window.setPosition(x,y) (#16335)
authorArtur Signell <artur@vaadin.com>
Mon, 19 Jan 2015 14:16:35 +0000 (16:16 +0200)
committerVaadin Code Review <review@vaadin.com>
Fri, 5 Jun 2015 12:58:55 +0000 (12:58 +0000)
Change-Id: If574863fc24cecb9f8d17773833817d67f3a0e12

server/src/com/vaadin/ui/Window.java
server/tests/src/com/vaadin/tests/server/component/window/WindowTest.java

index 61664fc95d635cff9b449e2fe485b572a3d883b3..4d63f40043f72689be904c2db5a883dc80150043 100644 (file)
@@ -267,6 +267,21 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
         return getState(false).positionX;
     }
 
+    /**
+     * 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}
index b74896b7a1b6f5a5c120922843b81b50159694c0..e9e73c1e0fc4e61b0635fed03e8880b61f603feb 100644 (file)
@@ -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());
+    }
 }