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


Java ScrollHandler类代码示例

本文整理汇总了Java中com.google.gwt.event.dom.client.ScrollHandler的典型用法代码示例。如果您正苦于以下问题:Java ScrollHandler类的具体用法?Java ScrollHandler怎么用?Java ScrollHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScrollHandler类属于com.google.gwt.event.dom.client包,在下文中一共展示了ScrollHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ShowMorePagerPanel

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的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: ScrollablePanelWidget

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的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

示例3: onScroll

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的package包/类
public void onScroll() {
    int x= getScrollX();
    int y= getScrollY();

    int w= getScrollWidth();
    int h= getScrollHeight();
    if (_lastX!=x || _lastY!=y || _lastW!=w || _lastH!=h) {
        //todo - no lose this optimization - i think it needs to be somewhere else now
        _lastX= x;
        _lastY= y;
        _lastW= w;
        _lastH= h;
    }

    if (_primaryScrollInfo!=null) {
        _primaryScrollInfo._sWidth= w;
        _primaryScrollInfo._sHeight= h;
        _primaryScrollInfo._scrollHPos= x;
        _primaryScrollInfo._scrollVPos= y;
    }
    for(ScrollHandler handler : _scrollHandlerList) {
        handler.onScroll(null);
    }
}
 
开发者ID:lsst,项目名称:firefly,代码行数:25,代码来源:WebPlotView.java

示例4: setupDefaultHandlers

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的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.ScrollHandler; //导入依赖的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.ScrollHandler; //导入依赖的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.ScrollHandler; //导入依赖的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: getViewAsScrollPanel

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的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

