com.vaadin.client.ui.grid
Class Escalator

java.lang.Object
  extended by Widget
      extended by com.vaadin.client.ui.grid.Escalator
All Implemented Interfaces:
DeferredWorker

public class Escalator
extends Widget
implements DeferredWorker

A low-level table-like widget that features a scrolling virtual viewport and lazily generated rows.

Since:
Author:
Vaadin Ltd

Nested Class Summary
protected  class Escalator.AbstractRowContainer
           
 
Constructor Summary
Escalator()
          Creates a new Escalator widget instance.
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addRowVisibilityChangeHandler(RowVisibilityChangeHandler rowVisibilityChangeHandler)
          Adds an event handler that gets notified when the range of visible rows changes e.g.
 com.google.gwt.event.shared.HandlerRegistration addScrollHandler(ScrollHandler handler)
          Adds a scroll handler to this escalator
 void calculateColumnWidths()
          Forces the escalator to recalculate the widths of its columns.
 RowContainer findRowContainer(Element element)
          Returns the Escalator.AbstractRowContainer which contains the element.
 RowContainer getBody()
          Returns the row container for the body in this Escalator.
 ColumnConfiguration getColumnConfiguration()
          Returns the configuration object for the columns in this Escalator.
 RowContainer getFooter()
          Returns the row container for the footer in this Escalator.
 RowContainer getHeader()
          Returns the row container for the header in this Escalator.
 double getHeightByRows()
          Gets the amount of rows in Escalator's body that are shown, while getHeightMode() is HeightMode.ROW.
 com.vaadin.shared.ui.grid.HeightMode getHeightMode()
          Returns the current HeightMode the Escalator is in.
 double getScrollLeft()
          Returns the logical horizontal scroll offset.
 double getScrollTop()
          Returns the vertical scroll offset.
 com.vaadin.shared.ui.grid.Range getVisibleRowRange()
          Gets the range of currently visible rows.
 boolean isScrollLocked(ScrollbarBundle.Direction direction)
          Checks whether or not an direction is locked for scrolling.
 boolean isWorkPending()
          Checks whether there are operations pending for this widget that must be executed before reaching a steady state.
protected  void onLoad()
           
 void onResize()
           
protected  void onUnload()
           
 void scrollToColumn(int columnIndex, com.vaadin.shared.ui.grid.ScrollDestination destination, int padding)
          Scrolls the body horizontally so that the column at the given index is visible and there is at least padding pixels in the direction of the given scroll destination.
 void scrollToRow(int rowIndex, com.vaadin.shared.ui.grid.ScrollDestination destination, int padding)
          Scrolls the body vertically so that the row at the given index is visible and there is at least padding pixels to the given scroll destination.
 void setHeight(java.lang.String height)
          
 void setHeightByRows(double rows)
          Sets the number of rows that should be visible in Escalator's body, while getHeightMode() is HeightMode.ROW.
 void setHeightMode(com.vaadin.shared.ui.grid.HeightMode heightMode)
          Defines the mode in which the Escalator widget's height is calculated.
 void setScrollLeft(double scrollLeft)
          Sets the logical horizontal scroll offset.
 void setScrollLocked(ScrollbarBundle.Direction direction, boolean locked)
          Sets whether a scroll direction is locked or not.
 void setScrollTop(double scrollTop)
          Sets the vertical scroll offset.
 void setStylePrimaryName(java.lang.String style)
           
 void setWidth(java.lang.String width)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Escalator

public Escalator()
Creates a new Escalator widget instance.

Method Detail

onLoad

protected void onLoad()

onUnload

protected void onUnload()

getHeader

public RowContainer getHeader()
Returns the row container for the header in this Escalator.

Returns:
the header. Never null

getBody

public RowContainer getBody()
Returns the row container for the body in this Escalator.

Returns:
the body. Never null

getFooter

public RowContainer getFooter()
Returns the row container for the footer in this Escalator.

Returns:
the footer. Never null

getColumnConfiguration

public ColumnConfiguration getColumnConfiguration()
Returns the configuration object for the columns in this Escalator.

Returns:
the configuration object for the columns in this Escalator. Never null

setWidth

public void setWidth(java.lang.String width)

setHeight

public void setHeight(java.lang.String height)

If Escalator is currently not in HeightMode.CSS, the given value is remembered, and applied once the mode is applied.

See Also:
setHeightMode(HeightMode)

getScrollTop

public double getScrollTop()
Returns the vertical scroll offset. Note that this is not necessarily the same as the scrollTop attribute in the DOM.

Returns:
the logical vertical scroll offset

setScrollTop

public void setScrollTop(double scrollTop)
Sets the vertical scroll offset. Note that this will not necessarily become the same as the scrollTop attribute in the DOM.

Parameters:
scrollTop - the number of pixels to scroll vertically

getScrollLeft

public double getScrollLeft()
Returns the logical horizontal scroll offset. Note that this is not necessarily the same as the scrollLeft attribute in the DOM.

Returns:
the logical horizontal scroll offset

setScrollLeft

public void setScrollLeft(double scrollLeft)
Sets the logical horizontal scroll offset. Note that will not necessarily become the same as the scrollLeft attribute in the DOM.

Parameters:
scrollLeft - the number of pixels to scroll horizontally

scrollToColumn

