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.

SpacerIndexChangedEvent.java 2.2KB

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.widget.escalator.events;
  17. import com.google.gwt.event.shared.GwtEvent;
  18. /**
  19. * Event fired when a spacer element is moved to a new index in Escalator.
  20. *
  21. * @author Vaadin Ltd
  22. * @since
  23. */
  24. public class SpacerIndexChangedEvent
  25. extends GwtEvent<SpacerIndexChangedHandler> {
  26. /**
  27. * Handler type.
  28. */
  29. public static final Type<SpacerIndexChangedHandler> TYPE = new Type<>();
  30. public static final Type<SpacerIndexChangedHandler> getType() {
  31. return TYPE;
  32. }
  33. private final int oldIndex;
  34. private final int newIndex;
  35. /**
  36. * Creates a spacer index changed event.
  37. *
  38. * @param oldIndex
  39. * old index of row to which the spacer belongs
  40. * @param newIndex
  41. * new index of row to which the spacer belongs
  42. */
  43. public SpacerIndexChangedEvent(int oldIndex, int newIndex) {
  44. this.oldIndex = oldIndex;
  45. this.newIndex = newIndex;
  46. }
  47. /**
  48. * Gets the old row index to which the spacer element belongs.
  49. *
  50. * @return the old row index to which the spacer element belongs
  51. */
  52. public int getOldIndex() {
  53. return oldIndex;
  54. }
  55. /**
  56. * Gets the new row index to which the spacer element belongs.
  57. *
  58. * @return the new row index to which the spacer element belongs
  59. */
  60. public int getNewIndex() {
  61. return newIndex;
  62. }
  63. @Override
  64. public Type<SpacerIndexChangedHandler> getAssociatedType() {
  65. return TYPE;
  66. }
  67. @Override
  68. protected void dispatch(SpacerIndexChangedHandler handler) {
  69. handler.onSpacerIndexChanged(this);
  70. }
  71. }