本文介绍了GWT UiBinder:如何制作一个自定义的AbsolutePanel,它使用“at”元件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图扩展AbsolutePanel,我的UiBinder不会允许< g:at> 元素,这对于直接的AbsolutePanels通常是正常的。如何让我的AbsolutePanel子类能够使用< g:at> 元素?更一般地说,我可以为我自己的自定义Widgets(比如at,west,layer等)制作自定义的UiBinder关键字吗?

您可以使用@UiChild在UiBinders中访问您的小部件中声明特殊功能。

例如,



  class MyPanel extends 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


Trying to extend AbsolutePanel, my UiBinder won't allow the <g:at> element which is normally ok for straight AbsolutePanels. How do I make my AbsolutePanel subclass able to use the <g:at> element? And more generally, can I make custom UiBinder keywords for my own custom Widgets like "at", "west", "layer" etc.?

解决方案

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

这篇关于GWT UiBinder:如何制作一个自定义的AbsolutePanel,它使用“at”元件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 01:42