Announcement

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

    Release 2.1 Throws TreeGrid Exception

    I just upgraded to the latest release of Smart GWT 2.1 and my code is now throwing an exception when I double-click a leaf tree node (which creates a Tab in a TabSet). Here's the exception and the TreeGrid code, please let me know if you can shed any light on what the problem might be:

    Code:
    public class IMODTreeGrid extends TreeGrid
    {
        public IMODTreeGrid(int type)
        {
            setSelectionType(SelectionStyle.SINGLE);
    
            TreeNode rootTreeNode = null;
            
            String dragType = null;
            
            switch (type)
            {
    
                case IMODTreeNode.TREE_TYPE_DIGITALASSETS:
                    dragType = "digitalAsset";
                    
                    rootTreeNode = new IMODTreeNode("Root", null, null, IMODTreeNode.TREE_TYPE_DIGITALASSETS,
                        new IMODTreeNode("Resource Library", null, null, IMODTreeNode.TREE_TYPE_FOLDER,
                            new IMODTreeNode("Empty Email Template", "content_library.png", null, IMODTreeNode.TREE_TYPE_DIGITALASSET)));
                    
                    break;
    
                default:
                    break;
            }
    
            setWidth("100%");
            setHeight("100%");
            setOpacity(new Integer(100));
            setBackgroundColor("white");
            setBodyStyleName("normal");
            setShowHeader(Boolean.FALSE);
            setLeaveScrollbarGap(Boolean.FALSE);
            setCanReorderRecords(Boolean.FALSE);
            
            setCanHover(Boolean.TRUE);
            setShowHover(Boolean.TRUE);
            setHoverWidth(10);
            setHoverWrap(Boolean.FALSE);
            
            setCanDragResize(Boolean.FALSE);
            setCanDragReposition(Boolean.FALSE);
            setCanAcceptDroppedRecords(Boolean.FALSE);
            setCanDragRecordsOut(Boolean.TRUE);
            setCanDrag(Boolean.TRUE);
            setDragDataAction(DragDataAction.COPY);
            setDragType(dragType);
            
            setShowConnectors(Boolean.TRUE);
    
            Tree tree = new Tree();
            tree.setModelType(TreeModelType.CHILDREN);
            tree.setNameProperty("name");
            tree.setRoot(rootTreeNode);
            setData(tree);
            
            TreeGridField nameField = new TreeGridField();  
            nameField.setName("name"); 
            
            nameField.setHoverCustomizer(new HoverCustomizer()
            {
                public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum)
                {
                    return ("<NOBR>" + record.getAttribute("name") + "<NOBR>");
                }
            });
            
            setFields(nameField);
            
            getData().openAll();
        }
    
        class IMODTreeNode extends TreeNode
        {
            public final static int TREE_TYPE_DIGITALASSETS = 6;
            public final static int TREE_TYPE_DIGITALASSET = 7;
        
            public IMODTreeNode(String name, String icon, String image, int type)
            {
                this(name, icon, image, type, -1);
            }
    
            public IMODTreeNode(String name, String icon, String image, int type, int subType)
            {
                this(name, icon, image, type, new IMODTreeNode[]{});
    
                if (subType > -1)
                {
                    setAttribute("subType", subType);
                }
            }
    
            public IMODTreeNode(String name, String icon, String image, int type, IMODTreeNode... children)
            {
                setAttribute("name", name);
    
                if (icon != null)
                {
                    setAttribute("icon", icon);
                }
            
                setAttribute("type", type);
                setAttribute("image", image);
                setAttribute("children", children);
            }
        
            public boolean isLeaf()
            {
                return (!(getAttributeAsInt("type").intValue() ==  IMODTreeNode.TREE_TYPE_FOLDER));
            }
        }
    }
    Exception:

    07:59:25.907 [ERROR] [imod] 07:59:25.911:MUP6:WARN:TreeGridBody:isc_OID_29_body:startRowAnimation passed empty row range, aborting: 2,2
    com.smartgwt.client.core.JsObject$SGWT_WARN: 07:59:25.911:MUP6:WARN:TreeGridBody:isc_OID_29_body:startRowAnimation passed empty row range, aborting: 2,2
    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.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
    at java.lang.Thread.run(Thread.java:619)

    #2
    Are you seeing a difference in behavior between 2.0 and 2.1? In 2.1 the warnings that display in the SmartGWT developer console now also display in the GWT console so it could be the case that the warning was present in 2.0 as well but overlooked if the SmartGWT developer console was not open.

    Sanjiv
    Last edited by sjivan; 10 Mar 2010, 05:30.

    Comment


      #3
      The behavior appears to be identical and I do not see the exception using 2.0 in either console. It only appears when using 2.1.

      Comment


        #4
        This is most likely pre-existing. It suggests that you have confused the tree into thinking there are children for a node when there are not. Let us know if you can isolate the behavior down to a runnable sample (but note that the warning seems harmless).

        Comment


          #5
          Yes, that was the issue. For leaf nodes, I was setting the "children" attribute with an empty array of TreeNode objects. Thanks for your help!

          Comment

          Working...
          X