Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Editing CSS in Gwt WindowBuilder

I am using GWT in a project and recently started using the WindowBuilder in Eclipse. I created a new class and in the WindowBuilder and added some widgets. All that works and everything. However, when I try to edit the CSS for some of the panels and I click to edit the "styleName" field I get an error message which says:

"There are no CSS files referenced from modules HTML."

I've tried adding a link to a style sheet in my base html file and in the Web.gwt.xml file, but that does not seem to work. I get the same error.

In other classes I have used UiBinder and added the style in the XML file, but this class doesn't use UiBinder. So how do I associate a CSS file with the class so that the WindowBuilder allows me to edit the style?

In this project I don't have or use a "war" directory. The project is a couchapp, so I compile it to another directory and push it to CouchDB from there. It seems that in other projects, where there is the original project setup with a war directory, this feature works properly.

like image 855
Dusty Campbell Avatar asked May 30 '26 13:05

Dusty Campbell


2 Answers

I had the same problem and was able to work around it by moving my CSS-resources from the war-directory to the classpath, specifically inside a package that is declared as a "public path" inside the GWT module descriptior via "<public path='...' />".

Project layout (odd location for module descriptor because of Eclipse Plugin Bug):

src
|- main
   |- java
   |  |- demo
   |     |- client
   |     |  |- MyWidget.java
   |     |  |- MyWidget.ui.xml
   |     |- Demo.gwt.xml
   |- resources
      |- demo
         |- css
            |- Demo.css

Demo.gwt.xml:

<module>
         ...
    <source path="client" />
         ...
    <public path="css" />
    <stylesheet src="Demo.css" />
         ...
</module>
like image 171
nik0las Avatar answered Jun 01 '26 03:06

nik0las


To fix this problem: In module file gwt.xml type:

<stylesheet src="example.css"/>

Next in menu: Project -> clean.

like image 39
Hussar Avatar answered Jun 01 '26 02:06

Hussar