public void scrollToColumn(int columnIndex,
                           com.vaadin.shared.ui.grid.ScrollDestination destination,
                           int padding)
                    throws java.lang.IndexOutOfBoundsException,
                           java.lang.IllegalArgumentException
Scrolls the body horizontally so that the column at the given index is visible and there is at least padding pixels in the direction of the given scroll destination.

Parameters:
columnIndex - the index of the column to scroll to
destination - where the column should be aligned visually after scrolling
padding - the number pixels to place between the scrolled-to column and the viewport edge.
Throws:
java.lang.IndexOutOfBoundsException - if columnIndex is not a valid index for an existing column
java.lang.IllegalArgumentException - if destination is ScrollDestination.MIDDLE and padding is nonzero, or if the indicated column is frozen

scrollToRow

public void scrollToRow(int rowIndex,
                        com.vaadin.shared.ui.grid.ScrollDestination destination,
                        int padding)
                 throws java.lang.IndexOutOfBoundsException,
                        java.lang.IllegalArgumentException
Scrolls the body vertically so that the row at the given index is visible and there is at least padding pixels to the given scroll destination.

Parameters:
rowIndex - the index of the logical row to scroll to
destination - where the row should be aligned visually after scrolling
padding - the number pixels to place between the scrolled-to row and the viewport edge.
Throws:
java.lang.IndexOutOfBoundsException - if rowIndex is not a valid index for an existing row
java.lang.IllegalArgumentException - if destination is ScrollDestination.MIDDLE and padding is nonzero

addRowVisibilityChangeHandler

public com.google.gwt.event.shared.HandlerRegistration addRowVisibilityChangeHandler(RowVisibilityChangeHandler rowVisibilityChangeHandler)
Adds an event handler that gets notified when the range of visible rows changes e.g. because of scrolling or row resizing.

Parameters:
rowVisibilityChangeHandler - the event handler
Returns:
a handler registration for the added handler

getVisibleRowRange

public com.vaadin.shared.ui.grid.Range getVisibleRowRange()
Gets the range of currently visible rows.

Returns:
range of visible rows

calculateColumnWidths

public void calculateColumnWidths()
Forces the escalator to recalculate the widths of its columns.

All columns that haven't been assigned an explicit width will be resized to fit all currently visible contents.

See Also:
ColumnConfiguration.setColumnWidth(int, int)

setStylePrimaryName

public void setStylePrimaryName(java.lang.String style)

setHeightByRows

public void setHeightByRows(double rows)
                     throws java.lang.IllegalArgumentException
Sets the number of rows that should be visible in Escalator's body, while getHeightMode() is HeightMode.ROW.

If Escalator is currently not in HeightMode.ROW, the given value is remembered, and applied once the mode is applied.

Parameters:
rows - the number of rows that should be visible in Escalator's body
Throws:
java.lang.IllegalArgumentException - if rows is ≤ 0, infinite or NaN.
See Also:
setHeightMode(HeightMode)

getHeightByRows

public double getHeightByRows()
Gets the amount of rows in Escalator's body that are shown, while getHeightMode() is HeightMode.ROW.

By default, it is .

Returns:
the amount of rows that are being shown in Escalator's body
See Also:
setHeightByRows(double)

setHeightMode

public void setHeightMode(com.vaadin.shared.ui.grid.HeightMode heightMode)
Defines the mode in which the Escalator widget's height is calculated.

If HeightMode.CSS is given, Escalator will respect the values given via setHeight(String), and behave as a traditional Widget.

If HeightMode.ROW is given, Escalator will make sure that the body will display as many rows as getHeightByRows() defines. Note: If headers/footers are inserted or removed, the widget will resize itself to still display the required amount of rows in its body. It also takes the horizontal scrollbar into account.

Parameters:
heightMode - the mode in to which Escalator should be set

getHeightMode

public com.vaadin.shared.ui.grid.HeightMode getHeightMode()
Returns the current HeightMode the Escalator is in.

Defaults to HeightMode.CSS.

Returns:
the current HeightMode

findRowContainer

public RowContainer findRowContainer(Element element)
Returns the Escalator.AbstractRowContainer which contains the element.

Parameters:
element - the element to check for
Returns:
the container the element is in or null if element is not present in any container.

setScrollLocked

public void setScrollLocked(ScrollbarBundle.Direction direction,
                            boolean locked)
Sets whether a scroll direction is locked or not.

If a direction is locked, the escalator will refuse to scroll in that direction.

Parameters:
direction - the orientation of the scroll to set the lock status
locked - true to lock, false to unlock

isScrollLocked

public boolean isScrollLocked(ScrollbarBundle.Direction direction)
Checks whether or not an direction is locked for scrolling.

Parameters:
direction - the direction of the scroll of which to check the lock status
Returns:
true iff the direction is locked

addScrollHandler

public com.google.gwt.event.shared.HandlerRegistration addScrollHandler(ScrollHandler handler)
Adds a scroll handler to this escalator

Parameters:
handler - the scroll handler to add
Returns:
a handler registration for the registered scroll handler

isWorkPending

public boolean isWorkPending()
Description copied from interface: DeferredWorker
Checks whether there are operations pending for this widget that must be executed before reaching a steady state.

Specified by:
isWorkPending in interface DeferredWorker

onResize

public void onResize()


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.