0
在较大的GWT 2.2.0应用程序中,我们希望使用动态CellTables。与其他小部件不同,CellTable不使用css样式的标准名称(例如“gwt-MenuItem”)。因此,我们必须从标准的CSS来CssResource,后者也必须inlcude标准“gwt-”风格的移动,如下所示:使用蚂蚁的CssResource编译问题的GWT 2.2项目
public interface IPreferences
{
public interface MyCssResource extends CssResource
{
String content();
...
}
@ImportedWithPrefix("gwt")
public interface GwtCss extends CssResource
{
String MenuItem();
String MenuBar();
String TabLayoutPanelTab();
}
...
public interface MyResources extends ClientBundle
{
public static final MyResources INSTANCE = GWT.create(MyResources.class);
@Source("preferences.css")
@Import(GwtCss.class) <--- any imported interface will produce error
MyCssResource cssStd();
}
}
此作品在托管模式很好,可以使用Eclipse编译,但它确实不使用蚂蚁编译:
<target name="gwtc" depends="compile" description="GWT compile to JavaScript">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<pathelement location="gwt-servlet.jar"/>
<pathelement location="gwt-dev.jar"/>
<pathelement location="gwt-user.jar"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<arg line="-war"/>
<arg value="war"/>
<arg value="...module.file"/>
</java>
</target>
[java] [ERROR] Annotation error: cannot resolve ...IPreferences$GwtCss
[java] java.lang.ClassNotFoundException: ...IPreferences$GwtCss
我找不到任何提示在eclipse外编译这个必须做什么。 谢谢你的评论。
Thanl you for the hint。虽然我不明白为什么生成的接口应该比手动编写的接口“更好”,但使用InterfaceGenerator进行的实验使我找到了一种避免首先使用@Import的解决方案: 而不是在虚线上执行@ImpportWithPrefix “gwt - ” - 设置生成器使用的@Classname注释。因此,所有样式都可以通过一个接口导入,并且不需要@导入其他样式。 – Capoocan 2011-04-04 08:54:30