public abstract class ScrollbarBundle extends Object implements DeferredWorker
ScrollbarBundle.VerticalScrollbarBundle,
ScrollbarBundle.HorizontalScrollbarBundle| Modifier and Type | Class and Description |
|---|---|
static class |
ScrollbarBundle.Direction
The orientation of the scrollbar.
|
static class |
ScrollbarBundle.HorizontalScrollbarBundle
A representation of a single horizontal scrollbar.
|
static class |
ScrollbarBundle.VerticalScrollbarBundle
A representation of a single vertical scrollbar.
|
static class |
ScrollbarBundle.VisibilityChangeEvent |
static interface |
ScrollbarBundle.VisibilityHandler
A means to listen to when the scrollbar handle in a
ScrollbarBundle either appears or is removed. |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isInvisibleScrollbar |
protected com.google.gwt.dom.client.Element |
root |
protected com.google.gwt.dom.client.Element |
scrollSizeElement |
| Modifier and Type | Method and Description |
|---|---|
com.google.gwt.event.shared.HandlerRegistration |
addScrollHandler(ScrollHandler handler)
Adds a scroll handler to the scrollbar bundle.
|
com.google.gwt.event.shared.HandlerRegistration |
addVisibilityHandler(ScrollbarBundle.VisibilityHandler handler)
Adds handler for the scrollbar handle visibility.
|
protected void |
forceScrollbar(boolean enable)
Force the scrollbar to be visible with CSS.
|
abstract ScrollbarBundle.Direction |
getDirection()
Returns the scroll direction of this scrollbar bundle.
|
com.google.gwt.dom.client.Element |
getElement()
Gets the root element of this scrollbar-composition.
|
protected com.google.gwt.event.shared.HandlerManager |
getHandlerManager() |
double |
getOffsetSize()
Gets the length of the scrollbar.
|
double |
getScrollbarThickness()
Gets the scrollbar's thickness.
|
double |
getScrollPos()
Gets the scroll position of the scrollbar in the axis the scrollbar is
representing.
|
double |
getScrollSize()
Gets the amount of pixels the scrollbar needs to be able to scroll
through.
|
protected abstract void |
internalForceScrollbar(boolean enable) |
abstract String |
internalGetOffsetSize() |
protected abstract String |
internalGetScrollbarThickness()
Gets the scrollbar's thickness as defined in the DOM.
|
protected abstract int |
internalGetScrollPos()
Retrieves the element's scroll position (scrollTop or scrollLeft).
|
protected abstract String |
internalGetScrollSize() |
protected abstract void |
internalSetOffsetSize(double px)
Modifies
root's dimensions in the axis the scrollbar is
representing. |
protected abstract void |
internalSetScrollbarThickness(double px)
Modifies
scrollSizeElement's dimensions in the
opposite axis to what the scrollbar is representing. |
protected abstract void |
internalSetScrollPos(int px)
Modifies the element's scroll position (scrollTop or scrollLeft).
|
protected abstract void |
internalSetScrollSize(double px)
Modifies
scrollSizeElement's dimensions in
such a way that the scrollbar is able to scroll a certain number of
pixels in the axis it is representing. |
boolean |
isLocked()
Checks whether the scrollbar bundle is locked or not.
|
boolean |
isWorkPending()
Checks whether there are operations pending for this widget or connector
that must be executed before reaching a steady state.
|
void |
onLoad()
Should be called whenever this bundle is attached to the DOM (typically,
from the onLoad of the containing widget).
|
void |
recalculateMaxScrollPos() |
void |
setLocked(boolean isLocked)
Locks or unlocks the scrollbar bundle.
|
void |
setOffsetSize(double px)
Sets the length of the scrollbar.
|
void |
setScrollbarThickness(double px)
Sets the scrollbar's thickness.
|
void |
setScrollPos(double px)
Sets the scroll position of the scrollbar in the axis the scrollbar is
representing.
|
void |
setScrollPosByDelta(double delta)
Modifies the scroll position of this scrollbar by a number of pixels.
|
void |
setScrollSize(double px)
Sets the amount of pixels the scrollbar needs to be able to scroll
through.
|
void |
setStylePrimaryName(String primaryStyleName)
Sets the primary style name.
|
boolean |
showsScrollHandle()
Checks whether the scrollbar's handle is visible.
|
protected final com.google.gwt.dom.client.Element root
protected final com.google.gwt.dom.client.Element scrollSizeElement
protected boolean isInvisibleScrollbar
protected abstract String internalGetScrollSize()
public void setStylePrimaryName(String primaryStyleName)
primaryStyleName - The primary style name to usepublic final com.google.gwt.dom.client.Element getElement()
public final void setScrollPosByDelta(double delta)
Note: Even though double values are used, they are
currently only used as integers as large int (or small but fast
long). This means, all values are truncated to zero decimal
places.
delta - the delta in pixels to change the scroll position byprotected abstract void internalSetOffsetSize(double px)
root's dimensions in the axis the scrollbar is
representing.px - the new size of root in the dimension this scrollbar
is representingpublic final void setOffsetSize(double px)
px - the length of the scrollbar in pixelsprotected void forceScrollbar(boolean enable)
overflow-x or overflow-y to "
scroll" in the scrollbar's direction.
This method is an IE8 workaround, since it doesn't always show scrollbars
with overflow: auto enabled.
Firefox on the other hand loses pending scroll events when the scrollbar is hidden, so the event must be fired manually.
When IE8 support is dropped, this should really be simplified.
protected abstract void internalForceScrollbar(boolean enable)
public double getOffsetSize()
public abstract String internalGetOffsetSize()
public final void setScrollPos(double px)
Note: Even though double values are used, they are
currently only used as integers as large int (or small but fast
long). This means, all values are truncated to zero decimal
places.
px - the new scroll position in pixelspublic void onLoad()
protected abstract void internalSetScrollPos(int px)
Note: The parameter here is a type of integer (instead of a double) by design. The browsers internally convert all double values into an integer value. To make this fact explicit, this API has chosen to force integers already at this level.
px - integer pixel value to scroll topublic final double getScrollPos()
protected abstract int internalGetScrollPos()
Note: The parameter here is a type of integer (instead of a double) by design. The browsers internally convert all double values into an integer value. To make this fact explicit, this API has chosen to force integers already at this level.
protected abstract void internalSetScrollSize(double px)
scrollSizeElement's dimensions in
such a way that the scrollbar is able to scroll a certain number of
pixels in the axis it is representing.px - the new size of scrollSizeElement in the dimension
this scrollbar is representingpublic final void setScrollSize(double px)
px - the number of pixels the scrollbar should be able to scroll
throughpublic double getScrollSize()
protected abstract void internalSetScrollbarThickness(double px)
scrollSizeElement's dimensions in the
opposite axis to what the scrollbar is representing.px - the dimension that scrollSizeElement should take in
the opposite axis to what the scrollbar is representingpublic final void setScrollbarThickness(double px)
If the thickness is set to 0, the scrollbar will be treated as an
"invisible" scrollbar. This means, the DOM structure will be given a
non-zero size, but getScrollbarThickness() will still return the
value 0.
px - the scrollbar's thickness in pixelsprotected abstract String internalGetScrollbarThickness()
public final double getScrollbarThickness()
This value will differ from the value in the DOM, if the thickness was
set to 0 with setScrollbarThickness(double), as the scrollbar is
then treated as "invisible."
public boolean showsScrollHandle()
In other words, this method checks whether the contents is larger than can visually fit in the element.
true if the scrollbar's handle is visiblepublic void recalculateMaxScrollPos()
protected com.google.gwt.event.shared.HandlerManager getHandlerManager()
public com.google.gwt.event.shared.HandlerRegistration addVisibilityHandler(ScrollbarBundle.VisibilityHandler handler)
handler - the ScrollbarBundle.VisibilityHandler to addHandlerRegistration used to remove the handlerpublic void setLocked(boolean isLocked)
A locked scrollbar bundle will refuse to scroll, both programmatically and via user-triggered events.
isLocked - true to lock, false to unlockpublic boolean isLocked()
true if the scrollbar bundle is lockedpublic abstract ScrollbarBundle.Direction getDirection()
public com.google.gwt.event.shared.HandlerRegistration addScrollHandler(ScrollHandler handler)
handler - the handler to addpublic boolean isWorkPending()
DeferredWorkerisWorkPending in interface DeferredWorkerCopyright © 2018 Vaadin Ltd. All rights reserved.