示例9: onScroll

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的package包/类
ScrollHandler onScroll() {
    return (ScrollEvent event) -> {
        final Boolean mouseIsNotDragging = !getMousePanMediator().isDragging();

        if (mouseIsNotDragging) {
            updateGridLienzoPosition();
        }
    };
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:10,代码来源:GridLienzoScrollHandler.java

示例10: testOnScrollWhenMouseIsNotDragging

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的package包/类
@Test
public void testOnScrollWhenMouseIsNotDragging() {

    final RestrictedMousePanMediator mediator = mock(RestrictedMousePanMediator.class);
    final ScrollEvent scrollEvent = mock(ScrollEvent.class);

    doReturn(false).when(mediator).isDragging();
    doReturn(mediator).when(gridLienzoScrollHandler).getMousePanMediator();
    doNothing().when(gridLienzoScrollHandler).updateGridLienzoPosition();

    final ScrollHandler scrollHandler = gridLienzoScrollHandler.onScroll();
    scrollHandler.onScroll(scrollEvent);

    verify(gridLienzoScrollHandler).updateGridLienzoPosition();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:16,代码来源:GridLienzoScrollHandlerTest.java

示例11: testOnScrollWhenMouseIsDragging

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的package包/类
@Test
public void testOnScrollWhenMouseIsDragging() {

    final RestrictedMousePanMediator mediator = mock(RestrictedMousePanMediator.class);
    final ScrollEvent scrollEvent = mock(ScrollEvent.class);

    doReturn(true).when(mediator).isDragging();
    doReturn(mediator).when(gridLienzoScrollHandler).getMousePanMediator();

    final ScrollHandler scrollHandler = gridLienzoScrollHandler.onScroll();
    scrollHandler.onScroll(scrollEvent);

    verify(gridLienzoScrollHandler,
           never()).updateGridLienzoPosition();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:16,代码来源:GridLienzoScrollHandlerTest.java

示例12: addScrollHandler

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的package包/类
private void addScrollHandler() {
  if (scrollHandler != null) {
    scrollHandler.removeHandler();
  }
  scrollHandler = view.addScrollHandler(new ScrollHandler() {
    @Override
    public void onScroll(ScrollEvent event) {
      updateTimer.cancel();
      updateTimer.schedule(UPDATE_INTERVAL);
    }
  });
}
 
开发者ID:thorntonv,项目名称:mechaverse,代码行数:13,代码来源:SimulationPresenter.java

示例13: testRadarIsUpdatedAfterScrolling

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的package包/类
@Test
public void testRadarIsUpdatedAfterScrolling() throws Exception {
    final ArgumentCaptor<ScrollHandler> scrollHandler = ArgumentCaptor.forClass(ScrollHandler.class);
    final ScrollEvent scrollEvent = mock(ScrollEvent.class);
    final AbsolutePanel mainPanel = mock(AbsolutePanel.class);
    final Transform transform = mock(Transform.class);
    final Viewport viewport = mock(Viewport.class);
    final Mediators mediators = mock(Mediators.class);
    final Element element = mock(Element.class);

    doReturn(transform).when(transform).scale(anyDouble());

    doReturn(presenter).when(view).getPresenter();
    doReturn(transform).when(view).newTransform();

    doReturn(mediators).when(viewport).getMediators();

    doReturn(element).when(mockGridPanel).getElement();
    doReturn(mainPanel).when(mockGridPanel).getScrollPanel();
    doReturn(viewport).when(mockGridPanel).getViewport();

    view.setupGridPanel();

    verify(mainPanel).addDomHandler(scrollHandler.capture(),
                                    eq(ScrollEvent.getType()));

    scrollHandler.getValue().onScroll(scrollEvent);

    verify(presenter).updateRadar();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:31,代码来源:GuidedDecisionTableModellerViewImplTest.java

示例14: getScrollHandler

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的package包/类
/**
 * Return a ScrollHandler to ensure the Header and Sidebar are repositioned
 * according to the position of the scroll bars surrounding the GridWidget
 */
@Override
protected ScrollHandler getScrollHandler() {
    return new ScrollHandler() {

        public void onScroll( ScrollEvent event ) {
            headerWidget.setScrollPosition( scrollPanel.getHorizontalScrollPosition() );
            sidebarWidget.setScrollPosition( scrollPanel.getVerticalScrollPosition() );
        }

    };
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:16,代码来源:VerticalDecoratedTemplateDataGridWidget.java

示例15: ScrollNavigator

import com.google.gwt.event.dom.client.ScrollHandler; //导入依赖的package包/类
public ScrollNavigator(ViewContext viewContext, Panel scrollContainer, Panel scrollee, Panel mouseLayer)
{
	m_viewContext = viewContext;
	m_scrollContainer = scrollContainer;
	m_scrollContainerInner = scrollee;
	m_mouseLayer = mouseLayer;
	m_scrollBarWidthDiv2 = (int) Math.floor(((double)U_Css.getScrollBarWidth())/2);
	m_cellHudHeight = viewContext.appConfig.cellHudHeight;
	
	m_scrollContainer.getElement().getStyle().setZIndex(1);
	
	m_args_SnapToCoord.historyShouldIgnore = true;
	
	m_scrollContainer.addDomHandler(new ScrollHandler()
	{
		@Override
		public void onScroll(ScrollEvent event)
		{
			State_ViewingCell viewingState =  m_viewContext.stateContext.get(State_ViewingCell.class);
			if( viewingState != null )
			{
				VisualCell cell = (VisualCell)viewingState.getCell().getVisualization();
				setTargetLayout(cell);
				//m_viewContext.cellMngr.updateCellTransforms(0.0);
			}
			else
			{
				//--- DRK > I guess when we leave viewing state and reset scroll left/top to zero,
				//---		that fires a scroll event, so valid case here...ASSERT removed for now.
				//smU_Debug.ASSERT(false, "Expected viewing state to be entered.");
			}
			
			if( m_scrollListener != null )  m_scrollListener.onScroll();
		}
		
	}, ScrollEvent.getType());
	
	this.toggleScrollBars(null, null);
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:40,代码来源:ScrollNavigator.java


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