gwt.material.design.client.base.helper.ScrollHelper Java Examples
The following examples show how to use
gwt.material.design.client.base.helper.ScrollHelper.
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 |
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: QuestionFieldGroup.java From gwt-material-addins with Apache License 2.0 | 6 votes |
protected void load() { for (Widget widget : getChildren()) { lookForChildren(widget); } for (QuestionItem question : questions) { question.addValueChangeHandler(valueChangeEvent -> { int index = questions.indexOf(question); if (index + 1 < questions.size()) { Widget target = questions.get(index + 1); new ScrollHelper().scrollTo(target); } if (!answeredQuestions.contains(question)) { answeredQuestions.add(question); questionProgress.updateProgress(answeredQuestions); } }); } if (questions != null) { questionProgress.setQuestions(questions); questionProgress.updateProgress(new ArrayList<>()); } }
Example #3
Source File: QuestionFieldGroup.java From gwt-material-addins with Apache License 2.0 | 6 votes |
@Override public boolean validate() { boolean valid = true; for (QuestionItem question : questions) { if (!question.validate()) { valid = false; } } for (QuestionItem question1 : questions) { if (!question1.validate()) { new ScrollHelper().scrollTo(question1); break; } } return valid; }
Example #4
Source File: StatusDisplayMixin.java From gwt-material with Apache License 2.0 | 5 votes |
/** * If the message tooltip is our of vertical viewport then we update the position to be at the bottom */ protected void showStatus() { if (position == null) { if (!new ScrollHelper().isInViewPort(textObject.getElement())) { position = Position.TOP; } else { position = Position.LEFT; } } updatePosition(position); textObject.getElement().getStyle().setVisibility(Style.Visibility.VISIBLE); }
Example #5
Source File: ScrollHelperTest.java From gwt-material with Apache License 2.0 | 5 votes |
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()); }
Example #6
Source File: ScrollHelperTest.java From gwt-material with Apache License 2.0 | 5 votes |
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); }
Example #7
Source File: ScrollHelperTest.java From gwt-material with Apache License 2.0 | 5 votes |
public void testDefaultContainer() { MaterialPanel target = new MaterialPanel(); ScrollHelper scrollHelper = new ScrollHelper(); scrollHelper.scrollTo(target); assertEquals($("html, body").asElement(), scrollHelper.getContainerElement().asElement()); }
Example #8
Source File: ScrollHelperTest.java From gwt-material with Apache License 2.0 | 5 votes |
public void testScrollToOffset() { final double OFFSET_TARGET = 3000.0; ScrollHelper scrollHelper = new ScrollHelper(); scrollHelper.scrollTo(OFFSET_TARGET); assertEquals(OFFSET_TARGET, scrollHelper.getOffset()); }
Example #9
Source File: MaterialPathAnimator.java From gwt-material-addins with Apache License 2.0 | 4 votes |
public MaterialPathAnimator() { this.scrollHelper = new ScrollHelper(); }
Example #10
Source File: MaterialPathAnimator.java From gwt-material-addins with Apache License 2.0 | 4 votes |
public ScrollHelper getScrollHelper() { return scrollHelper; }