To start with CSSResource is awesome and I highly recommend using it. It 
forces you to program *better*. Should you really be trying to pull 
elements out of the page depending on their CSS names? Seems like a bad day 
if you ever want to rebrand or dress up your UI. If CSS is the graphical 
dressing of the site, separate those concerns from the functional aspects. 
Further, using those CSSResource interfaces keeps you from ever using 
string literals in your Java code or UiBinders, which is a best practice.

Additionally, with UI Automation tests our testers are tempted to use ugly 
selectors based on class names. This is a poor idea because then a class 
name changes a year later and 400 tests fail, even though functionally the 
site works just as well as before.

The real question here is what you want to do with your CSS. If you want to 
apply rules the site over, then don't use <ui:style>, but rather a 
CSSResource interface. This way that interface can be used by many widgets' 
UiBinders. However bespoke, small CSS tweaks do fit nicely into <ui:style> 
and you can always move them out to a CSSResource interface in the future 
if you want to use them multiple places. Note, from my experience you 
cannot well handle CSS inheritance/overriding between widgets with 
<ui:style>, but you can with standalone CSSResource interfaces.


Sincerely,
Joseph

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

Reply via email to