是否有一个“AcceptsOneWidget”也“ProvidesResze”(“ScrollPanel”除外)?
我有一个扩展了 ResizeComposite 的组合,并以 DockLayoutPanel
作为其根。我可以将其直接粘贴到 RootLayoutPanel
中,并且它可以工作,因为 DockLayoutPanel
ProvidesResize
。
但是,我想使用 GWT 2.2 中的 MVP 功能,并且 RootLayoutPanel
无法传递给 ActivityManager#setDiplay(AcceptsOneWidget)
(因为它是一个多窗口小部件)容器)。
乍一看,ScrollPanel
似乎满足了实现 AcceptsOneWidget
以及 ProvidesResize
和 RequiresResize
的双重要求。
但我发现当我将我的小部件放入 ScrollPanel 中时,它的大小为零,我必须手动调整它的大小才能看到它,而且我很难知道给它多大的尺寸。我更喜欢一个不一定滚动的面板。
I have a composite which extends ResizeComposite
and has a DockLayoutPanel
as its root. I can stick it directly into RootLayoutPanel
and it works because DockLayoutPanel
ProvidesResize
.
However, I'm wanting to use the MVP facilities in GWT 2.2, and RootLayoutPanel
can't be passed to ActivityManager#setDiplay(AcceptsOneWidget)
(since it's a multi-widget container).
At first glance, ScrollPanel
appears to meet the dual requirement of implementing AcceptsOneWidget
and both ProvidesResize
and RequiresResize
.
But I am finding that when I put my widget into a ScrollPanel
, that it has a 'zero size', and I have to size it manually in order to see it, and I'm having trouble knowing what size to give it. I'd rather a Panel that didn't necessarily scroll.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将会有一个 SimpleLayoutPanel ,描述为:
There will be a SimpleLayoutPanel in GWT 2.3, described as:
您可以通过自己实现来将
ProvidesResize
添加到任何小部件,这相对简单 - 您只需将收到的所有调整大小通知传递给RequiresResize
的每个子子项即可。或者,如果您只想让面板占据所有可用空间,您可以尝试将
ScrollPanel
上的宽度和高度设置为“100%”
。最后,这是我对
AcceptsOneWidget
的 LayoutPanel 的实现:我已经在我的商业应用程序中使用它几个月了,没有任何问题,并且可以轻松地在其中交换视图。您可以自行使用此代码。
You can add
ProvidesResize
to any widget by implementing it yourself, which is relatively simple - you just pass along all of the resize notifications you get to every sub-child thatRequiresResize
.Alternatively, if you just want your panel to take up all of the available space, you might try setting the width and height on the
ScrollPanel
to"100%"
.Finally, here's my implementation of a LayoutPanel that
AcceptsOneWidget
:I've been using this in my commercial app for months without any problems, and it's easy to swap views in and out of it. Feel free to use this code yourself.