Ok, I'm convinced that my proposal using annotations would just make sense for a very limited set of usecases. But do you see a chance to include the CssResource styles into the ImmutableResourceBundle, so that we can use something like a CssStyleResource directly in ImmutrableResourceBundle. It would be cool if a single GWT.create<> would create the whole resource bundle required by a widget. This could streamline widget development. Maybe just a matter of taste...but right now you need to create Constants, Messages and ImmutableResourceBundle separately if you want to override some styles you need to provide a different CssResource so you have to override two different interfaces (or did I miss something?).
Thanks for your clarification! Cheers, Daniel On 21 Nov., 23:16, "Ray Cromwell" <[EMAIL PROTECTED]> wrote: > I don't think it is a good idea to try and represent CSS stylesheet > rules as Java annotations. CSS is a DSL tuned for this specification, > Java annotations would be a poor substitute. The only gain would be > IDE type checking, but the downside would be the inability to have > non-Java people work on the stylesheets. > > There is one downside to style injection vs HTML inclusion, and that's > that one happens before GWTs' entry point loads, while injection > happens after. It might be nice to have a way to inject the > CSSResources from the module file, so that it can be done either by > the selection script, or by having a linker modify HTML in the public > directory. > > I guess this could be simulated with runAsync by having the resources > injected in the entry point, and then having the entire rest of the > app run from within the async. > > -Ray > > On Fri, Nov 21, 2008 at 10:37 AM, dflorey <[EMAIL PROTECTED]> wrote: > > > I'd like to share my thoughts on widget styling as I'm currently > > trying to find an approach how to apply all required resources to a > > widget to enable easy widget customization. > > > 1. The CssResources are very powerfull but why do I have to write > > a .css file? > > I remembered my proposal from may (before CssResources came up) and > > still think it would be better to simple hack the styles into the > > ImmutableResourceBundle class instead of have double indirect > > referencing (ImmutableResourceBundle->CssResources->.css-File) > > >http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse... > > > There is no chance for a non-technical css designer to apply all the > > funky rules CssResource offers to a stylesheet. So if you need a > > developer anyway it's much easier to apply the styles to the Java- > > Source directly. > > This would enable gwt to grab all defined styles and create a minified > > stylesheet per browser similar to the js output. > > > 2. Why and when do I have to inject the stylesheets? It's not very > > clear when and why I have to take care of injecting stylesheets. I > > guess that the styles are applied by using some runtime javascript > > style injection (correct me if I'm wrong). > > I'd prefer if the generated minified browser specific stylesheets > > would be injected automatically (or somehow included into the > > embedding html page) > > > 3. Do we need setPrimaryStyleName? I'd prefer every widget would take > > optional WidgetResources as cstr. argument to customize its look > > (including localized text etc.) > > > 4. Move Contants and Messages capabilities to ImmutableResourceBundle > > >http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse... > > > This would lead to a clean WidgetResource definition like this: > > > @DefaultLocale("en_US") > > public interface TreeTableResources extends ImmutableResourceBundle { > > /** > > * The css file. > > */ > > [EMAIL PROTECTED](verticalAlign = VerticalAlign.MIDDLE, fontSize = "11px" ) > > [EMAIL PROTECTED](fontSize = "12px") > > [EMAIL PROTECTED] treeTable(); > > > [EMAIL PROTECTED]("treeClosed.gif") > > ImageResource treeClosed(); > > > [EMAIL PROTECTED]("treeOpen.gif") > > ImageResource treeOpen(); > > > [EMAIL PROTECTED]("myconstants") > > [EMAIL PROTECTED]("Hello") > > StringResource hello(); > > > [EMAIL PROTECTED]("myconstants") > > [EMAIL PROTECTED]("You have {0} widgets") > > [EMAIL PROTECTED]({"one", "You have one widget") > > StringResource widgetCount(@PluralCount int count); > > } > > > Please compare this very easy solution with all the steps you have to > > take right now. > > To customize a widget you just have to subclass this interface and > > override what you want to see changed. --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---