I'd definitely go for a Constants or Messages interface.
In UiBinder, it works exacltty like an external ClientBundle: <ui:with/> to
instantiate (through GWT.create) the interface, and then
{theField.theMethod} to access values in attributes (and <ui:text
from="{theField.theMethod}"/> otherwise).
On Wednesday, July 18, 2012 9:23:30 PM UTC+2, Lars wrote:
>
> I have a UiBinder file with a button. I want to change the text on the
> button pro programmatically.
>
> This begs for TextResource, right?
>
> However, do I need to have a .txt file for each string of text that I'll
> use for the button? e.g.
>
> @Source("MyButtonUp.txt")
> TextResources buttonUp();
>
> and
>
> @Source("MyButtonDown.txt")
> TextResources buttonDown();
>
> Is there no way to put the strings in the same file (like you can put
> multiple css rules in one css file by extending CssResource and declaring
> methods that match up to the style selectors?
>
> Is the solution the 'Constant' interface? (i'm not sure if these can be
> accessed in the UiBinder.ui.xml template though.
>
> My ideal is a ClientBundle containing something like:
> @Source("ButtonStrings.txt")
> ButtonText buttonText();
>
> public interface ButtonText extends TextResource {
> String up();
> String down();
> }
>
> and the "ButtonStrings.txt" would be something like:
> up=i am up
> down=i am down
>
> But alas, this does not work. This has gotta be pretty common, no? What's
> the standard solution here? A txt file for every string?
>
> Thanks in advance,
> Lars
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/ULPW333UjCoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.