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.

WindowOrderEvent.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright 2000-2016 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 java.util.List;
  18. import com.google.gwt.event.shared.GwtEvent;
  19. import com.vaadin.client.ui.VWindow;
  20. /**
  21. * Event for window order position updates.
  22. *
  23. * @since 8.0
  24. *
  25. * @author Vaadin Ltd
  26. */
  27. public class WindowOrderEvent extends GwtEvent<WindowOrderHandler> {
  28. private static final Type<WindowOrderHandler> TYPE = new Type<>();
  29. private final List<VWindow> windows;
  30. /**
  31. * Creates a new event with the given order.
  32. *
  33. * @param windows
  34. * The new order position for the VWindow
  35. */
  36. public WindowOrderEvent(List<VWindow> windows) {
  37. this.windows = windows;
  38. }
  39. @Override
  40. public Type<WindowOrderHandler> getAssociatedType() {
  41. return TYPE;
  42. }
  43. /**
  44. * Returns windows in order.
  45. *
  46. * @return windows in the specific order
  47. */
  48. public VWindow[] getWindows() {
  49. return windows.toArray(new VWindow[windows.size()]);
  50. }
  51. @Override
  52. protected void dispatch(WindowOrderHandler handler) {
  53. handler.onWindowOrderChange(this);
  54. }
  55. /**
  56. * Gets the type of the event.
  57. *
  58. * @return the type of the event
  59. */
  60. public static Type<WindowOrderHandler> getType() {
  61. return TYPE;
  62. }
  63. }