Java Code Examples for gwt.material.design.client.base.helper.ScrollHelper#setCompleteCallback()

The following examples show how to use gwt.material.design.client.base.helper.ScrollHelper#setCompleteCallback() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScrollHelperTest.java    From gwt-material with Apache License 2.0 6 votes vote down vote up
protected void checkProperties(MaterialPanel target, MaterialPanel container) {
    final boolean[] firedCallback = {false};
    final String LINEAR_EASING = "linear";
    Functions.Func CALLBACK = () -> {
        firedCallback[0] = true;
    };

    ScrollHelper scrollHelper = new ScrollHelper();

    scrollHelper.setEasing(LINEAR_EASING);
    scrollHelper.setCompleteCallback(CALLBACK);
    scrollHelper.setContainer(container);
    scrollHelper.scrollTo(target);
    checkOffsetPositioning(scrollHelper);

    assertEquals(LINEAR_EASING, scrollHelper.getEasing());
    assertEquals(CALLBACK, scrollHelper.getCompleteCallback());
    assertEquals(container.getElement(), scrollHelper.getContainerElement().asElement());
}
 
Example 2
Source File: ScrollHelperTest.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
public void testScrollOnTarget() {
    // UiBinder
    // Given
    MaterialPanel container = getWidget();
    MaterialPanel target = (MaterialPanel) container.getWidget(0);
    target.setMarginTop(2000);
    target.setPaddingTop(0);

    double targetOffset = $(target.getElement()).offset().top;
    ScrollHelper scrollHelper = new ScrollHelper();
    scrollHelper.setCompleteCallback(() -> assertEquals(2000.0, targetOffset));

    scrollHelper.scrollTo(target);
}