Results 1 to 2 of 2

Thread: Tree setStore does not update its selection model's treeStore.

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jan 2015
    Posts
    29

    Default Tree setStore does not update its selection model's treeStore.

    I am using GXT 3.1.2, Classic Development Mode.

    How to reproduce?
    - Create a Tree tree which consumes a TreeStore ts1.
    - Create a new TreeStore ts2.
    - tree.setStore(ts2).
    - On the UI, click on any item from the tree, then press up or down button from your keyboard.
    - Boom! NullPointerException.

    Possible Cause:
    - I found it was still looking for the item from ts1 although I changed the store to ts2.
    - At com.sencha.gxt.widget.core.client.tree.TreeSelectionModel.next(TreeSelectionModel.java:154), the treeStore field in TreeSelectionModel was not updated(still ts1). TreeSelectionModel has both store and treeStore field and only treeStore field was updated to ts2. It is definitely a bug.

    com.google.gwt.event.shared.UmbrellaException: Exception caught: The given model does not appear to already be in the TreeStore
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
    at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
    at com.sencha.gxt.widget.core.client.Component.fireEvent(Component.java:283)
    at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:125)
    at com.sencha.gxt.widget.core.client.Component.onBrowserEvent(Component.java:599)
    at com.sencha.gxt.widget.core.client.tree.Tree.onBrowserEvent(Tree.java:903)
    at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1480)
    at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1419)
    at com.google.gwt.user.client.impl.DOMImplStandard.dispatchEvent(DOMImplStandard.java:317)
    at sun.reflect.GeneratedMethodAccessor131.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:72)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:341)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:222)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:137)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:589)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:293)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:299)
    at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:72)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:296)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:551)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.AssertionError: The given model does not appear to already be in the TreeStore
    at com.sencha.gxt.data.shared.TreeStore.getWrapper(TreeStore.java:925)
    at com.sencha.gxt.data.shared.TreeStore.getFirstChild(TreeStore.java:541)
    at com.sencha.gxt.widget.core.client.tree.TreeSelectionModel.next(TreeSelectionModel.java:154)
    at com.sencha.gxt.widget.core.client.tree.TreeSelectionModel.onKeyDown(TreeSelectionModel.java:177)
    at com.sencha.gxt.widget.core.client.tree.TreeSelectionModel$1.onDown(TreeSelectionModel.java:51)
    at com.sencha.gxt.core.client.util.KeyNav.handleEvent(KeyNav.java:173)
    at com.sencha.gxt.core.client.util.KeyNav$KeyNavHandler.onKeyDown(KeyNav.java:32)
    at com.google.gwt.event.dom.client.KeyDownEvent.dispatch(KeyDownEvent.java:56)
    at com.google.gwt.event.dom.client.KeyDownEvent.dispatch(KeyDownEvent.java:1)
    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
    at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
    at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
    at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
    at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
    at com.sencha.gxt.widget.core.client.Component.fireEvent(Component.java:283)
    at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:125)
    at com.sencha.gxt.widget.core.client.Component.onBrowserEvent(Component.java:599)
    at com.sencha.gxt.widget.core.client.tree.Tree.onBrowserEvent(Tree.java:903)
    at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1480)
    at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1419)
    at com.google.gwt.user.client.impl.DOMImplStandard.dispatchEvent(DOMImplStandard.java:317)
    at sun.reflect.GeneratedMethodAccessor131.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:72)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:341)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:222)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:137)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:589)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:293)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:299)
    at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:72)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:296)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:551)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368)
    at java.lang.Thread.run(Unknown Source)

  2. #2
    Sencha User
    Join Date
    May 2013
    Posts
    4

    Default

    I just hit this bug, as well.

    I fixed it in my own code by overriding setStore() to rebind the selection model. I expect this or something similar should be the eventual fix.

    Code:
            Tree<T, T> ret = new Tree<T, T>(buildStore(), buildValueProvider()) {
                @Override
                public void setStore(TreeStore<T> store) {
                    super.setStore(store);
                    if(sm != null) {
                        sm.bindTree(this);
                    }
                }
            };

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •