2 * Copyright 2000-2016 Vaadin Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
17 package com.vaadin.v7.client.widget.escalator;
19 import com.google.gwt.event.shared.GwtEvent;
20 import com.vaadin.shared.ui.grid.Range;
23 * Event fired when the range of visible rows changes e.g. because of scrolling.
28 public class RowVisibilityChangeEvent
29 extends GwtEvent<RowVisibilityChangeHandler> {
31 * The type of this event.
33 public static final Type<RowVisibilityChangeHandler> TYPE = new Type<RowVisibilityChangeHandler>();
35 private final Range visibleRows;
38 * Creates a new row visibility change event
40 * @param firstVisibleRow
41 * the index of the first visible row
42 * @param visibleRowCount
43 * the number of visible rows
45 public RowVisibilityChangeEvent(int firstVisibleRow, int visibleRowCount) {
46 visibleRows = Range.withLength(firstVisibleRow, visibleRowCount);
50 * Gets the index of the first row that is at least partially visible.
52 * @return the index of the first visible row
54 public int getFirstVisibleRow() {
55 return visibleRows.getStart();
59 * Gets the number of at least partially visible rows.
61 * @return the number of visible rows
63 public int getVisibleRowCount() {
64 return visibleRows.length();
68 * Gets the range of visible rows.
71 * @return the visible rows
73 public Range getVisibleRowRange() {
80 * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
83 public Type<RowVisibilityChangeHandler> getAssociatedType() {
91 * com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared
95 protected void dispatch(RowVisibilityChangeHandler handler) {
96 handler.onRowVisibilityChange(this);