Java源码示例:gwt.material.design.client.constants.OffsetPosition

示例1
protected void checkOffsetPositioning(ScrollHelper scrollHelper) {
    scrollHelper.setOffsetPosition(OffsetPosition.TOP);
    assertEquals(OffsetPosition.TOP, scrollHelper.getOffsetPosition());
    scrollHelper.setOffsetPosition(OffsetPosition.MIDDLE);
    assertEquals(OffsetPosition.MIDDLE, scrollHelper.getOffsetPosition());
    scrollHelper.setOffsetPosition(OffsetPosition.BOTTOM);
    assertEquals(OffsetPosition.BOTTOM, scrollHelper.getOffsetPosition());
}
 
示例2
/**
 * Will detect if the target / source element is out of scope in the viewport.
 * If it is then we will call {@link ScrollHelper#scrollTo(double)} with default offset position
 * of {@link OffsetPosition#MIDDLE}.
 */
protected void detectOutOfScopeElement(Element element, Functions.Func callback) {
    if (element != null) {
        if (scrollHelper.isInViewPort(element)) {
            callback.call();
        } else {
            scrollHelper.setOffsetPosition(OffsetPosition.MIDDLE);
            scrollHelper.setCompleteCallback(() -> callback.call());
            scrollHelper.scrollTo(element);
        }
    }
}
 
示例3
public OffsetPosition getOffsetPosition() {
    return offsetPosition;
}
 
示例4
@UiHandler("scrollToTop")
void scrollToTop(ClickEvent e) {
    scrollHelper.setOffsetPosition(OffsetPosition.TOP);
    scrollHelper.scrollTo(target);
}
 
示例5
@UiHandler("scrollToMiddle")
void scrollToMiddle(ClickEvent e) {
    scrollHelper.setOffsetPosition(OffsetPosition.MIDDLE);
    scrollHelper.scrollTo(target);
}
 
示例6
@UiHandler("scrollToBottom")
void scrollToBottom(ClickEvent e) {
    scrollHelper.setOffsetPosition(OffsetPosition.BOTTOM);
    scrollHelper.scrollTo(target);
}
 
示例7
/**
 * Will set the desired offset position of the target element.
 * Available options are TOP, MIDDLE and BOTTOM.
 */
public void setOffsetPosition(OffsetPosition offsetPosition) {
    this.offsetPosition = offsetPosition;
}