All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vaadin.v7.client.widget.escalator.RowVisibilityChangeEvent Maven / Gradle / Ivy

There is a newer version: 8.27.3
Show newest version
/*
 * Copyright (C) 2000-2024 Vaadin Ltd
 *
 * This program is available under Vaadin Commercial License and Service Terms.
 *
 * See  for the full
 * license.
 */

package com.vaadin.v7.client.widget.escalator;

import com.google.gwt.event.shared.GwtEvent;
import com.vaadin.shared.Range;

/**
 * Event fired when the range of visible rows changes e.g. because of scrolling.
 *
 * @since 7.4
 * @author Vaadin Ltd
 */
public class RowVisibilityChangeEvent
        extends GwtEvent {
    /**
     * The type of this event.
     */
    public static final Type TYPE = new Type();

    private final Range visibleRows;

    /**
     * Creates a new row visibility change event.
     *
     * @param firstVisibleRow
     *            the index of the first visible row
     * @param visibleRowCount
     *            the number of visible rows
     */
    public RowVisibilityChangeEvent(int firstVisibleRow, int visibleRowCount) {
        visibleRows = Range.withLength(firstVisibleRow, visibleRowCount);
    }

    /**
     * Gets the index of the first row that is at least partially visible.
     *
     * @return the index of the first visible row
     */
    public int getFirstVisibleRow() {
        return visibleRows.getStart();
    }

    /**
     * Gets the number of at least partially visible rows.
     *
     * @return the number of visible rows
     */
    public int getVisibleRowCount() {
        return visibleRows.length();
    }

    /**
     * Gets the range of visible rows.
     *
     * @since 7.6
     * @return the visible rows
     */
    public Range getVisibleRowRange() {
        return visibleRows;
    }

    /*
     * (non-Javadoc)
     *
     * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
     */
    @Override
    public Type getAssociatedType() {
        return TYPE;
    }

    /*
     * (non-Javadoc)
     *
     * @see
     * com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared
     * .EventHandler)
     */
    @Override
    protected void dispatch(RowVisibilityChangeHandler handler) {
        handler.onRowVisibilityChange(this);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy