Okay...after further digging I think I found the problem...the use of
Collections.EMPTY_LIST.

In AbstractTree:
        private final void buildItemChildren(TreeItem item)
        {
                List items;

                // if the node is expanded
                if (isNodeExpanded((TreeNode)item.getModelObject()))
                {
                        // build the items for children of the items' treenode.
                        items = 
buildTreeItems(nodeChildren((TreeNode)item.getModelObject()),
                                        item.getLevel() + 1);
                }
                else
                {
                        // it's not expanded, just set children to an empty list
                        items = Collections.EMPTY_LIST;
                }

                item.setChildren(items);
        }


In Collections.java
    private static class EmptyList
        extends AbstractList
        implements RandomAccess, Serializable {
        // use serialVersionUID from JDK 1.2.2 for interoperability
        private static final long serialVersionUID = 8842843931221139166L;

        public int size() {return 0;}

        public boolean contains(Object obj) {return false;}

        public Object get(int index) {
            throw new IndexOutOfBoundsException("Index: "+index);
        }

        // Preserves singleton property
        private Object readResolve() {
            return EMPTY_LIST;
        }
    }

In AbstractList.java:

    public void add(int index, E element) {
        throw new UnsupportedOperationException();
    }


Question:
- Why use Collections.EMPTY_LIST?  Why not new ArrayList(0)?

My situation is that I am building a tree dynamically and the node will not
be expanded initially because there are no child nodes.  However, I
dynamically add child nodes to the unexpanded node which causes this error.

- Doug
-- 
View this message in context: 
http://www.nabble.com/TreeModel-error-tf4788794.html#a13699709
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to