本文整理汇总了Java中com.google.gwt.event.dom.client.ScrollEvent类的典型用法代码示例。如果您正苦于以下问题:Java ScrollEvent类的具体用法?Java ScrollEvent怎么用?Java ScrollEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScrollEvent类属于com.google.gwt.event.dom.client包,在下文中一共展示了ScrollEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ShowMorePagerPanel
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
/**
* Construct a new {@link ShowMorePagerPanel}.
*/
public ShowMorePagerPanel() {
initWidget(scrollable);
// Do not let the scrollable take tab focus.
scrollable.getElement().setTabIndex(-1);
// Handle scroll events.
scrollable.addScrollHandler(new ScrollHandler() {
public void onScroll(ScrollEvent event) {
// If scrolling up, ignore the event.
int oldScrollPos = lastScrollPos;
lastScrollPos = scrollable.getVerticalScrollPosition();
if (oldScrollPos >= lastScrollPos) {
return;
}
HasRows display = getDisplay();
if (display == null) {
return;
}
int maxScrollTop = scrollable.getWidget().getOffsetHeight()
- scrollable.getOffsetHeight();
if (lastScrollPos >= maxScrollTop) {
// We are near the end, so increase the page size.
int newPageSize = Math.min(
display.getVisibleRange().getLength() + incrementSize,
display.getRowCount());
display.setVisibleRange(0, newPageSize);
}
}
});
}
示例2: onScroll
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
@Override
public void onScroll(ScrollEvent event) {
// Do nothing if content height less scroll area height
if (scrollPanel.getElement().getScrollHeight() < scrollPanel.getElement().getOffsetHeight()) {
followOutput = true;
if (delegate != null) {
delegate.onOutputScrolled(followOutput);
}
return;
}
// Follow output if scroll area is scrolled to the end
if (scrollPanel.getElement().getScrollTop() + scrollPanel.getElement().getOffsetHeight()
>= scrollPanel.getElement().getScrollHeight()) {
followOutput = true;
} else {
followOutput = false;
}
if (delegate != null) {
delegate.onOutputScrolled(followOutput);
}
}
示例3: ScrollablePanelWidget
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
public ScrollablePanelWidget() {
super();
setTouchScrollingDisabled(true);
addScrollHandler(new ScrollHandler() {
@Override
public void onScroll(final ScrollEvent event) {
ScrollablePanelWidget.this.currentScrollingPos = new ScrollData();
if (event != null && event.getRelativeElement() != null) {
final Element e = event.getRelativeElement();
ScrollablePanelWidget.this.currentScrollingPos.setTop(e.getScrollTop());
ScrollablePanelWidget.this.currentScrollingPos.setLeft(e.getScrollLeft());
ScrollablePanelWidget.this.currentScrollingPos.setBottom(e.getScrollHeight() - (e.getScrollTop() + e.getOffsetHeight()));
ScrollablePanelWidget.this.currentScrollingPos.setRight(e.getScrollWidth() - (e.getScrollLeft() + e.getOffsetWidth()));
ScrollablePanelWidget.this.currentScrollingPos.setScrollHeight(e.getScrollHeight());
ScrollablePanelWidget.this.currentScrollingPos.setScrollWidth(e.getScrollWidth());
}
startTrigger();
}
});
}
示例4: setupDefaultHandlers
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
private void setupDefaultHandlers() {
//Prevent DOMElements scrolling into view when they receive the focus
domElementContainer.addDomHandler(new ScrollHandler() {
@Override
public void onScroll(final ScrollEvent scrollEvent) {
domElementContainer.getElement().setScrollTop(0);
domElementContainer.getElement().setScrollLeft(0);
}
},
ScrollEvent.getType());
addAttachHandler(new AttachEvent.Handler() {
@Override
public void onAttachOrDetach(final AttachEvent event) {
if (event.isAttached()) {
onResize();
}
}
});
addMouseDownHandler((e) -> setFocus(true));
}
示例5: testSetupScrollBarSynchronization
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
@Test
public void testSetupScrollBarSynchronization() {
final AbsolutePanel scrollPanel = mock(AbsolutePanel.class);
final ScrollHandler scrollHandler = mock(ScrollHandler.class);
doReturn(scrollHandler).when(gridLienzoScrollHandler).onScroll();
doReturn(scrollPanel).when(gridLienzoScrollHandler).getScrollPanel();
doNothing().when(gridLienzoScrollHandler).synchronizeScrollSize();
gridLienzoScrollHandler.setupScrollBarSynchronization();
verify(gridLienzoScrollHandler).synchronizeScrollSize();
verify(scrollPanel).addDomHandler(scrollHandler,
ScrollEvent.getType());
}
示例6: init
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
public void init() {
taskScrollPanel.getElement().getStyle().setPosition(Position.ABSOLUTE);
taskScrollPanel.getElement().getStyle().setOverflow(Overflow.SCROLL);
//initialize the SVG panel
initSVG();
//add scroll handler
taskScrollPanel.addScrollHandler(new ScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
int hscroll = taskScrollPanel.getHorizontalScrollPosition() * -1;
firstHeaderRow.getElement().getStyle().setLeft(hscroll, Unit.PX);
secondHeaderRow.getElement().getStyle().setLeft(hscroll, Unit.PX);
taskBackgroundPanel.getElement().getStyle().setLeft(hscroll, Unit.PX);
display.fireEvent(event);
// view.onScroll(taskScrollPanel.getHorizontalScrollPosition(),
// taskScrollPanel.getScrollPosition());
}
});
}
示例7: attachScrollingEvents
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
protected void attachScrollingEvents(ComponentConnector connector) {
Widget widget = connector.getWidget();
if(widget instanceof LazyScrollNotifier) {
LazyScrollNotifier not = (LazyScrollNotifier) widget;
scrollingElement = not.getLazyScrollingElement();
not.addLazyScrollListener(this);
} else if (widget instanceof VWindow) {
final VWindow window = (VWindow)widget;
scrollingElement = window.contentPanel.getElement();
handlerRegistration = ((VWindow)widget).contentPanel.addScrollHandler(new ScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
onLazyScroll(window.contentPanel.getElement());
}
});
} else {
LOGGER.severe("Failed to connect to scrolling events of " + connector.getClass().getName());
}
}
示例8: onScroll
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
@Override
public void onScroll(ScrollEvent event) {
final Element element = event.getNativeEvent().getEventTarget().cast();
if (element != container) {
return;
}
AnimationScheduler.get().requestAnimationFrame(new AnimationCallback() {
@Override
public void execute(double timestamp) {
int sl = container.getScrollLeft();
int st = container.getScrollTop();
if (sl != previousContainerScrollLeft) {
timeline.setScrollLeft(sl);
previousContainerScrollLeft = sl;
}
if (st != previousContainerScrollTop) {
previousContainerScrollTop = st;
}
}
});
}
示例9: updateVerticalScrollGridDelegation
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
private void updateVerticalScrollGridDelegation() {
// register scroll handler to Gantt widget
ganttScrollHandlerRegistration = getWidget().addDomHandler(ganttScrollHandler, ScrollEvent.getType());
scrollDelegateHandlerRegistration = delegateScrollGridTarget.addScrollHandler(gridScrollDelegateTargetHandler);
// add detach listener to unregister scroll handler when its
// detached.
delegateScrollGridTarget.addAttachHandler(new Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
if (!event.isAttached() && scrollDelegateHandlerRegistration != null) {
scrollDelegateHandlerRegistration.removeHandler();
}
}
});
}
示例10: updateVerticalScrollTableDelegation
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
private void updateVerticalScrollTableDelegation() {
// register scroll handler to Gantt widget
ganttScrollHandlerRegistration = getWidget().addDomHandler(ganttScrollHandler, ScrollEvent.getType());
// register a scroll handler to 'delegation' scroll panel.
scrollDelegateHandlerRegistration = delegateScrollPanelTarget.addScrollHandler(scrollDelegateTargetHandler);
// add detach listener to unregister scroll handler when its
// detached.
delegateScrollPanelTarget.addAttachHandler(new Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
if (!event.isAttached() && scrollDelegateHandlerRegistration != null) {
scrollDelegateHandlerRegistration.removeHandler();
}
}
});
}
示例11: setupGridPanel
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
void setupGridPanel() {
//Lienzo stuff - Set default scale
final Transform transform = newTransform().scale(VP_SCALE);
gridPanel.getViewport().setTransform(transform);
//Lienzo stuff - Add mouse pan support
defaultTransformMediator = new BoundaryTransformMediator(GuidedDecisionTableModellerViewImpl.this);
mousePanMediator.setTransformMediator(defaultTransformMediator);
gridPanel.getViewport().getMediators().push(mousePanMediator);
mousePanMediator.setBatchDraw(true);
gridPanel.setBounds(getBounds());
gridPanel.getScrollPanel().addDomHandler(scrollEvent -> getPresenter().updateRadar(),
ScrollEvent.getType());
//Wire-up widgets
gridPanel.add(gridLayer);
//Set ID on GridLienzoPanel for Selenium tests.
gridPanel.getElement().setId("dtable_container_" + Document.get().createUniqueId());
}
示例12: SignInOrUpPanel
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
public SignInOrUpPanel(ViewContext viewContext)
{
m_viewContext = viewContext;
m_signIn = new SignInPanel(viewContext);
m_signUp = new SignUpPanel(viewContext);
this.addStyleName("sm_signuporin_panel");
m_innerContainer.setSize("100%", "100%");
m_innerContainer.add(m_signIn);
m_innerContainer.add(m_signUp);
this.add(m_innerContainer);
this.addDomHandler(this, ScrollEvent.getType());
}
示例13: getViewAsScrollPanel
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
/**
* Get the scroll panel in the drawing cavcas.
* @return
*/
public ScrollPanel getViewAsScrollPanel() {
scrollPanel.addScrollHandler(new ScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
}
});
return scrollPanel;
}
示例14: onPanelScrolled
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
@UiHandler("revisionsPanel")
public void onPanelScrolled(ScrollEvent ignored) {
// We cannot rely on exact equality of scroll positions because GWT sometimes round such values
// and it is possible that the actual max scroll position is a pixel less then declared.
if (revisionsPanel.getMaximumVerticalScrollPosition()
- revisionsPanel.getVerticalScrollPosition()
<= 1) {
// to avoid autoscrolling to selected item
revisionsPanel.getElement().focus();
delegate.onScrolledToBottom();
}
}
示例15: onPanelScrolled
import com.google.gwt.event.dom.client.ScrollEvent; //导入依赖的package包/类
@UiHandler("revisionsPanel")
public void onPanelScrolled(ScrollEvent ignored) {
// We cannot rely on exact equality of scroll positions because GWT sometimes round such values
// and it is possible that the actual max scroll position is a pixel less then declared.
if (revisionsPanel.getMaximumVerticalScrollPosition()
- revisionsPanel.getVerticalScrollPosition()
<= 1) {
// to avoid autoscrolling to selected item
revisionsPanel.getElement().focus();
delegate.onScrolledToButton();
}
}