gwt uibinder ui:带 - 带参数的调用方法 [英] gwt uibinder ui:with - calling methods with arguments

查看:92
本文介绍了gwt uibinder ui:带 - 带参数的调用方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用gwt uibinder。我想动态地将值设置为一个字段。
我正在尝试这样的事情

I am using gwt uibinder. I want to dynamically set values to a field. I am trying something like this

<ui:with field="valuesStore" type='x.y.client.ValuesStore' />

并且该字段的值是这样设置的$ / b>

and the field is set with value like this

<g:Label text='{valuesStore.getValue}'>Name</g:Label>

并且ValueStore有2个方法

and the ValueStore has 2 methods

public String getValue(String key) {
    return localizedValues.get(key);
}

public String getValue() {
    return null;
}

问题是我无法调用getValue(key)。我只能调用no-args方法,这意味着以下是不可能的:

The problem is i am unable to call the getValue(key). I could only call the no-args method meaning the following is not possible

<g:Label text='{valuesStore.getValue('name')}'>Name</g:Label>

请澄清是否有办法实现这一点,我可以调用传递给它的参数的方法。

Please clarify if there is a way to achieve this where i can call a method with arguments passed to it.

推荐答案

不支持,只有不带参数的方法才能被调用。您将不得不直接将名称作为no args方法公开。

That is not supported, only methods without arguments can be invoked. You are going to have to expose the name directly as a no args method.

查看< a href =http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/uibinder/attributeparsers/FieldReferenceConverter.html =noreferrer> FieldReferenceConverter ,这描述了使用的语法。你可以看到不支持参数传递。

Look at the documentation for FieldReferenceConverter, this describes the syntax used. You can see that there is no support for argument passing.

这篇关于gwt uibinder ui:带 - 带参数的调用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