public class Escalator extends com.google.gwt.user.client.ui.Widget implements com.google.gwt.user.client.ui.RequiresResize, DeferredWorker, SubPartAware
Modifier and Type | Class and Description |
---|---|
class |
Escalator.AbstractRowContainer |
static class |
Escalator.SubPartArguments
Utility class for parsing and storing SubPart request string attributes
for Grid and Escalator.
|
Constructor and Description |
---|
Escalator()
Creates a new Escalator widget instance.
|
Modifier and Type | Method and Description |
---|---|
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
|
RowContainer |
findRowContainer(com.google.gwt.dom.client.Element element)
Returns the
RowContainer which contains the element. |
RowContainer.BodyRowContainer |
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 . |
HeightMode |
getHeightMode()
Returns the current
HeightMode the Escalator is in. |
double |
getInnerWidth()
Gets the escalator's inner width.
|
int |
getMaxVisibleRowCount()
Gets the maximum number of body rows that can be visible on the screen at
once.
|
double |
getScrollHeight()
Returns the scroll height for the escalator.
|
double |
getScrollLeft()
Returns the logical horizontal scroll offset.
|
double |
getScrollTop()
Returns the vertical scroll offset.
|
double |
getScrollWidth()
Returns the scroll width for the escalator.
|
com.google.gwt.user.client.Element |
getSubPartElement(String subPart)
Locates an element inside a component using the identifier provided in
subPart . |
String |
getSubPartName(com.google.gwt.user.client.Element subElement)
Provides an identifier that identifies the element within the component.
|
Range |
getVisibleRowRange()
Gets the logical index 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 or connector
that must be executed before reaching a steady state.
|
protected void |
onLoad() |
void |
onResize() |
protected void |
onUnload() |
void |
resetSizesFromDom()
Resets all cached pixel sizes and reads new values from the DOM.
|
void |
scrollToColumn(int columnIndex,
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,
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 |
scrollToRowAndSpacer(int rowIndex,
ScrollDestination destination,
int padding)
Scrolls vertically to a row and the spacer below it.
|
void |
scrollToSpacer(int spacerIndex,
ScrollDestination destination,
int padding)
Scrolls the body vertically so that the spacer at the given row index is
visible and there is at least padding pixesl to the given
scroll destination.
|
void |
setHeight(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(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(String style) |
void |
setWidth(String width) |
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkBitlessEvent, toString
protected void onLoad()
onLoad
in class com.google.gwt.user.client.ui.Widget
protected void onUnload()
onUnload
in class com.google.gwt.user.client.ui.Widget
public RowContainer getHeader()
null
public RowContainer.BodyRowContainer getBody()
null
public RowContainer getFooter()
null
public ColumnConfiguration getColumnConfiguration()
null
public void setWidth(String width)
setWidth
in class com.google.gwt.user.client.ui.UIObject
public void setHeight(String height)
If Escalator is currently not in HeightMode.CSS
, the given value
is remembered, and applied once the mode is applied.
setHeight
in class com.google.gwt.user.client.ui.UIObject
setHeightMode(HeightMode)
public double getScrollTop()
scrollTop
attribute in the DOM.public void setScrollTop(double scrollTop)
scrollTop
attribute in the DOM.scrollTop
- the number of pixels to scroll verticallypublic double getScrollLeft()
scrollLeft
attribute in the DOM.public void setScrollLeft(double scrollLeft)
scrollLeft
attribute in the DOM.scrollLeft
- the number of pixels to scroll horizontallypublic double getScrollWidth()
Element.scrollWidth
in the DOM.public double getScrollHeight()
Element.scrollHeight
in the DOM.public void scrollToColumn(int columnIndex, ScrollDestination destination, int padding) throws IndexOutOfBoundsException, IllegalArgumentException
padding
pixels in the direction of
the given scroll destination.columnIndex
- the index of the column to scroll todestination
- where the column should be aligned visually after scrollingpadding
- the number pixels to place between the scrolled-to column and
the viewport edge.IndexOutOfBoundsException
- if columnIndex
is not a valid index for an existing
columnIllegalArgumentException
- if destination
is ScrollDestination.MIDDLE
and padding is nonzero; or if the indicated column is frozen;
or if destination == null
public void scrollToRow(int rowIndex, ScrollDestination destination, int padding) throws IndexOutOfBoundsException, IllegalArgumentException
rowIndex
- the index of the logical row to scroll todestination
- where the row should be aligned visually after scrollingpadding
- the number pixels to place between the scrolled-to row and the
viewport edge.IndexOutOfBoundsException
- if rowIndex
is not a valid index for an existing rowIllegalArgumentException
- if destination
is ScrollDestination.MIDDLE
and padding is nonzero; or if destination == null
scrollToRowAndSpacer(int, ScrollDestination, int)
,
scrollToSpacer(int, ScrollDestination, int)
public void scrollToSpacer(int spacerIndex, ScrollDestination destination, int padding) throws IllegalArgumentException
spacerIndex
- the row index of the spacer to scroll todestination
- where the spacer should be aligned visually after scrollingpadding
- the number of pixels to place between the scrolled-to spacer
and the viewport edgeIllegalArgumentException
- if spacerIndex
is not an opened spacer; or if
destination
is ScrollDestination.MIDDLE
and
padding is nonzero; or if destination == null
scrollToRow(int, ScrollDestination, int)
,
scrollToRowAndSpacer(int, ScrollDestination, int)
public void scrollToRowAndSpacer(int rowIndex, ScrollDestination destination, int padding) throws IllegalArgumentException
If a spacer is not open at that index, this method behaves like
scrollToRow(int, ScrollDestination, int)
rowIndex
- the index of the logical row to scroll to. -1 takes the
topmost spacer into account as well.destination
- where the row should be aligned visually after scrollingpadding
- the number pixels to place between the scrolled-to row and the
viewport edge.IllegalArgumentException
- if destination
is ScrollDestination.MIDDLE
and padding
is not zero; or if rowIndex
is
not a valid row index, or -1; or if
destination == null
; or if rowIndex == -1
and
there is no spacer open at that index.scrollToRow(int, ScrollDestination, int)
,
scrollToSpacer(int, ScrollDestination, int)
public com.google.gwt.event.shared.HandlerRegistration addRowVisibilityChangeHandler(RowVisibilityChangeHandler rowVisibilityChangeHandler)
rowVisibilityChangeHandler
- the event handlerpublic Range getVisibleRowRange()
public void setStylePrimaryName(String style)
setStylePrimaryName
in class com.google.gwt.user.client.ui.UIObject
public void setHeightByRows(double rows) throws IllegalArgumentException
getHeightMode()
is HeightMode.ROW
.
If Escalator is currently not in HeightMode.ROW
, the given value
is remembered, and applied once the mode is applied.
rows
- the number of rows that should be visible in Escalator's bodyIllegalArgumentException
- if rows
is ≤ 0, infinite
or NaN
.setHeightMode(HeightMode)
public double getHeightByRows()
getHeightMode()
is HeightMode.ROW
.
By default, it is 10.
setHeightByRows(double)
public void setHeightMode(HeightMode heightMode)
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.
heightMode
- the mode in to which Escalator should be setpublic HeightMode getHeightMode()
HeightMode
the Escalator is in.
Defaults to HeightMode.CSS
.
public RowContainer findRowContainer(com.google.gwt.dom.client.Element element)
RowContainer
which contains the element.element
- the element to check fornull
if element
is not present in any container.public void setScrollLocked(ScrollbarBundle.Direction direction, boolean locked)
If a direction is locked, the escalator will refuse to scroll in that direction.
direction
- the orientation of the scroll to set the lock statuslocked
- true
to lock, false
to unlockpublic boolean isScrollLocked(ScrollbarBundle.Direction direction)
direction
- the direction of the scroll of which to check the lock statustrue
iff the direction is lockedpublic com.google.gwt.event.shared.HandlerRegistration addScrollHandler(ScrollHandler handler)
handler
- the scroll handler to addpublic boolean isWorkPending()
DeferredWorker
isWorkPending
in interface DeferredWorker
public void onResize()
onResize
in interface com.google.gwt.user.client.ui.RequiresResize
public int getMaxVisibleRowCount()
public double getInnerWidth()
public void resetSizesFromDom()
public com.google.gwt.user.client.Element getSubPartElement(String subPart)
SubPartAware
subPart
. The subPart
identifier is component specific and
may be any string of characters, numbers, space characters and brackets.getSubPartElement
in interface SubPartAware
subPart
- The identifier for the element inside the componentpublic String getSubPartName(com.google.gwt.user.client.Element subElement)
SubPartAware
subElement
is a part of the component and must never be null.
Note!
getSubPartElement(getSubPartName(element)) == element
is not
always true. A component can choose to provide a more generic
identifier for any given element if the results of all interactions with
subElement
are the same as interactions with the element
identified by the return value. For example a button can return an
identifier for the root element even though a DIV inside the button was
passed as subElement
because interactions with the DIV and the
root button element produce the same result.
getSubPartName
in interface SubPartAware
subElement
- The element the identifier string should uniquely identifysubElement
or null
if no identifier could be provided.Copyright © 2019 Vaadin Ltd. All rights reserved.