javagwtgwtpgwtquery

Can't add a GwtQuery (1.0.6) DragAndDropCellTree in GWT (2.7) GWTP (1.5) project


I'm trying to add a GwtQuery DragAndDropCellTree to MyView.java in my GWTP project. But I can't GWT Compile it:

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

If I try to navigate to MyView in dev mode:

[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

Upon de-bugging into the DragAndDropCellTree, I arrive at line 624-625 in CellTree:

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

The Style gets set 'successfully', but its injected field is false. So ensureInjected() does not return (it must throw an exception).

I might be doing something wrong with the TreeViewModel and AbstractCell that I implemented to construct my DragAndDropCellTree with... I'm not sure.

Any ideas on how to solve this, or anything else to look into? Thanks.

Edit: my pom.xml (see DND dependency towards bottom, and the repository right above it, per 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>

Edit: From my .gwt.xml:

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

Solution

  • Looking at the source code for CellBasedWidgetImplStandard.java I can see exactly why it's failing. The second argument it's passing to DOM.dispatchEvent() is:

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

    While in the latest version of GWT, that method's second parameter is:

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

    Note the difference in package name between the two. This was a change made in GWT 2.6 (if I recall correctly), so I think the solution here is to find an updated version of the DnD library. Maybe this one fits the bill:

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