开发者

UiBinder custom widget with parameterized constructor

开发者 https://www.devze.com 2023-03-21 09:11 出处:网络
Let\'s say we have a custom widget that was declared using UiBinder and it needs t开发者_运维知识库o have some arguments in its constructor. How can I make it in order to be able to supply these argum

Let's say we have a custom widget that was declared using UiBinder and it needs t开发者_运维知识库o have some arguments in its constructor. How can I make it in order to be able to supply these arguments when i declare it in ui.xml?

That is i have a

CustomWidget(int param1, int param2)

and when i add it to a ui.xml i need to be able to do:

...

xmlns:my="urn:import:...">

<g:Container>
 <my:CustomWidget param1="1" param2="arg2"/>
</g:Container>


Use @UiConstructor on your constructor:

@UiConstructor
CustomWidget(int param1, int param2)

Look at docs: http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Using_a_widget

0

精彩评论

暂无评论...
验证码 换一张
取 消