Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    TreeGrid Drag & Drop Error

    Hi,
    when I'm trying to do a drag&drop operation from a ListGrid to a TreeGrid I'm getting the following error (SmartGWT 2.5 various nightly builds):

    IDE Console:
    Code:
    ERROR: 08:52:27.341:MUP7:WARN:Log:Attempt to add properties to a null object. Creating a new object for the list of properties.. com.smartgwt.client.core.JsObject$SGWT_WARN: 08:52:27.341:MUP7:WARN:Log:Attempt to add properties to a null object. Creating a new object for the list of properties.
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
    	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
    	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
    	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
    	at java.lang.Thread.run(Thread.java:662)
    Developer Console:
    Code:
    08:43:47.472:MDN7:INFO:dragDrop:target is draggable with dragOperation: drag, dragTarget is :[ListGrid ID:isc_ListGrid_0] (delegated from: [GridBody ID:isc_ListGrid_0_body])
    08:43:47.565:TMR6:INFO:dragDrop:Started dragOperation: drag with dragTarget:[ListGrid ID:isc_ListGrid_0] dragAppearance: tracker
    08:43:47.583:TMR0:DEBUG:dragDrop:New drop target: [TreeGridBody ID:isc_TreeGrid_0_body]
    08:43:48.460:MUP2:INFO:dragDrop:end of drag interaction
    [b]08:43:48.534:MUP2:WARN:Log:Attempt to add properties to a null object. Creating a new object for the list of properties.[/b]
    08:43:48.548:MUP2:DEBUG:dragDrop:Invoking transferDragData from inside transferNodes - no server queries needed?
    08:43:48.584:XRP8:DEBUG:dragDrop:Decrementing update count - was 1
    08:43:48.591:XRP8:DEBUG:dragDrop:All updates complete, calling dragComplete()
    The operation seems to work properly though. I was just wondering what causes this error and how I can get rid of it.

    My code looks like:

    EntryPoint
    Code:
        public void onModuleLoad() {
            HLayout hLayout = new HLayout();
            hLayout.setWidth100();
            hLayout.setHeight100();
            TreeGrid tree = new TreeGrid();
            tree.setDataSource(DataSource.get("treeEntityDS"));
            tree.setAutoFetchData(true);
            tree.setCanAcceptDroppedRecords(true);
            tree.addFolderDropHandler(new FolderDropHandler() {
                public void onFolderDrop(FolderDropEvent event) {
                    // omitted
                }
            });
    
            hLayout.addMember(tree);
    
            ListGrid list = new ListGrid();
            list.setDataSource(DataSource.get("listEntityDS"));
            list.setAutoFetchData(true);
            list.setCanDragRecordsOut(true);
            list.setDragDataAction(DragDataAction.COPY);
    
            hLayout.addMember(list);
    
            hLayout.draw();
        }
    ListEntity
    Code:
    @Entity
    public class ListEntity {
    
        private Long id;
        private String name;
    
        @Id
        @GeneratedValue
        public Long getId() {
            return id;
        }
    
        public void setId(Long id) {
            this.id = id;
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    }
    TreeEntity
    Code:
    @Entity
    public class TreeEntity {
    
        private Long id;
        private TreeEntity parent;
        private Long parentId;
    
        @Id
        @GeneratedValue
        public Long getId() {
            return id;
        }
    
        public void setId(Long id) {
            this.id = id;
        }
    
        @ManyToOne
        @JoinColumn(name = "parentId", referencedColumnName = "id", insertable = false, updatable = false)
        public TreeEntity getParent() {
            return parent;
        }
    
        public void setParent(TreeEntity parent) {
            this.parent = parent;
        }
    
        public Long getParentId() {
            return parentId;
        }
    
        public void setParentId(Long parentId) {
            this.parentId = parentId;
        }
    }
    listEntityDS
    Code:
    <DataSource ID="listEntityDS" serverConstructor="com.isomorphic.jpa.JPADataSource"
                beanClassName="de.doitnetworks.server.entity.ListEntity">
        <fields>
            <field name="id" type="integer" hidden="true" primaryKey="true"/>
            <field name="name" title="Name" type="text" required="true" canEdit="true"/>
        </fields>
    
        <serverObject lookupStyle="new" className="sample.server.dmi.ListEntityDmi"/>
    </DataSource>
    treeEntityDS
    Code:
    <DataSource ID="treeEntityDS" serverConstructor="com.isomorphic.jpa.JPADataSource"
                beanClassName="de.doitnetworks.server.entity.TreeEntity">
        <fields>
            <field name="id" type="integer" hidden="true" primaryKey="true"/>
            <field name="parentId" type="integer" foreignKey="treeEntityDS.id" required="false"
                   hidden="true"/>
        </fields>
    
        <serverObject lookupStyle="new" className="sample.server.dmi.TreeEntityDmi"/>
    </DataSource>
    The ListEntity should be converted to a TreeEntity by setting some attributes in the folderDropHandler+handling on the server side, but I omitted that because it makes no difference.

    #2
    Several fixes were made in this area earlier in the week, please retest with the latest nightly..

    If that doesn't fix your problem, please show a test-case.

    Comment


      #3
      It really seems to work with the latest nightly build from 2011-06-09.
      It didn't work with 2011-06-07.

      Thanks for the fast reply.

      Comment

      Working...
      X