@cd: IMO css styles, layouts classes, the order and methods for adding 
widgets to a page are all part of the view and dependent on each other, so 
it has its own drawbacks to assume that css is a totally different concern 
and people are always confused whether they should put their css styles in 
the code or in the .css file.

For example if you have styles like position:absolute or float it will 
totally change the layout of the page so the way you add you widget to your 
container and type of container you would use might need to be change 
depending on those styles.

In the last couple of jobs I had in agile environments, designers would 
just give you a mockup which would be merely an image of what the page 
should look like and the developer has to cut the colors and css rules to 
make the page look like that. So developer was responsible for maintaining 
the .css file, thus it would be more convenient to have style embedded in 
the code. In general there are many developers that are good with css and 
they don't need a designer to deal with the page, they might just need a 
designer for the logo and color of the page.

I've used it for my own project and it makes styles more maintainable. 
There is no need to jump to .css file all the time to search for the rule 
that is assigned to a widget. You can group styles together which makes the 
code much cleaner.

@Vitrums: 

That's a good approach, but you won't be able to change the theme 
dynamically. I already have a @Condition tag in the code which can be used 
to implement your theme example.

@StyleDef
@Background(value = "#333", 
condition=@Condition(expression="MOONSKEY.equals(theme)"))
@Background(value = "#F0F", 
condition=@Condition(expression="SUNSHINE.equals(theme)"))
public @interface BodyBackground {}

@BodyBackground
protected Widget getLabel() {
  return label;
}

The condition can be an expression or based on useAgent, dir or locale. For 
example in my other project I needed to use different styles for RTL 
language support so the dir condition would come very handy. You can also 
use @GlobalCondition to reduce the code if you want to assign multiple 
styles for the same condition.

-- 
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/-/QLqxiDoXKYsJ.
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