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_thread/thread/fe7a28ec77a1664c/55570345cc67236a?lnk=gst&q=proposal+stylenames#55570345cc67236a

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_thread/thread/62b70b169740dd38/c6410b3d994f1dee?lnk=gst&q=stringresource#c6410b3d994f1dee

This would lead to a clean WidgetResource definition like this:

@DefaultLocale("en_US")
public interface TreeTableResources extends ImmutableResourceBundle {
  /**
   * The css file.
   */
  @CSSStyle(verticalAlign = VerticalAlign.MIDDLE, fontSize = "11px" )
  @CSSStyleIE(fontSize = "12px")
  @StyleResource treeTable();

  @Resource("treeClosed.gif")
  ImageResource treeClosed();

  @Resource("treeOpen.gif")
  ImageResource treeOpen();

  @Resource("myconstants")
  @DefaultText("Hello")
  StringResource hello();

  @Resource("myconstants")
  @DefaultText("You have {0} widgets")
  @PluralText({"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
-~----------~----~----~----~------~----~------~--~---

Reply via email to