I'm using SmartGWT 3.1-p20130522.
I set up a FileItem like this:
In the UI I browse to a file and select the file.
Based on a menu pick I execute this code:
The execution of this code causes an error message to pop up:
Here is the output of the development console:
Here is the stack trace that appears on the console:
After clicking any button then I can retrieve the value from the FileItem. Does this mean that the value can only be retrieved after clicking a button in form? If so is it possible to programmatically "click" a button so I can have the menu pick simulate the clicking of a button?
I set up a FileItem like this:
Code:
FileItem upload = new FileItem("UploadedFile"); upload.setShowTitle(false); upload.setEndRow(false); upload.setWidth(280); final String FILE_NAME_VALIDATION = ".*\\.xlsx"; RegExpValidator regExpValidator = new RegExpValidator(); regExpValidator.setExpression(FILE_NAME_VALIDATION); regExpValidator .setErrorMessage("must be a Microsoft Excel file ending with .xlsx"); upload.setValidators(regExpValidator); upload.setValidateOnChange(true);
Based on a menu pick I execute this code:
Code:
Object value = upload.getValue();
Code:
Uncaught exception escaped : com.google.gwt.event.shared.UmbrellaException Exception caught: (TypeError) @com.smartgwt.client.widgets.form.fields.FormItem::_getValue()([]): this.canvas is null See the Development console log for details. Register a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling.
Code:
00:52:43.385:INFO:Log:initialized 00:52:43.800:WARN:Log:New Class ID: 'DataView' collides with ID of existing object with value 'function DataView() { [native code] }'. Existing object will be replaced. This conflict would be avoided by disabling ISC Simple Names mode. See documentation for further information. 00:52:43.850:WARN:Log:New Class ID: 'IAutoFitButton' collides with ID of existing Class object '[Class IAutoFitButton]'. Existing object will be replaced. 00:52:43.850:WARN:Log:New Class ID: 'HeaderMenuButton' collides with ID of existing Class object '[Class HeaderMenuButton]'. Existing object will be replaced. 00:52:51.493:INFO:Log:MVP1: ClientEntry: onModuleLoad entry 00:52:51.675:INFO:Log:MVP1: viewer.shared.forms.Forms$2: Hello friends: taxonomies 00:52:52.067:INFO:Log:MVP1: viewer.tabset.account.ContactListsLayout: ContactListsLayout constructor 00:52:52.177:INFO:Log:MVP1: viewer.tabset.account.ContactListsLayout: setting up handler for upload button 00:52:53.168:INFO:Log:isc.Page is loaded 00:53:17.133:IFCS9:INFO:Log:MVP1: viewer.tabset.account.AccountActionManager$1: event=An event type 00:53:17.135:IFCS9:INFO:Log:MVP1: viewer.tabset.account.AccountActionManager$1: event.getValue()=UPLOAD_CONTACT_LIST 00:53:17.174:IFCS9:INFO:Log:MVP1: viewer.tabset.account.AccountMenuItems$2: have set up the data source 00:53:17.174:IFCS9:INFO:Log:MVP1: viewer.tabset.account.AccountMenuItems$2: upload menu item picked 00:53:17.175:IFCS9:INFO:Log:MVP1: viewer.tabset.account.AccountMenuItems$2: item=com.smartgwt.client.widgets.form.fields.FileItem@643133df 00:53:43.481:IBLR4:WARN:DynamicForm:isc_DynamicForm_2:Attempt to remove child: [IButton ID:isc_ButtonItem_12_button] from Canvas that is not its parent
Code:
00:53:43.535 [ERROR] [MVP1] Uncaught exception escaped com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) @com.smartgwt.client.widgets.form.fields.FormItem::_getValue()([]): this.canvas is null at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129) at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:228) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) 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:338) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) 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:242) at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) 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:293) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Thread.java:722) Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.widgets.form.fields.FormItem::_getValue()([]): this.canvas is null at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.smartgwt.client.widgets.form.fields.FormItem._getValue(FormItem.java) at com.smartgwt.client.widgets.form.fields.FormItem.getValue(FormItem.java:5122) at com.cedarcone.MVP1.client.viewer.tabset.account.AccountMenuItems$2.doAction(AccountMenuItems.java:108) at com.cedarcone.MVP1.client.viewer.tabset.account.AccountActionManager$1.onChange(AccountActionManager.java:65) at com.smartgwt.client.widgets.form.fields.events.ChangeEvent.dispatch(ChangeEvent.java:101) at com.smartgwt.client.widgets.form.fields.events.ChangeEvent.dispatch(ChangeEvent.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:228) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) 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:338) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) 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:242) at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) 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:293) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Thread.java:722)
Comment