为什么在ScrollPanel中通过overriden方法处理调整大小时通过处理程序进行滚动处理? [英] Why is scroll processed via handler while resize is processed via overriden method in ScrollPanel?

查看:135
本文介绍了为什么在ScrollPanel中通过overriden方法处理调整大小时通过处理程序进行滚动处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么GWT以这样的方式设计?调整大小和滚动事件的主要区别是什么?

解决方案

因为浏览器没有调整大小的事件(窗口大小调整这样,在GWT中调整大小的通知是模拟的,如果你使用 RootLayoutPanel ResizeLayoutPanel ,它将监听窗口大小调整事件,并将它们向下传播到其 RequiresResize children(如果它们是 ProvideResize 小部件本身也会向下传播)。

明确地设置<$ c的大小$ c> ProvideResize
小部件还将通知其 RequiresResize children;以及调整面板的大小(以 DockLayoutPanel LayoutPanel -among others-编程方式),和/或完成由用户为 SplitLayoutPanel StackLayoutPanel )。



你会注意到 ScrollPanel 都是一个 RequiresResize (将被其父 ProvideResize 小部件,其大小可能已更改)和 ProvideResize (将通知其小部件,如果其 RequiresResize )。


Why is GWT designed in such a way? What is the principal difference between resize and scroll events?

解决方案

Because there's no event for resizing in browsers (there's resizing at the window-level, but not element-level), contrary to scroll events.

Thus, resizing "notification" is "emulated" in GWT: if you use a RootLayoutPanel or ResizeLayoutPanel, it'll listen for window resize events and propagates them downwards to its RequiresResizechildren (which will propagate downwards too, if they are ProvidesResize widgets themselves).
Explicitly setting the size of a ProvidesResize widget will also notify its RequiresResize children; as well as resizing areas of a layout panel (programmatically for DockLayoutPanel and LayoutPanel –among others–, and/or done by the user for a SplitLayoutPanel or StackLayoutPanel).

You'll note that ScrollPanel is both a RequiresResize (will be notified by its parent ProvidesResize widget that its size might have changed) and ProvidesResize (will notify its child widget if its a RequiresResize).

这篇关于为什么在ScrollPanel中通过overriden方法处理调整大小时通过处理程序进行滚动处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