Announcement

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

    FilterBuilder with setFieldDataSource getCriteria fails from callback

    I created a FilterBuilder and used setFieldDataSource to define the available fields. If I set an initial criteria and then serialize the criteria with getCriteria and print it out after drawing the FilterBuilder, it works fine. If I serialize the criteria and print it from the button callback, later, it throws an exception.

    Here's the test code:
    Code:
    final FilterBuilder testFilter = new FilterBuilder();
    final DataSource fieldDataSource = new DataSource() {
    	{
    		setClientOnly(true);
    		setFields(new DataSourceTextField("name", "Name"),
    				new DataSourceTextField("title", "Title"),
    				new DataSourceTextField("type", "Type"));
    		DataClass sourceData[] = new DataClass[] {
    			new DataClass()	
    		};
    		sourceData[0].setAttribute("name", "test1");
    		sourceData[0].setAttribute("title", "<b>Test</b>");
    		sourceData[0].setAttribute("type", FieldType.FLOAT);
    		setTestData(sourceData);
    	}
    };
    testFilter.setFieldDataSource(fieldDataSource);
    testFilter.setCriteria(new AdvancedCriteria(OperatorId.AND, new AdvancedCriteria[] {  
    		new AdvancedCriteria("test1", OperatorId.EQUALS, "1.3")  
    }));
    IButton testButton = new IButton("test");
    testButton.addClickHandler(new ClickHandler() {
    	public void onClick(ClickEvent event) {
    		//JSONEncoder settings = new JSONEncoder();
            //settings.setDateFormat(JSONDateFormat.DATE_CONSTRUCTOR);
    		//GWT.log("B: " + JSON.encode(testFilter.getCriteria().getJsObj(), settings));
    		GWT.log("B: " + JSON.encode(testFilter.getCriteria().getJsObj()));
    	}
    });
    
    VLayout everything = new VLayout();
    everything.addMember(testFilter);
    everything.addMember(testButton);
    everything.draw();
    
    GWT.log("A: " + JSON.encode(testFilter.getCriteria().getJsObj()));
    "A" prints fine. When I click the button, "B" does not print and I get an exception:
    Code:
    00:03:24.693 [ERROR] 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.SimpleEventBus.doFire(SimpleEventBus.java:214)
    at com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:103)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:101)
    at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:66)
    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:157)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:129)
    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:214)
    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: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:680) Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError): this.getDataSource() is undefined  fileName: http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_DataBinding.js  lineNumber: 2916  stack: isc_FilterClause_getCriterion()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_DataBinding.js:2916 isc_FilterBuilder_getCriteria()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_DataBinding.js:2977 ()
    @http://127.0.0.1:8888:29 
    @:0 ([object GWTJavaObject],1048775,[object GWTJavaObject])
    @http://127.0.0.1:8888/smartgwttest2/hosted.html?smartgwttest2:56 ([object Object],(void 0))
    @http://127.0.0.1:8888:171 ((function () {var param = {};var event = __gwt_makeJavaInvoke(1)(null, 1376375, param);__gwt_makeJavaInvoke(1)(selfJ, 1048775, event);var ret = __gwt_makeJavaInvoke(0)(event, 1245190);return !ret;}),[object Object],[object Object])
    @http://127.0.0.1:8888:66 
    @:0 (null,106,(function () {var param = {};var event = __gwt_makeJavaInvoke(1)(null, 1376375, param);__gwt_makeJavaInvoke(1)(selfJ, 1048775, event);var ret = __gwt_makeJavaInvoke(0)(event, 1245190);return !ret;}),[object Object],[object Object])
    @http://127.0.0.1:8888/smartgwttest2/hosted.html?smartgwttest2:56 ([object Object],(void 0))
    @http://127.0.0.1:8888:10 ([object Object],(void 0))
    @http://127.0.0.1:8888:13 isc_StatefulCanvas_handleActivate([object Object],(void 0))
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Foundation.js:296 isc_StatefulCanvas_handleClick([object Object],(void 0))
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Foundation.js:298 isc_c_EventHandler_bubbleEvent([object Object],"click")
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:1497 isc_c_EventHandler_handleClick([object Object])
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:1345 isc_c_EventHandler__handleMouseUp([object MouseEvent],(void 0))
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:1332 isc_c_EventHandler_handleMouseUp([object MouseEvent])
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:1323 isc_c_EventHandler_dispatch(isc_c_EventHandler_handleMouseUp,[object MouseEvent])
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:1560 anonymous([object MouseEvent])
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:38 
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:129)
    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.smartgwt.client.widgets.form.FilterBuilder.getCriteria(FilterBuilder.java)
    at com.ir.smartgwttest2.client.GridBigFilterSample$2.onClick(GridBigFilterSample.java:48)
    at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:98)
    at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1)
    at com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:204)
    at com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:103)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:101)
    at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:66)
    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:157)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:129)
    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:214)
    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: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:680)
    I can save if there aren't any clauses in the filter (i.e. it is empty or there is one clause partially filled in). I tried adding a DataSource with setDataSource as well, but I couldn't get any operators to appear (I tried setting operators for each field type).

    I encounter this on Firefox 3.6.15 with SmartGWT 2.4 timestamped from January something, which is probably when I downloaded it. I also tried the nightly snapshot (through maven) but I got a stack trace when loading the module:

    Code:
    00:00:28.318 [ERROR] Unable to load module entry point class com.ir.smartgwttest2.client.GridBigFilterSample (see associated exception for details)
    com.google.gwt.core.client.JavaScriptException: (TypeError): isc.Canvas.$816 is undefined  fileName: http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Forms.js  lineNumber: 740  stack: isc_c_DynamicForm__getTopRowCellStart()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Forms.js:740 isc_DynamicForm_getInnerHTML((void 0))
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Forms.js:461 isc_Canvas__getInnerHTML()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:1932 isc_Canvas__updateParentHTML()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:2055 isc_Canvas_draw((void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0),(void 0))
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:1957 isc_c_Class_invokeSuper([object Object],"draw",(void 0),(void 0),(void 0),(void 0))
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:279 isc_DynamicForm_draw()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Forms.js:410 isc_Layout_layoutChildren("initial draw")
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Foundation.js:436 isc_Layout_drawChildren()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Foundation.js:338 isc_Canvas_draw()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:1957 isc_c_Class_invokeSuper(null,"draw")
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:279 isc_c_Class_Super("draw",[object Object])
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:271 isc_FilterBuilder_draw()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_DataBinding.js:2972 isc_Layout_layoutChildren("initial draw")
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Foundation.js:436 isc_Layout_drawChildren()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Foundation.js:338 isc_Canvas_draw()
    @http://127.0.0.1:8888/smartgwttest2/sc/modules/ISC_Core.js:1957 ()
    @http://127.0.0.1:8888:32 connect("http://127.0.0.1:8888/smartgwttest2.html?gwt.codesvr=127.0.0.1:9997","0it8vTZSmj&q2Qfd","127.0.0.1:9997","smartgwttest2","2.1")
    @:0 ((void 0),"smartgwttest2","http://127.0.0.1:8888/smartgwttest2/",0)
    @http://127.0.0.1:8888/smartgwttest2/hosted.html?smartgwttest2:281 B()
    @http://127.0.0.1:8888/smartgwttest2/smartgwttest2.nocache.js:2 (21)
    @http://127.0.0.1:8888/smartgwttest2/smartgwttest2.nocache.js:15  
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237) 
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:129) 
    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.BaseWidget.draw(BaseWidget.java) 
    at com.ir.smartgwttest2.client.GridBigFilterSample.onModuleLoad(GridBigFilterSample.java:54) 
    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.ModuleSpace.onLoad(ModuleSpace.java:396) 
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183) 
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510) 
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352) 
    at java.lang.Thread.run(Thread.java:680)
    I couldn't find any examples of fieldDataSource + serialization, so I'm not confident I got the configuration correct. Is there anything obvious I'm doing wrong? I'm pretty stumped at the moment.

    Thanks!

    #2
    Please let us know if you're encountering this with the latest nightly (from smartclient.com/builds, not Maven).

    Comment


      #3
      Yeah, both 2.4 from maven this morning and (2.5?) from the builds directory works as well. Thanks!

      Comment


        #4
        For the record, I have no idea where the updated 2.4 one came from. It's not in my local repo and I don't see it online. But anyway, the latest nightly works.

        Comment

        Working...
        X