有人能发布一个在Java代码和UiBinder XML之间共享(最好是静态最终)字符串或数字常量的最短方法的例子吗?我可以在属性中使用常量:
<g:TextArea width="...px"/>
或在一个值中:
<g:Label>...</g:Label>
我似乎找不到这样的例子,只有文件中的文本,我不想要。
static
字段(和枚举常量)可以与简单的<ui:import>
:一起使用
<ui:import field="com.example.Pojo.CONSTANT" />
或
<ui:import field="com.example.Pojo.*" />
然后简单地说:
<g:Label text="{CONSTANT}" />
或
<g:Label><ui:text from="{CONSTANT}"/></g:Label>
请参阅https://code.google.com/p/google-web-toolkit/source/browse/trunk/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml#87例如。