Wednesday, July 18, 2012

TextResource vs Constant

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/-/0O8LY_VNyT0J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate