在Gwt WindowBuilder中编辑CSS [英] Editing CSS in Gwt WindowBuilder

查看:133
本文介绍了在Gwt WindowBuilder中编辑CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目中使用GWT,最近开始在Eclipse中使用WindowBuilder。我创建了一个新类并在WindowBuilder中添加了一些小部件。一切工作和一切。但是,当我尝试编辑一些面板的CSS,我点击编辑styleName字段我得到一个错误消息,说:

 没有从模块HTML引用的CSS文件。 

我试图在基本html文件和Web中向样式表添加链接。 gwt.xml文件,但是似乎不工作。我得到相同的错误。



在其他类中,我已经使用UiBinder并添加了XML文件中的样式,但是这个类不使用UiBinder。那么如何将CSS文件与类关联,以便WindowBuilder允许我编辑样式?



在这个项目中,我没有或使用war 目录。该项目是一个couchapp,所以我编译到另一个目录,并推到CouchDB从那里。似乎在其他项目中,有一个war目录的原始项目设置,此功能正常工作。

解决方案

有相同的问题,并能够解决它通过将我的CSS资源从war目录移动到类路径,特别是在一个包内声明为公共路径在GWT模块描述符通过< public path ='...'/>。



项目布局(模块描述符的奇数位置,因为 Eclipse Plugin Bug ):

  src 
| - main
| - java
| | - demo
| | - client
| | | - MyWidget.java
| | | - MyWidget.ui.xml
| | - Demo.gwt.xml
| - 资源
| - demo
| - css
| - Demo.css
pre>

Demo.gwt.xml:

 < module& 
...
< source path =client/>
...
< public path =css/>
< stylesheet src =Demo.css/>
...
< / module>


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.

解决方案

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>

这篇关于在Gwt WindowBuilder中编辑CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