gpt4 book ai didi

java - GWT:SplitLayoutPanel UiBinder

转载 作者:行者123 更新时间:2023-12-01 04:45:53 25 4
gpt4 key购买 nike

我有同样的问题,如 here .

有没有办法重写 onResize 方法并在 uibinder 中使用它?

SplitLayoutPanel mainPanel = new SplitLayoutPanel() {
@Override
public void onResize() {
super.onResize();
//some other resizing stuff
}
};

最佳答案

是的。定义类:

package com.foo;

public class MySplitLayoutPanel extends SplitLayoutPanel() {
@Override
public void onResize() {
super.onResize();
//some other resizing stuff
}
};

然后将类所在的包绑定(bind)到您选择的 xml 命名空间(不会与 UiBinder 模板中定义的其他命名空间冲突):

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:foo='urn:import:com.foo'>

然后通过命名空间引用您的类(就像您对常用 g 命名空间的其他小部件一样):

<foo:MySplitLayoutPanel />

这是针对 UiBinder 部分的,但我认为您链接的答案根本不是解决方案,因为 onResize() 也会被调用(主要是)当浏览器窗口调整大小时。

关于java - GWT:SplitLayoutPanel UiBinder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15852062/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com