Please add ClientBundle as optional parameter in each widget cstr

21 views
Skip to first unread message

dflorey

unread,
Jan 3, 2010, 6:10:07 AM1/3/10
to Google Web Toolkit Contributors
It would be great if the new ClientBundle would be used to style all
gwt widgets.
(btw: Why is it called ClientBundle and not ResourceBundle as it
bundles up different resources...)

So let each widget define an interface containing all resources used
to style the widget (messages, images, css-styles, sounds etc.) and
provide some default impls that will be used if no bundle is passed in
to cstr when creating the widget.
The default impl could be provided by the theme module.
Is there a plan to move the constants / messages to ClientBundle as
well? This would help to package all widget resources in one place.

I've posted some more thoughts on this some months/years ago but
cannot find the thread ...

Cheers+thanks for the great work on 2.0!!

Daniel

BobV

unread,
Jan 4, 2010, 10:04:22 AM1/4/10
to google-web-tool...@googlegroups.com, John LaBanca
On Sun, Jan 3, 2010 at 6:10 AM, dflorey <daniel...@gmail.com> wrote:
> It would be great if the new ClientBundle would be used to style all
> gwt widgets.

I think John probably has some ideas here.

> (btw: Why is it called ClientBundle and not ResourceBundle as it
> bundles up different resources...)

To avoid the conflict with java.util.ResourceBundle.

--
Bob Vawter
Google Web Toolkit Team

dflorey

unread,
Jan 4, 2010, 10:20:37 AM1/4/10
to Google Web Toolkit Contributors
On Jan 4, 4:04 pm, BobV <b...@google.com> wrote:

> On Sun, Jan 3, 2010 at 6:10 AM, dflorey <daniel.flo...@gmail.com> wrote:
> > It would be great if the new ClientBundle would be used to style all
> > gwt widgets.
>
> I think John probably has some ideas here.
>
> > (btw: Why is it called ClientBundle and not ResourceBundle as it
> > bundles up different resources...)
>
> To avoid the conflict with java.util.ResourceBundle.

:-)

John LaBanca

unread,
Jan 4, 2010, 10:21:31 AM1/4/10
to Joel Webber, Ray Ryan, google-web-tool...@googlegroups.com, BobV
We definitely plan to use ClientBundles to provide default stylings for all widgets, but we haven't really talked about how to go about doing that yet.  Ideally, we want to use ClientBundles without breaking apps that are already using the existing CSS style themes.

We could add ClientBundles to all widgets to serve as a default style, and we can also provide a DeferredBinding to an "Unstyled" ClientBundle for each widget.  If a user inherits one of the existing CSS style themes, the Standard/Chrome/Dark.gwt.xml files will inherit the Unstyled deferred binding, thus disabling the ClientBundles for backway compatibility.

Thanks,
John LaBanca
jlab...@google.com

Joel Webber

unread,
Jan 4, 2010, 10:28:19 AM1/4/10
to John LaBanca, Ray Ryan, google-web-tool...@googlegroups.com, BobV
What John said. There are a few difficult design problems in doing this properly -- i.e., with no overhead for those just using plain CSS, nor for those using CssResource/ClientBundle "themes". I am confident the problem is soluble, though.

dflorey

