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

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

问题描述

我正在使用 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' />

并且该字段设置为这样的值

and the field is set with value like this

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

ValueStore 有两种方法

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.

推荐答案

不支持,只能调用没有参数的方法.您将不得不将 name 直接公开为无参数方法.

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.

查看FieldReferenceConverter<的文档/a>,这描述了使用的语法.可以看到不支持参数传递.

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:with - 使用参数调用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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