Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

RowVisibilityChangeEvent.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.v7.client.widget.escalator;
  17. import com.google.gwt.event.shared.GwtEvent;
  18. import com.vaadin.shared.ui.grid.Range;
  19. /**
  20. * Event fired when the range of visible rows changes e.g. because of scrolling.
  21. *
  22. * @since 7.4
  23. * @author Vaadin Ltd
  24. */
  25. public class RowVisibilityChangeEvent
  26. extends GwtEvent<RowVisibilityChangeHandler> {
  27. /**
  28. * The type of this event.
  29. */
  30. public static final Type<RowVisibilityChangeHandler> TYPE = new Type<RowVisibilityChangeHandler>();
  31. private final Range visibleRows;
  32. /**
  33. * Creates a new row visibility change event
  34. *
  35. * @param firstVisibleRow
  36. * the index of the first visible row
  37. * @param visibleRowCount
  38. * the number of visible rows
  39. */
  40. public RowVisibilityChangeEvent(int firstVisibleRow, int visibleRowCount) {
  41. visibleRows = Range.withLength(firstVisibleRow, visibleRowCount);
  42. }
  43. /**
  44. * Gets the index of the first row that is at least partially visible.
  45. *
  46. * @return the index of the first visible row
  47. */
  48. public int getFirstVisibleRow() {
  49. return visibleRows.getStart();
  50. }
  51. /**
  52. * Gets the number of at least partially visible rows.
  53. *
  54. * @return the number of visible rows
  55. */
  56. public int getVisibleRowCount() {
  57. return visibleRows.length();
  58. }
  59. /**
  60. * Gets the range of visible rows.
  61. *
  62. * @since 7.6
  63. * @return the visible rows
  64. */
  65. public Range getVisibleRowRange() {
  66. return visibleRows;
  67. }
  68. /*
  69. * (non-Javadoc)
  70. *
  71. * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
  72. */
  73. @Override
  74. public Type<RowVisibilityChangeHandler> getAssociatedType() {
  75. return TYPE;
  76. }
  77. /*
  78. * (non-Javadoc)
  79. *
  80. * @see
  81. * com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared
  82. * .EventHandler)
  83. */
  84. @Override
  85. protected void dispatch(RowVisibilityChangeHandler handler) {
  86. handler.onRowVisibilityChange(this);
  87. }
  88. }