unread,
Jan 4, 2010, 11:17:00 AM1/4/10
to Google Web Toolkit Contributors
If you are interested I've already done this for my table branch in
the incubator. It's a little bit outdated - I need to port the branch
to 2.0... :-(
The only show stopper I see right is that Messages/Contacts are not
yet part of the ClientBundle, so I came up with something like this
(copy&paste from branch source):

/**
* An {@link ImageBundle} that provides images for {@link
AbstractScrollTable}
* .
*/
public static interface Css extends CssResource {
/**
* Widget style name.
*
* @return the widget's style name
*/
@ClassName("gwt-ScrollTable")
String defaultStyleName();

String headerTable();

String dataTable();

String footerTable();

String headerWrapper();

String dataWrapper();

String footerWrapper();
}

/**
* Resources used.
*/
public interface ScrollTableStyle extends ClientBundle {
/**
* The css file.
*/
@Source("com/google/gwt/gen2/widgetbase/public/ScrollTable.css")
@NotStrict
Css css();

/**
* An image used to fill the available width.
*
* @return an image resource of this image
*/
@Source("scrollTableFillWidth.gif")
ImageResource scrollTableFillWidth();

/**
* An image indicating that a column is sorted in ascending order.
*
* @return an image resource of this image
*/
@Source("scrollTableAscending.gif")
ImageResource scrollTableAscending();

/**
* An image indicating a column is sorted in descending order.
*
* @return an image resource of this image
*/
@Source("scrollTableDescending.gif")
ImageResource scrollTableDescending();

@Source("headerBackground.png")
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
ImageResource headerBackground();
}

public interface ScrollTableMessages extends Messages {
@DefaultMessage("Shrink/Expand to fill visible area")
String shrinkExpandTooltip();

@DefaultMessage("Shows only dates that are equal")
String dateOperatorEqualTooltip();

@DefaultMessage("Shows only dates that not equal")
String dateOperatorUnequalTooltip();

@DefaultMessage("Show only dates before the given date")
String dateOperatorBeforeTooltip();

@DefaultMessage("Show only dates after the given date")
String dateOperatorAfterTooltip();

@DefaultMessage("Show only dates between the given dates")
String dateOperatorBetweenTooltip();
}

public interface ScrollTableResources {
ScrollTableStyle getStyle();

ScrollTableMessages getMessages();
}


On Jan 4, 4:28 pm, Joel Webber <j...@google.com> wrote:
> What John said. There are a few difficult design problems in doing this
> properly -- i.e., with no overhead for those just using plain CSS, nor for
> those using CssResource/ClientBundle "themes". I am confident the problem is
> soluble, though.
>
>
>
> On Mon, Jan 4, 2010 at 10:21 AM, John LaBanca <jlaba...@google.com> wrote:
> > We definitely plan to use ClientBundles to provide default stylings for all
> > widgets, but we haven't really talked about how to go about doing that yet.
> >  Ideally, we want to use ClientBundles without breaking apps that are
> > already using the existing CSS style themes.
>
> > We could add ClientBundles to all widgets to serve as a default style, and
> > we can also provide a DeferredBinding to an "Unstyled" ClientBundle for each
> > widget.  If a user inherits one of the existing CSS style themes, the
> > Standard/Chrome/Dark.gwt.xml files will inherit the Unstyled deferred
> > binding, thus disabling the ClientBundles for backway compatibility.
>
> > Thanks,
> > John LaBanca

> > jlaba...@google.com
>
> > On Mon, Jan 4, 2010 at 10:04 AM, BobV <b...@google.com> wrote:

BobV

unread,
Jan 4, 2010, 11:24:02 AM1/4/10
to google-web-tool...@googlegroups.com
On Mon, Jan 4, 2010 at 11:17 AM, dflorey <daniel...@gmail.com> wrote:
> The only show stopper I see right is that Messages/Contacts are not
> yet part of the ClientBundle, so I came up with something like this
> (copy&paste from branch source):

You can bridge them with a GwtCreateResource or add a new
ResourceGenerator type to ClientBundle that will make Messages /
Constants a first-class resource type.

John Tamplin

unread,
Jan 4, 2010, 11:26:03 AM1/4/10
to BobV, google-web-tool...@googlegroups.com
How hard would it be to allow a method returning some subtype of LocalizableResource in ClientBundle, and have the generated code just do GWT.create on it automatically? 

--
John A. Tamplin
Software Engineer (GWT), Google

dflorey

unread,
Jan 24, 2010, 8:12:58 AM1/24/10
to Google Web Toolkit Contributors
Any news on this idea? It would be very nice to have Messages/
Constants as available resource types to bundle all resources in one
place.


On Jan 4, 5:26 pm, John Tamplin <j...@google.com> wrote:
> On Mon, Jan 4, 2010 at 11:24 AM, BobV <b...@google.com> wrote:

Ray Ryan

unread,
Jan 24, 2010, 9:02:46 AM1/24/10
to google-web-tool...@googlegroups.com
Creating new ResourceGenerators is trivial, and requires no changes to GWT (one of the best features of ClientBundle). See TextResourceGenerator for an example.

Dan, I'm afraid you can't expect anyone from the GWT team to jump on this problem in Q1. We're saturated.

Ray Ryan

unread,
Jan 24, 2010, 9:04:39 AM1/24/10
to google-web-tool...@googlegroups.com
But we'd be available for code reviews…

(Also see TextResource to see how to register the things.) 
Reply all
Reply to author
Forward
0 new messages