问题描述
在UiBinder.ui.xml文件中使用< g:LayoutPanel>
时,可以指定< g:layer>
标签。其他一些Google构建的小部件也有类似的特殊标签 - < g:tab>
甚至还有一个子标签< g:头文件>
。 如何为我自己的小部件指定这些内容?
这个问题的新答案在一些GWT改进之后,位于。复制下面,以避免主持人删除(也许?)。
您可以使用@UiChild在您的小部件中声明特殊功能在UiBinders访问。
例如,
class MyPanel继承AbsolutePanel {
@UiChild
public void addAt(Widget w,String parameter1,String parameter2){
....
然后,在你的uiBinder中,你可以说:
< custom:MyPanel>
< g:AnySingleWidget />
< / custom:at>
< / custom:MyPanel>
请参阅 http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com /google/gwt/uibinder/client/UiChild.html
When using a <g:LayoutPanel>
in UiBinder.ui.xml files, you can specify <g:layer>
tags. Some other Google-built widgets have special tags like that as well - <g:tab>
even has a sub-tag, <g:header>
.
How can I specify these for my own widgets?
The new answer to this question, after some GWT improvements, is at https://stackoverflow.com/a/11785903/439317 . Copied below to avoid moderator deletion (maybe?).
You can use @UiChild to declare special functions in your widgets accessible in UiBinders.
for example,
class MyPanel extends AbsolutePanel {
@UiChild
public void addAt(Widget w, String parameter1, String parameter2) {
....
Then, in your uiBinder, you can say
<custom:MyPanel>
<custom:at parameter1="HI" parameter2="Anything you like!">
<g:AnySingleWidget />
</custom:at>
</custom:MyPanel>
See @UiChild at http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/uibinder/client/UiChild.html
这篇关于UiBinder文件中的自定义标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!