Are you not already aware of the sample for creating parent-linked trees? You should be able to just take the Records from a DSResponse and do what this sample shows.
Announcement
Collapse
No announcement yet.
X
-
I think I was overlooking the fact that a TreeNode is just another js object with attributes, so you can create a TreeNode from a Record with new TreeNode(record.getJsObj()). So I can easily create an array of nodes from the response records and then use Tree.setData() with the array of nodes.
But now when call Tree.getFilteredTree(myCriteria) I get [ERROR] [ipgui] - 15:25:47.830:XRP0:WARN:Log:Cannot apply filter to Tree without dataSource.
But I don't see any way to setDataSource() on the Tree. ??
Comment
-
I even tried putting the tree into a dummy TreeGrid, setting the datasource on the grid, and then getting the tree back and trying to filter it. Same error/warning message. Cannot apply filter to Tree without dataSource.
Code:TreeGrid dummyGrid = new TreeGrid(); dummyGrid.setDataSource(merchHierarchyDS); dummyGrid.setData(merchHierarchyTree); Tree filteredTree = dummyGrid.getTree().getFilteredTree(criteria); pickTree.setValueTree(filteredTree);
Comment
-
ResultTree, a subclass of Tree that supports tree-style load on demand separately from any UI component, has setDataSource(). 3.1d now has APIs for creating one directly, but if you don't want to jump to 3.1, your approach below of using a dummy TreeGrid will work so long as you call fetchData()/filterData() before trying to grab the Tree.
Comment
-
I tried calling dummyGrid.filterData(criteria), right after setData() and the warning went away but the pickTree still shows the full tree.
I tried fetchData() instead of filterData() but that triggers an actual fetch to the server, which I don't want to do since I already have the full tree on the client.
Comment
-
Yes, fetchData()/filterData() will do a fetch from the server. The Tree you get initially is going to be whatever the server returned given the criteria you passed, and you can then call getFilteredTree().
If you have the data locally already, TreeGrid.setInitialData() will allow you to populate the ResultTree and then fetchData() won't go to the server (if called with no criteria).
Or again there's the new APIs in 3.1 that allow direct construction of ResultTree.
Comment
-
I decided to try a different approach. I'm now fetching the full set of records from the datasource and saving the RecordList. Instead of trying to filter the tree, I'm using RecordList.findAll() to get the subset of records I need and then creating a Tree from those and calling setValueTree() with that.
I can see that my Tree is being created with a subset of the data, but the pickTreeItem still shows the original full set of data that was originally loaded. It appears that the problem is with setValueTree() not working.
I've even looked at the IPickTreeItem using the SC dev console with isc_IPickTreeItem_1.valueTree.root.children and I can see that the tree contains only the subset of data. Nevertheless, the tree that is displayed is still the full tree.
Is there something else I need to do to refresh or redraw the PickTreeItem? I tried marking the form for redraw.
Comment
-
Just looking for consistency, not clairvoyance. :) ListGrids and SelectItems use datasources for field definitions, but calling setData() or equvialent replaces their record set with another, effectively detaching it from the datasource fetch results. I was expecting the same from PickTreeItem.setValueTree().
I've removed the call to PickTreeItem.setDataSource() and still my tree, set with setValueTree(), doesn't show up. Could it be something wrong with the tree? I've examined the PickTreeItem and drilled in to the data, which looks OK. Am I missing something?
Code:Evaluator: result of 'isc_IPickTreeItem_1...' (0ms): IPickTreeItem{eventParent: [DynamicForm ID:isc_DynamicForm_13], containerWidget: [DynamicForm ID:isc_DynamicForm_13], form: [DynamicForm ID:isc_DynamicForm_13], name: "itemClass", editorType: "IPickTreeItem", title: "Class", showTitle: false, emptyDisplayValue: "Choose a class", valueField: "ID", displayField: "CLNM", loadDataOnDemand: false, canSelectParentItems: false, ID: "isc_IPickTreeItem_1", button: [ITreeMenuButton ID:isc_IPickTreeItem_1_button], canvas: [ITreeMenuButton ID:isc_IPickTreeItem_1_button], autoDestroy: true, valueTree: [Tree ID:isc_Tree_24], } Evaluator: result of 'isc_IPickTreeItem_1.valueTree...' (0ms): Tree{ID: "isc_Tree_24", modelType: "parent", idField: "ID", parentIdField: "ParentID", nameProperty: "CLNM", rootValue: 400002, showRoot: true, reportCollisions: false, data: Array[67], parentProperty: "_parent_isc_Tree_24", openProperty: "_isOpen_isc_Tree_24", root: Obj{ID:400002}, nodeIndex: Obj} Evaluator: result of 'isc_IPickTreeItem_1.valueTree.data...' (0ms): [Obj{name:400002}, Obj{name:300020}, Obj{name:300021}, Obj{name:300022}, Obj{name:300023}, Obj{name:300024}, Obj{name:300025}, Obj{name:300026}, Obj{name:300027}, Obj{name:300028}, Obj{name:300029}, Obj{name:300030}, Obj{name:300031}, Obj{name:300032}, Obj{name:300033}, Obj{name:200023}, Obj{name:200024}, Obj{name:200025}, Obj{name:200026}, Obj{name:200027}, Obj{name:200028}, Obj{name:200029}, Obj{name:200030}, Obj{name:200031}, Obj{name:200032}, Obj{name:200033}, Obj{name:200034}, Obj{name:200035}, Obj{name:200036}, Obj{name:200037}, Obj{name:200038}, Obj{name:100084}, Obj{name:100085}, Obj{name:100086}, Obj{name:100087}, Obj{name:100088}, Obj{name:100089}, Obj{name:100090}, Obj{name:100091}, Obj{name:100092}, Obj{name:100093}, Obj{name:100094}, Obj{name:100095}, Obj{name:100096}, Obj{name:100097}, Obj{name:100098}, Obj{name:100099}, Obj{name:100100}, Obj{name:100101}, Obj{name:100102}, Obj{name:100103}, Obj{name:100104}, Obj{name:100105}, Obj{name:100106}, Obj{name:100107}, Obj{name:100108}, Obj{name:100109}, Obj{name:100110}, Obj{name:100111}, Obj{name:100112}, Obj{name:100113}, Obj{name:100114}, Obj{name:100115}, Obj{name:100116}, Obj{name:100117}, Obj{name:100118}, Obj{name:100119} ] Evaluator: result of 'isc_IPickTreeItem_1.valueTree.data[0]...' (0ms): {CCLS: 0, CDPT: 0, CCNCPT: 1, CLNM: "02 Hosiery", CSBD: 0, Type: "DIV", ID: 400002, CDIV: 2, Code: 2, ParentID: 400002, name: "400002", _parent_isc_Tree_6: Obj{name:/}, isFolder: true, children: Array[14], _parent_isc_Tree_12: Obj{name:/}, _parent_isc_Tree_18: Obj{name:/}, _parent_isc_Tree_24: Obj{ID:400002}}
Comment
-
It seems that once the valueTree is set for a PickTreeItem and the form on which it sits is drawn, then setting a new valueTree doesn't cause the PickTreeItem tree menu to be recreated, even if the form on which it sits is marked for redraw.
I can create a couple of different trees and whichever one is passed to setValueTree() first is the one that is displayed. After calling setValueTree() with the other I can see by examining the PickTreeItem.valueTree.data in dev console that the correct data has been set. But the set of options is still what was originally displayed. There is no datasource on the PickTreeItem.
So I'm back to my earlier question .. Is there something else I need to do to force the PickTreeItem to recreate it's visual representation.?
Comment
-
Digging around with the developer console I can now see that the PickTreeItem has a valueTree with the correct data, but what is displayed in the UI is a TreeMenuButton which has a menu constructed from the data from the original valueTree.
PickTreeButton data with the original data starting with root node ID 400001.
Code:Evaluator: result of 'isc_IPickTreeItem_1_button.menu.data[0]...' (0ms): {CCLS: 0, CDPT: 0, CCNCPT: 1, CLNM: "01 Accessories", CSBD: 0, Type: "DIV", ID: 400001, CDIV: 1, Code: 1, ParentID: undef, _parent_isc_Tree_4: Obj, isFolder: true, children: Array[19], } Evaluator: result of 'isc_IPickTreeItem_1_button.menu.data[0].children...' (0ms): [Obj{ID:300001}, Obj{ID:300002}, Obj{ID:300003}, Obj{ID:300004}, Obj{ID:300005}, Obj{ID:300006}, Obj{ID:300007}, Obj{ID:300008}, Obj{ID:300009}, Obj{ID:300010}, Obj{ID:300011}, Obj{ID:300012}, Obj{ID:300013}, Obj{ID:300014}, Obj{ID:300015}, Obj{ID:300016}, Obj{ID:300017}, Obj{ID:300018}, Obj{ID:300019} ]
Code:Evaluator: result of 'isc_IPickTreeItem_1.valueTree.data...' (0ms): [Obj{ID:400007}, Obj{ID:300084}, Obj{ID:300085}, Obj{ID:300086}, Obj{ID:300087}, Obj{ID:300088}, Obj{ID:300089}, Obj{ID:300090}, Obj{ID:300091}, Obj{ID:300092}, Obj{ID:300093}, Obj{ID:300094}, Obj{ID:300095}, Obj{ID:300096}, Obj{ID:300097}, Obj{ID:300098}, Obj{ID:300099}, Obj{ID:300100}, Obj{ID:300101}, Obj{ID:200164}, Obj{ID:200165}, Obj{ID:200166}, Obj{ID:200167}, Obj{ID:200168}, Obj{ID:200169}, Obj{ID:200170}, Obj{ID:200171}, Obj{ID:200172}, Obj{ID:200173}, Obj{ID:200174}, Obj{ID:200175}, Obj{ID:200176}, Obj{ID:200177}, Obj{ID:200178}, Obj{ID:200179}, Obj{ID:200180}, Obj{ID:200181}, Obj{ID:200182}, Obj{ID:200183}, Obj{ID:200184}, Obj{ID:200185}, Obj{ID:200186}, Obj{ID:100411}, Obj{ID:100412}, Obj{ID:100413}, Obj{ID:100414}, Obj{ID:100415}, Obj{ID:100416}, Obj{ID:100417}, Obj{ID:100418}, Obj{ID:100419}, Obj{ID:100420}, Obj{ID:100421}, Obj{ID:100422}, Obj{ID:100423}, Obj{ID:100424}, Obj{ID:100425}, Obj{ID:100426}, Obj{ID:100427}, Obj{ID:100428}, Obj{ID:100429}, Obj{ID:100430}, Obj{ID:100431}, Obj{ID:100432}, Obj{ID:100433}, Obj{ID:100434}, Obj{ID:100435}, Obj{ID:100436}, Obj{ID:100437}, Obj{ID:100438}, Obj{ID:100439}, Obj{ID:100440}, Obj{ID:100441}, Obj{ID:100442}, Obj{ID:100443}, Obj{ID:100444}, Obj{ID:100445}, Obj{ID:100446}, Obj{ID:100447}, Obj{ID:100448}, Obj{ID:100449}, Obj{ID:100450}, Obj{ID:100451}, Obj{ID:100452}, Obj{ID:100453}, Obj{ID:100454}, Obj{ID:100455}, Obj{ID:100456}, Obj{ID:100457}, Obj{ID:100458}, Obj{ID:100459}, Obj{ID:100460}, Obj{ID:100461}, Obj{ID:100462}, Obj{ID:100463}, Obj{ID:100464}, Obj{ID:100465}, Obj{ID:100466}, Obj{ID:100467} ]
Comment
-
You're right - setValueTree is not rebuilding or rebinding the heirarchy of menus.
We're making a change to address this in 3.1d which should be present in tomorrow's nightly build.
For 3.0p here's a chunk of JSNI which will have the same effect:
Code:private void setItemValueTree(PickTreeItem item, Tree tree) { JavaScriptObject itemJS = item.getJsObj(); if (itemJS == null) { item.setValueTree(tree); } else { setItemValueTreeJS(itemJS, tree.getJsObj()); } } private native void setItemValueTreeJS (JavaScriptObject item, JavaScriptObject tree) /*-{ item.valueTree = tree; if (item.canvas != null) item.canvas.data = tree; if (item.canvas != null && item.canvas.menu != null) { item.canvas.menu.destroy(); item.canvas.menu = null; } }-*/;
Comment
-
Thanks. I'm trying the jsni but getting this error at this line of code.
setItemValueTreeJS(itemJS, tree.getJsObj());
Code:20:48:08.561 [ERROR] [ipgui] Uncaught exception escaped com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129) at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:248) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269) 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:213) at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.smartgwt.client.widgets.form.ValuesManager.editRecord(ValuesManager.java) at com.islandpacific.gui.client.purchasing.productionorder.ProductionOrderEditor$15.onDataArrived(ProductionOrderEditor.java:576) at com.smartgwt.client.widgets.form.fields.events.DataArrivedEvent.dispatch(DataArrivedEvent.java:96) at com.smartgwt.client.widgets.form.fields.events.DataArrivedEvent.dispatch(DataArrivedEvent.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.smartgwt.client.core.DataClass.fireEvent(DataClass.java:248) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269) 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:213) at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) at java.lang.Thread.run(Thread.java:680) Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError): _2 is null at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.smartgwt.client.widgets.form.fields.FormItem.setValue(FormItem.java) at com.islandpacific.gui.client.IpClassPicker$1$2.onShowValue(IpClassPicker.java:104) at com.smartgwt.client.widgets.form.fields.events.ShowValueEvent.dispatch(ShowValueEvent.java:96) at com.smartgwt.client.widgets.form.fields.events.ShowValueEvent.dispatch(ShowValueEvent.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.smartgwt.client.core.DataClass.fireEvent(DataClass.java:248) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269) 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:213) at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.smartgwt.client.widgets.form.ValuesManager.editRecord(ValuesManager.java) at com.islandpacific.gui.client.purchasing.productionorder.ProductionOrderEditor$15.onDataArrived(ProductionOrderEditor.java:576) at com.smartgwt.client.widgets.form.fields.events.DataArrivedEvent.dispatch(DataArrivedEvent.java:96) at com.smartgwt.client.widgets.form.fields.events.DataArrivedEvent.dispatch(DataArrivedEvent.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.smartgwt.client.core.DataClass.fireEvent(DataClass.java:248) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269) 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:213) at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) at java.lang.Thread.run(Thread.java:680)
Comment
-
Ah - if the Tree has never been referred to in JS code you'll need getOrCreateJsObj rather than just getJsObj
Here's a reworked version:
Code:private void setItemValueTree(PickTreeItem item, Tree tree) { JavaScriptObject itemJS = item.getJsObj(); if (itemJS == null) { item.setValueTree(tree); } else { setItemValueTreeJS(itemJS, tree.getOrCreateJsObj()); } } private native void setItemValueTreeJS (JavaScriptObject item, JavaScriptObject tree) /*-{ item.valueTree = tree; if (item.canvas != null) item.canvas.data = tree; if (item.canvas != null && item.canvas.menu != null) { item.canvas.menu.destroy(); item.canvas.menu = null; } }-*/;
Comment
Comment