Editing CSS in Gwt WindowBuilder

2020-07-25 10:09发布

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.

2条回答
啃猪蹄的小仙女
2楼-- · 2020-07-25 10:37

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>
查看更多
Animai°情兽
3楼-- · 2020-07-25 10:54

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

<stylesheet src="example.css"/>

Next in menu: Project -> clean.

查看更多
登录 后发表回答