List of usage examples for com.google.gwt.user.client Window addWindowScrollHandler
public static HandlerRegistration addWindowScrollHandler(Window.ScrollHandler handler)
From source file:edu.caltech.ipac.firefly.ui.PopupContainerForRegion.java
public PopupContainerForRegion() { headerBar.setWidth("100%"); headerBar.add(headerLeft);//from w w w .ja v a 2s . c o m headerLeft.add(_close); _layout.setStyleName("standalone-expand"); _layout.setSize("100%", "100%"); headerLeft.add(GwtUtil.getFiller(10, 1)); headerLeft.setStyleName("header"); GwtUtil.setStyle(headerLeft, "padding", "5px 5px 0 0 "); headerLeft.add(GwtUtil.getFiller(30, 1)); headerLeft.add(titleBar); titleBar.setStyleName("title-bar"); headerLeft.setCellHorizontalAlignment(titleBar, HasHorizontalAlignment.ALIGN_LEFT); headerLeft.setCellWidth(titleBar, "100%"); _close.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dropDownCloseExecuted(); } }); GwtUtil.setStyle(_close, "marginLeft", "20px"); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { if (_showing) { ensureSize(); } } }); Window.addWindowScrollHandler(new Window.ScrollHandler() { public void onWindowScroll(Window.ScrollEvent event) { if (BrowserUtil.isIE()) { ensureSize(); } } }); }
From source file:edu.caltech.ipac.firefly.ui.PopupContainerForStandAlone.java
public PopupContainerForStandAlone(boolean fullControl) { this.fullControl = fullControl; headerBar.setWidth("100%"); if (fullControl) { headerBar.addEast(Application.getInstance().getBackgroundManager().getButton(), 200); AllPlots.getInstance().setToolPopLeftOffset(100); } else {/*from ww w. j a va2s . c o m*/ } headerBar.add(headerLeft); if (false) { RootPanel.get().add(_close); _close.addStyleName("close-button-position"); } else { headerLeft.add(_close); } _topBackground.setStyleName("NO_STYLE"); _topBackground.addStyleName("onTop"); _topBackground.setAnimationEnabled(false); GwtUtil.setStyles(_topBackground, "backgroundColor", "gray", "opacity", ".9", "position", "fixed", "left", "0px", "top", "0px", "height", "100%", "width", "100%"); FireflyCss ffCss = CssData.Creator.getInstance().getFireflyCss(); _main.setStyleName("standalone-expand"); _main.addStyleName("onTopDialog"); _main.addStyleName(ffCss.globalSettings()); int zIndex = Application.getInstance().getDefZIndex(); if (zIndex > 0) { GwtUtil.setStyle(_main, "zIndex", zIndex + ""); GwtUtil.setStyle(_topBackground, "zIndex", (zIndex - 1) + ""); } _main.setWidget(_layout); _layout.setSize("100%", "100%"); headerLeft.add(GwtUtil.getFiller(10, 1)); headerLeft.setStyleName("header"); // GwtUtil.setStyles(headerBar, "paddingLeft", "0px", // "paddingTop", "5px"); GwtUtil.setStyle(headerLeft, "padding", "5px 5px 0 0 "); headerLeft.add(GwtUtil.getFiller(30, 1)); headerLeft.add(titleBar); titleBar.setStyleName("title-bar"); headerLeft.setCellHorizontalAlignment(titleBar, HasHorizontalAlignment.ALIGN_LEFT); headerLeft.setCellWidth(titleBar, "100%"); _close.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { hide(); } }); GwtUtil.setStyle(_close, "marginLeft", "20px"); WebEventManager.getAppEvManager().addListener(Name.DROPDOWN_CLOSE, new WebEventListener() { public void eventNotify(WebEvent ev) { if (_showing) { if (_closeBrowserWindow) { doCloseBrowserWindow(); } else { hide(); } } } }); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { if (_showing) { computePosition(false); ensureSize(); } } }); Window.addWindowScrollHandler(new Window.ScrollHandler() { public void onWindowScroll(Window.ScrollEvent event) { if (BrowserUtil.isIE()) { computePosition(false); ensureSize(); } } }); }
From source file:fr.putnami.pwt.core.widget.client.Affix.java
License:Open Source License
@Override protected void onLoad() { super.onLoad(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override/*from w ww .j a v a 2 s. c o m*/ public void execute() { Affix.this.reset(); Affix.this.handlerRegistrationCollection .add(Window.addWindowScrollHandler(Affix.this.scrollHandler)); Affix.this.handlerRegistrationCollection.add(Window.addResizeHandler(Affix.this.resizeHandler)); } }); }
From source file:fr.putnami.pwt.core.widget.client.NavSpy.java
License:Open Source License
private void registerScrollHandler() { if (this.scrollRegistration != null) { this.scrollRegistration.removeHandler(); }/*from w ww .j a v a 2 s . com*/ if (this.isBodyScrollWidget()) { this.scrollRegistration = Window.addWindowScrollHandler(new Window.ScrollHandler() { @Override public void onWindowScroll(Window.ScrollEvent event) { NavSpy.this.scheduleRefresh(); } }); } else { this.scrollRegistration = this.scrollWidget.addDomHandler(new ScrollHandler() { @Override public void onScroll(ScrollEvent event) { NavSpy.this.scheduleRefresh(); } }, ScrollEvent.getType()); } }
From source file:gwt.material.design.addins.client.cutout.MaterialCutOut.java
License:Apache License
/** * Configures a resize handler and a scroll handler on the window to * properly adjust the Cut Out./*from w w w.j a v a 2s . c om*/ */ protected void setupWindowHandlers() { registerHandler(Window.addResizeHandler( event -> setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle))); registerHandler(Window.addWindowScrollHandler( event -> setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle))); }
From source file:gwt.material.design.addins.client.ui.MaterialCutOut.java
License:Apache License
/** * Configures a resize handler and a scroll handler on the window to * properly adjust the Cut Out./*w ww . j ava 2s . com*/ */ private void setupWindowHandlers() { if (resizeHandler != null) { resizeHandler.removeHandler(); } if (scrollHandler != null) { scrollHandler.removeHandler(); } resizeHandler = Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { setupCutOutPosition(focus, targetElement, cutOutPadding, circle); } }); scrollHandler = Window.addWindowScrollHandler(new ScrollHandler() { @Override public void onWindowScroll(ScrollEvent event) { setupCutOutPosition(focus, targetElement, cutOutPadding, circle); } }); }
From source file:gwt.material.design.client.ui.MaterialNavBarShrink.java
License:Apache License
@Override protected void onLoad() { super.onLoad(); $("header").css("position", "fixed"); $("header").css("width", "100%"); final boolean[] fired = { false }; registerHandler(Window.addWindowScrollHandler(scrollEvent -> { int distanceY = window().scrollTop(); if (distanceY > scrollOffset) { $(getElement()).addClass("smaller"); if (!fired[0]) { NavBarShrinkEvent.fire(this); fired[0] = true;//from w w w. ja va 2 s. c o m } } else { if ($(getElement()).hasClass("smaller")) { $(getElement()).removeClass("smaller"); NavBarExpandEvent.fire(this); fired[0] = false; } } })); }
From source file:gwtquery.plugins.lazyload.client.LazyLoad.java
License:Apache License
/** * Lazy load selected pictures, only actually fetching the file when the * picture becomes visible in the user's viewport. * * Pictures must have a "data-original" attribute indicating the URL to load, * and they should have a correct size already. * * @param options configuration options. * @return this./*ww w . java 2 s . c o m*/ */ public LazyLoad lazyload(final Options options) { if (get().getLength() == 0) { return this; } final Options opt = options.copy(); final Updater updater = new Updater(get(), opt); each(new Function() { @Override public void f(Element e) { final GQuery current = $(e); current.on(opt.getEventName(), new Function() { @Override public void f(final Element e) { current.off(opt.getEventName(), this); final String data = $(e).attr("data-original"); if (data == null) { return; } $("<img/>").bind(Event.ONLOAD, new Function() { @Override public void f(final Element img) { current.hide().attr("src", $(img).attr("src")); if (opt.getEffect() == null) { current.show(); } else { opt.getEffect().f(e); } } }).attr("src", data); current.removeAttr("data-original"); } }).attr("src", opt.getPlaceholder()); } }); if (opt.getContainer() == null) { final HandlerRegistration registration = Window.addWindowScrollHandler(new Window.ScrollHandler() { @Override public void onWindowScroll(Window.ScrollEvent event) { updater.update(); } }); updater.setHandler(registration); } else { final Function handler; opt.getContainer().on("scroll", handler = new Function() { @Override public boolean f(final Event e) { updater.update(); return true; } }); updater.setContainerHandler(handler); } updater.update(); return this; }
From source file:io.apiman.manager.ui.client.local.services.MouseOverService.java
License:Apache License
@PostConstruct protected void postConstruct() { Event.addNativePreviewHandler(new NativePreviewHandler() { @Override// w w w . j av a 2 s . c o m public void onPreviewNativeEvent(NativePreviewEvent event) { if (event.getTypeInt() == Event.ONMOUSEMOVE) { int x = event.getNativeEvent().getClientX(); int y = event.getNativeEvent().getClientY(); handleMouseMove(x, y); } } }); Window.addWindowScrollHandler(new ScrollHandler() { @Override public void onWindowScroll(ScrollEvent event) { clearAll(); } }); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { clearAll(); } }); }
From source file:jetbrains.jetpad.cell.toDom.CellContainerToDomMapper.java
License:Apache License
@Override protected void onAttach(MappingContext ctx) { super.onAttach(ctx); getSource().setCellContainerPeer(createCellContainerPeer()); disablePopup(getTarget());//from w w w . ja v a 2s. c om getTarget().setTabIndex(0); getTarget().addClassName(CSS.rootContainer()); getTarget().appendChild(myLineHighlight1); getTarget().appendChild(myLineHighlight2); getTarget().appendChild(myContent); refreshLineHighlight(); myScrollLeft = Window.getScrollLeft(); myScrollTop = Window.getScrollTop(); myWindowReg = Window.addWindowScrollHandler(new Window.ScrollHandler() { @Override public void onWindowScroll(Window.ScrollEvent event) { myScrollLeft = event.getScrollLeft(); myScrollTop = event.getScrollTop(); } }); }