当前位置: 首页>>代码示例>>Java>>正文


Java ScrollEvent类代码示例

本文整理汇总了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);
      }
    }
  });
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:36,代码来源:ShowMorePagerPanel.java

示例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);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:OutputConsoleViewImpl.java

示例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();
		}
	});

}
 
开发者ID:bonprix,项目名称:vaadin-scrollable-panel,代码行数:26,代码来源:ScrollablePanelWidget.java

示例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));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:22,代码来源:GridLienzoPanel.java

示例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());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:GridLienzoScrollHandlerTest.java

示例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());
            }
        });
    }
 
开发者ID:waynedyck,项目名称:gwt-gantt,代码行数:24,代码来源:GanttChartView.java

示例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());
    }
}
 
开发者ID:alump,项目名称:LazyLayouts,代码行数:20,代码来源:LazyVerticalLayoutConnector.java

示例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;
            }
        }
    });
}
 
开发者ID:tltv,项目名称:gantt,代码行数:23,代码来源:GanttWidget.java

示例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();
            }
        }
    });
}
 
开发者ID:tltv,项目名称:gantt,代码行数:19,代码来源:GanttConnector.java

示例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();
            }
        }
    });
}
 
开发者ID:tltv,项目名称:gantt,代码行数:20,代码来源:GanttConnector.java

示例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());
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:22,代码来源:GuidedDecisionTableModellerViewImpl.java

示例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());
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:18,代码来源:SignInOrUpPanel.java

示例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;
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:13,代码来源:DiagramController.java

示例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();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:ResetToCommitViewImpl.java

示例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();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:HistoryViewImpl.java


注:本文中的com.google.gwt.event.dom.client.ScrollEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。