Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT/UIBinder how to find the main css file with <ui:style>

Tags:

css

gwt

I'm trying to build a gwt website with UIBinder. It's cool, it works, but i have a problem with ui:style.

My project is mavenized (i use the gwt-maven-plugin archetype).

The Application.html and Application.css files are in src/main/resources/com/foo/bar/public.

The page i'm trying to style is in src/main/java/com/foo/bar/client/ Page1.java and Page1.ui.xml.

I can use a css file if it is in the same package with :

<ui:style src="Page1.css" />

But i'd like to target the Application.css (so i could avoid having the same styles in each css file in each package)

I tried different relative paths, and the Application.css is never found.

Is there someone, out there, who had the same problem, and would care to help me ?

Thanks !

like image 989
Maxime ARNSTAMM Avatar asked Sep 16 '10 15:09

Maxime ARNSTAMM


People also ask

What is UI binder in GWT?

Introduction. The UiBinder is a framework designed to separate Functionality and View of User Interface. The UiBinder framework allows developers to build gwt applications as HTML pages with GWT widgets configured throughout them.

How do I add a style to GWT?

addStyleName("gwt-Red-Text"); Using above method you can add as many styles as you like to apply on a widget. If you remove first style from the button widget then second style will still remain with the text.


2 Answers

If your application css is referenced elsewhere in a ClientBundle you can use and avoid your path problems altogether. See Using an external resource.

like image 156
gk5885 Avatar answered Oct 23 '22 05:10

gk5885


Old question, but; I simply referenced a global style like this, without the ui:style directive:

g:TabPanel ui:field="tabPanel" width="100%" height="90%" styleName="nameInMyMainCss"

This is equivalent to calling setStyleName("nameInMyMainCss"); in the matching java class.

like image 38
user1776933 Avatar answered Oct 23 '22 05:10

user1776933