我正在尝试在GWTP项目中向MyView.java添加GwtQuery DragAndDropCellTree。但是我不能用GWT编译它:

Tracing compile failure path for type 'com.google.gwt.user.cellview.client.CellBasedWidgetImplStandard'
  [ERROR] Errors in 'com/google/gwt/user/cellview/client/CellBasedWidgetImplStandard.java'
    [ERROR] Line 54: Referencing method 'com.google.gwt.user.client.DOM.dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)': unable to resolve method in class 'com.google.gwt.user.client.DOM'
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] Hint: Check that your module inherits 'com.google.gwt.user.User' either directly or indirectly
Tracing compile failure path for type 'com.google.gwt.user.cellview.client.CellBasedWidgetImplTrident'
  [ERROR] Errors in 'com/google/gwt/user/cellview/client/CellBasedWidgetImplTrident.java'
    [ERROR] Line 98: Referencing method 'com.google.gwt.user.client.DOM.dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)': unable to resolve method in class 'com.google.gwt.user.client.DOM'
...
[ERROR] Errors in 'com/google/gwt/user/cellview/client/CellBasedWidgetImpl.java'
    [ERROR] Line 46: Rebind result 'com.google.gwt.user.cellview.client.CellBasedWidgetImplTrident' could not be found
Tracing compile failure path for type 'com.google.gwt.query.client.GQuery'
  [ERROR] Errors in 'com/google/gwt/query/client/GQuery.java'
    [ERROR] Line 469: The method f(Object[]) is ambiguous for the type Function


如果我尝试在开发人员模式下导航到MyView:

[ERROR] Errors in 'com/google/gwt/user/cellview/client/CellBasedWidgetImplStandard.java'
  [ERROR] Line 54: Referencing method 'com.google.gwt.user.client.DOM.dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)': unable to resolve method in class 'com.google.gwt.user.client.DOM'
[ERROR] - Member 'null' in JSNI reference '@com.google.gwt.user.client.DOM::null' could not be found; expect subsequent failures


调试进入DragAndDropCellTree后,我到达了CellTree中的第624-625行:

this.style = resources.cellTreeStyle(); this.style.ensureInjected();

样式设置为“成功”,但其injected字段为false。因此ensureInjected()不返回(必须抛出异常)。

我可能无法实现使用TreeViewModel和AbstractCell构造我的DragAndDropCellTree所犯的错误...我不确定。

关于如何解决此问题的任何想法,或其他需要研究的想法?
谢谢。

编辑:我的pom.xml(请参见指向底部的DND依赖关系,以及位于其上方的存储库,根据DragAndDropPlugin configuration):

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.priorigram</groupId>
    <artifactId>PrioriGram</artifactId>
    <version>0</version>

    <packaging>war</packaging>
    <name>GWTP Basic</name>

    <properties>
        <!-- client -->
        <gwt.version>2.7.0</gwt.version>
        <gwtp.version>1.5.1</gwtp.version>
        <gin.version>2.1.2</gin.version>
        <gwt.style>OBF</gwt.style>

        <!-- maven -->
        <maven-war-plugin.version>2.6</maven-war-plugin.version>
        <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>

        <target.jdk>1.7</target.jdk>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
    </properties>

    <build>
        <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

        <resources>
            <resource>
                <directory>src/main/java/com/priorigram/client/resources</directory>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${target.jdk}</source>
                    <target>${target.jdk}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>

            <!-- GWT -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwt.version}</version>
                <configuration>
                    <strict>true</strict>

                    <testTimeOut>180</testTimeOut>
                    <mode>htmlunit</mode>
                    <includes>**/*GwtTest.java</includes>

                    <logLevel>INFO</logLevel>

                    <runTarget>index.html</runTarget>
                    <module>com.priorigram.PrioriGram</module>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
         <id>plugins</id>
         <url>http://gwtquery-plugins.googlecode.com/svn/mavenrepo</url>
       </repository>
   </repositories>

    <dependencies>
        <!-- DND -->
        <dependency>
            <groupId>com.googlecode.gwtquery.bundles</groupId>
            <artifactId>gquery-dnd-bundle</artifactId>
            <version>1.0.6</version>
            <scope>provided</scope>
        </dependency>

        <!-- GWT -->
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwt.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- GWTP -->
        <dependency>
            <groupId>com.gwtplatform</groupId>
            <artifactId>gwtp-mvp-client</artifactId>
            <version>${gwtp.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- DI -->
        <dependency>
            <groupId>com.google.gwt.inject</groupId>
            <artifactId>gin</artifactId>
            <version>${gin.version}</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

</project>


编辑:从我的.gwt.xml:

<inherits name='com.google.gwt.user.User'/>
<inherits name="com.gwtplatform.mvp.MvpWithEntryPoint"/>
<inherits name='gwtquery.plugins.droppable.Droppable'/>

最佳答案

查看CellBasedWidgetImplStandard.java的源代码,我可以确切地知道为什么它失败了。它传递给DOM.dispatchEvent()的第二个参数是:

Lcom/google/gwt/user/client/Element;


在最新版本的GWT中,该方法的第二个参数是:

Lcom/google/gwt/dom/client/Element;


请注意两者之间的软件包名称不同。这是GWT 2.6中的更改(如果我没记错的话),所以我认为这里的解决方案是找到DnD库的更新版本。也许这符合要求:

https://github.com/ArcBees/gwtquery-droppable-plugin

10-04 18:08