uibinder onload 未调用

发布于 2024-10-02 07:42:52 字数 194 浏览 0 评论 0原文

如果我通过 new TheWidget(); 调用 uibinder,onLoad() 方法是在 TheWidget() 实例化后立即调用的吗?

public class TheWidget extends Composite {

}

在我的测试中,onLoad() 没有被调用

if i call uibinder through new TheWidget(); is onLoad() method is call right after TheWidget() is instantiationed ?

public class TheWidget extends Composite {

}

in my test, onLoad() is not call

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烏雲後面有陽光 2024-10-09 07:42:52

onLoad 在您的小部件附加到浏览器文档时调用,而不是在构造它时调用。

尝试将您的小部件添加到另一个附加的小部件:

TheWidget theWidget = new TheWidget();
RootPanel.get().add(theWidget);

onLoad is called when your widget becomes attached to the browser document, not when it is constructed.

Try adding your widget to another attached widget:

TheWidget theWidget = new TheWidget();
RootPanel.get().add(theWidget);
苄①跕圉湢 2024-10-09 07:42:52

如果您在 Composite 对象内使用 UiBinder,那么您应该在构造对象时调用它 - 在构造函数内。查看Hello World

If you use UiBinder inside Composite object then you should invoke it when object gets constructed - inside constructor. Take a look at the Hello World.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文