GWT RootPanel vs RootLayoutPanel [英] GWT RootPanel vs RootLayoutPanel

查看:158
本文介绍了GWT RootPanel vs RootLayoutPanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,官方GWT建议使用较新的RootLayoutPanel,但互联网上的一些帖子声称,对于某些Web应用程序,最好使用RootPanel。

如何决定使用哪一个?
是否有任何不同的用例? (或者每个需求都可以满足)

解决方案

RootLayoutPanel can不会更好。它只是不同而已。

RootPanel 允许您将小部件添加到页面中(基本上,您可以使用页面上的一些html元素作为根小部件)。您可以在同一个应用程序中定义多个 RootPanel的

RootLayoutPanel 行为有点不同,它总是试图填充窗口中所有可用的大小,所以面板内的内容将完全适合浏览器窗口大小。它还会跟踪窗口的大小,并相应地调整子元素的大小(如果他们支持的话)。另外 RootLayoutPanel 会尝试直接附加到< body>元素,例如你不能选择页面上的哪个HTML元素将成为起点。

因此,根据你想要做什么,你可以选择 RootPanel RootLayoutPanel

I understand that officially GWT recommends using the newer RootLayoutPanel but some posts on the internet claims that for some web applications it is better to use the RootPanel.
How can one decide which one to use?
Is there any different use cases for each? (or every requirement can be satisfied with either)

解决方案

RootLayoutPanel can't be better. It is just different.

RootPanel allows you to add widgets to the page (basically you can use some html element on the page as root widget). You can define multiple RootPanel's in the same application.

RootLayoutPanel behaves a little bit differently, it always tries to fill all the available size in the window, so the content inside of the panel will perfectly fit the browser window size. It will also track the size of the window, and will resize child elements accordingly (if they support it). Also RootLayoutPanel will try to attach itself directly to the <body> element, e.g. you can't choose which html element on the page will become a "starting point".

So, depending on what you want to do you can choose RootPanel or RootLayoutPanel.

这篇关于GWT RootPanel vs RootLayoutPanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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