如何在 UiBinder XML 文件中使用 AbsolutePanel
我想仅使用 ui.xml 文件来使用所述面板进行绝对布局,但不清楚这是否可能,因为文档集中于代码并完全忽略布局语言。我假设,由于教程没有提到这一点,所以这是不可能的,但我想确定一下。
I would like to do absolute layout using said panel by only using ui.xml file however it isn't clear if this is possible since the documentation concentrates on the code and ignores the layout language altogether. I'm assuming, since the tutorial doesn't mention this, it is impossible but would like to know for sure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道这已经很旧了,但他们更新了 AbsolutePanel 的 uibinder
I know this is old, but they updated the uibinder for AbsolutePanel
你是对的——目前没有办法做到这一点。这个问题可以在未来的 GWT 版本中通过引入一些自定义语法来解决,就像针对
DockLayoutPanel
。但我对此表示怀疑 - 你想要编写这样的代码:然而,这与“bean”冲突(如在 Java Beans 中;如果你有一个 getSomethingCool 方法,你可以编写 somethingCool ="kewl" 在 UiBinder 代码中,它将自动调用适当的 get/set 方法)样式 - 因为
Button
没有setX/Y
方法。这可以通过在编译时用对现有方法(CSS 定位等)的适当调用替换 setX/Y 调用来绕过。但这引入了另一种自定义行为,依赖于包装小部件/面板 - 我认为 GWT 开发人员希望避免这种情况。You are right - there's no way to do this at the moment. This could be addressed in a future GWT release by introducing some custom syntax, like it was done for
DockLayoutPanel
. But I doubt it - you'd want to write code like this:However this conflicts with the "bean" (as in Java Beans; if you have a
getSomethingCool
method, you can writesomethingCool="kewl"
in the UiBinder code and it will autmagically call the appropriate get/set method) style - becauseButton
doesn't have asetX/Y
method. This could be bypassed by replacing thesetX/Y
calls with appropriate calls to existing methods (CSS positioning, etc) at compile time. But this introduces yet another custom behavior, dependent on the wrapping Widget/Panel - I think the GWT devs would like to avoid that.