Reputation: 86935
How can I bind a GWT label to a string property in the backing class for the view?
Login.ui.xml:
Welcome <g:Label text="{textFromJavaBackingClass}" />
class Login {
String userName;
String getUserName() { return userName; }
}
How can I bind the value to String userName
?
Upvotes: 0
Views: 195
Reputation: 122026
Declare class in xml
<ui:with field="myclass" type='package.ClassName' />
In Ui binder write
g:Label text='{myclass.getUsername}'></g:Label>
Here is the reference for future
Upvotes: 1
Reputation: 31283
Let's say you have a i18n class MyI18n
which extends Messages
Just include the following
<ui:with field="i18n" type="MyI18n"/>
Then
Welcome <g:Label text="{i18n.textFromJavaBackingClass}" />
Note : MyI18n is actually not required to extends Messages
, this is just the common way to call any no-arg method.
<ui:with field="clazz" type="AnyClass"/>
Welcome <g:Label text="{clazz.anyMehtodWhichDoesNotTakeArgs}" />
Upvotes: 1