gpt4 book ai didi

GWT uibinder 复合 Material

转载 作者:行者123 更新时间:2023-12-04 20:45:23 26 4
gpt4 key购买 nike

我正在创建一个带有标签和文本框的复合 uibinder 小部件。

预期用途是:

<x:XTextBox ui:field="fieldName" label="a caption" >
The text to be put in the box.
</x:XTextBox>

我找到了如何使用自定义 @UiConstructor 捕捉标签构造函数,我可能会向构造函数添加另一个参数,但我想知道如何从 xml 中获取文本,就像 GWT 标记 <g:Label>a caption</g:Label>

非常感谢任何帮助。

最佳答案

我通过查看 Label 小部件源代码找到了一个可能的实现。

关键是复合小部件必须实现HasText 接口(interface)。所以在声明和正文中:

public class XTextBox extends Composite implements HasText ...
...
@UiField TextBox textBox;
...
public void setText(String text) {
textBox.setText(text);
}
public String getText() {
return textBox.getText();
}
...

关于GWT uibinder 复合 Material ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2850347/

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