Editing CSS in Gwt WindowBuilder

半城伤御伤魂 提交于 2019-12-22 00:34:39

问题


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.


回答1:


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>



回答2:


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

<stylesheet src="example.css"/>

Next in menu: Project -> clean.



来源:https://stackoverflow.com/questions/6461436/editing-css-in-gwt-windowbuilder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!