/* @ITMillApache2LicenseForJavaFiles@ */ package com.vaadin.terminal; import java.io.Serializable; /** *

* This interface is implemented by all visual objects that can be scrolled * programmatically from the server-side, or for which it is possible to know * the scroll position on the server-side. The unit of scrolling is pixel. *

* * @author IT Mill Ltd. * @version * @VERSION@ * @since 3.0 */ public interface Scrollable extends Serializable { /** * Gets scroll left offset. * *

* Scrolling offset is the number of pixels this scrollable has been * scrolled right. *

* * @return Horizontal scrolling position in pixels. */ public int getScrollLeft(); /** * Sets scroll left offset. * *

* Scrolling offset is the number of pixels this scrollable has been * scrolled right. *

* *

* The method only has effect if programmatic scrolling is enabled for the * scrollable. Some implementations may require enabling programmatic before * this method can be used. See {@link #setScrollable(boolean)} for more * information. *

* * @param pixelsScrolled * the xOffset. */ public void setScrollLeft(int pixelsScrolled); /** * Gets scroll top offset. * *

* Scrolling offset is the number of pixels this scrollable has been * scrolled down. *

* * @return Vertical scrolling position in pixels. */ public int getScrollTop(); /** * Sets scroll top offset. * *

* Scrolling offset is the number of pixels this scrollable has been * scrolled down. *

* *

* The method only has effect if programmatic scrolling is enabled for the * scrollable. Some implementations may require enabling programmatic before * this method can be used. See {@link #setScrollable(boolean)} for more * information. *

* *

* The scrolling position is limited by the current height of the content * area. If the position is below the height, it is scrolled to the bottom. * However, if the same response also adds height to the content area, * scrolling to bottom only scrolls to the bottom of the previous content * area. *

* * @param pixelsScrolled * the yOffset. */ public void setScrollTop(int pixelsScrolled); /** * Is programmatic scrolling enabled. * *

* Whether programmatic scrolling with {@link #setScrollLeft(int)} and * {@link #setScrollTop(int)} is enabled. *

* * @return true if the scrolling is enabled, otherwise * false. */ public boolean isScrollable(); /** * Enables or disables programmatic scrolling. * *

* Enables setting the scroll position with {@link #setScrollLeft(int)} and * {@link #setScrollTop(int)}. Implementations of the interface may have * programmatic scrolling disabled by default, in which case you need to * enable it to use the mentioned methods. *

* *

* Notice that this does not control whether scroll bars are shown * for a scrollable component. That normally happens automatically when the * content grows too big for the component, relying on the "overflow: auto" * property in CSS. *

* * @param isScrollingEnabled * true if the scrolling is allowed. */ public void setScrollable(boolean isScrollingEnabled); }