Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

SpacerVisibilityChangedEvent.java 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright 2000-2021 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 hidden or shown in Escalator.
  20. *
  21. * @author Vaadin Ltd
  22. * @since 8.3.2
  23. */
  24. public class SpacerVisibilityChangedEvent
  25. extends GwtEvent<SpacerVisibilityChangedHandler> {
  26. /**
  27. * Handler type.
  28. */
  29. public static final Type<SpacerVisibilityChangedHandler> TYPE = new Type<>();
  30. /**
  31. * Returns the associated handler type.
  32. *
  33. * @return the handler type
  34. */
  35. public static final Type<SpacerVisibilityChangedHandler> getType() {
  36. return TYPE;
  37. }
  38. private final int rowIndex;
  39. private final boolean visible;
  40. /**
  41. * Creates a spacer visibility changed event.
  42. *
  43. * @param rowIndex
  44. * index of row to which the spacer belongs
  45. * @param visible
  46. * {@code true} if the spacer element is shown, {@code false} if
  47. * the spacer element is hidden
  48. */
  49. public SpacerVisibilityChangedEvent(int rowIndex, boolean visible) {
  50. this.rowIndex = rowIndex;
  51. this.visible = visible;
  52. }
  53. /**
  54. * Gets the row index to which the spacer element belongs.
  55. *
  56. * @return the row index to which the spacer element belongs
  57. */
  58. public int getRowIndex() {
  59. return rowIndex;
  60. }
  61. /**
  62. * Gets whether the spacer element is displayed.
  63. *
  64. * @return {@code true} if the spacer element is shown, {@code false} if the
  65. * spacer element is hidden
  66. */
  67. public boolean isSpacerVisible() {
  68. return visible;
  69. }
  70. @Override
  71. public Type<SpacerVisibilityChangedHandler> getAssociatedType() {
  72. return TYPE;
  73. }
  74. @Override
  75. protected void dispatch(SpacerVisibilityChangedHandler handler) {
  76. handler.onSpacerVisibilityChanged(this);
  77. }
  78. }