You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WindowMoveEvent.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright 2000-2018 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.client.ui.window;
  17. import com.google.gwt.event.shared.GwtEvent;
  18. /**
  19. * Event for window position updates.
  20. *
  21. * @since 7.1.9
  22. * @author Vaadin Ltd
  23. */
  24. public class WindowMoveEvent extends GwtEvent<WindowMoveHandler> {
  25. private static final Type<WindowMoveHandler> TYPE = new Type<>();
  26. private final int newX;
  27. private final int newY;
  28. /**
  29. * Creates a new event with the given parameters.
  30. *
  31. * @param x
  32. * The new x-position for the VWindow
  33. * @param y
  34. * The new y-position for the VWindow
  35. */
  36. public WindowMoveEvent(int x, int y) {
  37. newX = x;
  38. newY = y;
  39. }
  40. /**
  41. * Gets the new x position of the window.
  42. *
  43. * @return the new X position of the VWindow
  44. */
  45. public int getNewX() {
  46. return newX;
  47. }
  48. /**
  49. * Gets the new y position of the window.
  50. *
  51. * @return the new Y position of the VWindow
  52. */
  53. public int getNewY() {
  54. return newY;
  55. }
  56. /**
  57. * Gets the type of the event.
  58. *
  59. * @return the type of the event
  60. */
  61. public static Type<WindowMoveHandler> getType() {
  62. return TYPE;
  63. }
  64. @Override
  65. public Type<WindowMoveHandler> getAssociatedType() {
  66. return TYPE;
  67. }
  68. @Override
  69. protected void dispatch(WindowMoveHandler handler) {
  70. handler.onWindowMove(this);
  71. }
  72. }