我有从属性文件中提供的常量值
MyConstants.java
public interface MyConstants extends ConstantsWithLookup {
public String text();
}
MyConstants.properties
text=Hello!
要获取文本,我执行以下操作
private MyConstants constants = GWT.create(MyConstants.class);
Button button=new Button(constants.text());
我想知道如何创建从使用UiBinder属性文件提供的文本按钮
<?xml version="1.0" encoding="UTF-8"?>
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:HTMLPanel>
<g:Button>Hello!</g:Button>
</g:HTMLPanel>
</ui:UiBinder>
还有fieldset标签,如何添加文本到它的图例
<g:HTMLPanel>
<fieldset class="panel">
<legend>Hello!</legend>
</g:HTMLPanel>
请查看使用外部资源
尝试用同样的方法将CssResource
注入ui.xml
。
示例代码:
<?xml version="1.0" encoding="UTF-8"?>
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with type="com.x.y.z.client.MyConstants" field="c">
</ui:with>
<g:HTMLPanel>
<g:Button text="{c.text}"/>
</g:HTMLPanel>
</ui:UiBinder>
编辑
用CaptionPanel代替fieldset
<gwt:CaptionPanel captionText="{c.text}"></gwt:CaptionPanel>