Overriding themes

64 views
Skip to first unread message

Tobias

unread,
Sep 7, 2011, 9:53:14 AM9/7/11
to Google Web Toolkit
Hi,

I am trying to customize the look of my application. My plan was to
keep one of the default themes and override just those styles that I
want to change.

My first attempt was to add the overridden styles to the CSS file that
I am including in my HTML host page using "<link ..>". But
unfortunately this does not work because that CSS file is loaded
before the theme CSS file. And then the theme CSS takes precedence.

This blog [1] explains an alternative solution which includes a custom
CSS file located in a "public" folder using "<stylesheet
src=...>" (inside the "*.gwt.xml" file). Is this the intended approach
for overriding themes? I am a bit surprised because "<stylesheet ..>"
is marked as deprecated and this "public" folder is not mentioned in
the documentation (?).

And I am not sure how I could use CssRessource/UiBinder, because I do
not want to apply my custom style just to e.g. one button but to all
buttons.

Any hint would be appreciated!

Thanks,
Tobias


[1]: http://www.jeanhsu.com/2010/04/29/overriding-gwts-default-stylesheet/
[2]: http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideUiCss.html#cssfiles

Sudhakar Abraham

unread,
Sep 8, 2011, 3:48:51 AM9/8/11
to Google Web Toolkit
To specify your own style in uibinder.xml file, edit <ui:style></
ui:style> tag as follows

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'>
<ui:style>
.buttonSave
{
float: left;
background:#E8E8E8;
margin-left: 200px;
}
</ui:style>
<g:DockLayoutPanel ui:field="dock" unit="PX" width="700px"
height="600px">
<g:Button ui:field="save" styleName="{style.buttonSave}">
</g:DockLayoutPanel>
</ui:UiBinder>

S. Abraham
www.DataStoreGwt.com
> [2]:http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideUiCss...

Tobias

unread,
Sep 8, 2011, 11:50:38 AM9/8/11
to Google Web Toolkit
Hi Sudhakar,

thanks for your reply. Yes, that is how you can assign a style to a
single button. I was wondering what is the best way to set a style for
ALL buttons in my application.

Tobias

Tobias

unread,
Sep 13, 2011, 8:51:07 AM9/13/11
to Google Web Toolkit
For the sake of completeness: I got an answer in another thread, see
http://groups.google.com/group/google-web-toolkit/msg/c2686706b45b8f60
Reply all
Reply to author
Forward
0 new messages