Announcement

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

    Bug on instantiating ToolStripButton from componentXML

    Hi,

    There seems to be a problem with ToolStripButtons obtained from a componentXML.
    In production, nothing happens when the "New" button is clicked.
    In dev, the following exception is raised on screen load:

    Code:
    java.lang.ClassCastException: com.smartgwt.client.widgets.Canvas cannot be cast to com.smartgwt.client.widgets.toolbar.ToolStripButton
        at com.myCompany.LayoutLoader$2.execute(LayoutLoader.java:36)
        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.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.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)
    I tried adding the constructor="ToolStripButton" to the tag but to no avail.

    Code:
    <isomorphicXML xmlns:fmt="WEB-INF/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
    	<ToolStrip ID="ToolStrip0" autoDraw="false">
    		<members>
    			<ToolStripButton ID="ToolStripButton0" autoDraw="false" constructor="ToolStripButton">
    				<title>New</title>
    			</ToolStripButton>
    		</members>
    		<visibilityMode>multiple</visibilityMode>
    	</ToolStrip>
    
    	<DataView ID="DataView0" width="100%" height="100%" overflow="hidden"
    		autoDraw="true">
    		<members>
    			<Canvas ref="ToolStrip0" />
    		</members>
    		<modulesDir>modules/</modulesDir>
    	</DataView>
    </isomorphicXML>
    Code:
    @Override
    	public void onModuleLoad() {
    		
    		GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
    			
    			@Override
    			public void onUncaughtException(Throwable e) {
    				GWT.log("Uncaught exception",e);
    			}
    		});
    		
    		RPCManager.loadScreen("Layout", new LoadScreenCallback() {
    			
    			@Override
    			public void execute() {
    				final ToolStripButton toolStripButton = (ToolStripButton) Canvas.getById("ToolStripButton0");
    				toolStripButton.addClickHandler(new ClickHandler() {
    					@Override
    					public void onClick(ClickEvent event) {
    						SC.say("ToolStripButtonClicked");
    					}
    				});
    			}
    		},  new String[]{RPCManager.ALL_GLOBALS});
    	}
    SmartClient Version: v8.3p_2013-05-24/PowerEdition Deployment (built 2013-05-24)

    Thanks,
    fatzopilot

    #2
    This is fixed for tomorrow's 4.0 build, and most likely will be fixed for tomorrow's 3.1 build as well (or the day after).

    Comment


      #3
      There seems to be a regression with the latest nightlies. I now have the same issue with an IMenuButton that worked before.
      Yesterday's nightlies did not work as well.

      SmartClient Version: v8.3p_2013-06-05/PowerEdition Deployment (built 2013-06-05)

      Thanks,
      fatzopilot

      Comment


        #4
        The same is true for TabSet, did something change in the ScreenLoader API?

        Thanks,
        fatzopilot

        Comment


          #5
          Ok latest nightlies don't show this behavior, so it seems fixed.

          Comment

          Working...
          X