问题描述
为什么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 RequiresResize
children (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方法处理调整大小时通过处理程序进行滚动处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!