javalearner
javalearner

Reputation: 3382

gwt uibinder ui:with - calling methods with arguments

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>

and the ValueStore has 2 methods

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

public String getValue() {
    return null;
}

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.

Upvotes: 6

Views: 5539

Answers (1)

ColinE
ColinE

Reputation: 70142

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.

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

Upvotes: 9

Related Questions