Announcement

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

    Problems dynamically recreating a Tree (Not using a SmartGWT datasource)

    Hello Guys,

    I am writing some code that dynamically modifies a tree. How it works is:
    1. User Clicks on a combo box and enters a regular expression
    2. On keypress (enter) the data is sent back to the server to set it in session
    3. A tree holding some data is refreshed (so that the server sends back the relavant filtered data) [This step cannot be done on the client for a variety of reasons]

    The setting of the filter, and the server side code works perfectly. Cause if i pass the filter via a url before the page is loaded, it shows properly filtered data.

    However when i try to change it via the combo box, it fails.

    And i get a wierd error on the combo box instead of the tree.

    Some Code samples:
    The code to set the filter and reload the tree
    Code:
    final ComboBoxItem filterInput = new ComboBoxItem("Filter");
    filterInput.setType("comboBox");
    filterInput.setWidth(200);
    filterInput.setShowTitle(true);
    filterInput.setDefaultValue(filterPattern);
    
    filterInput.setValueMap("Test"," test 2", "test 4" , "test 5");
    filterInput.addKeyPressHandler(new KeyPressHandler() {
    			
    	@Override
    	public void onKeyPress(KeyPressEvent event) {
    		if(!"Enter".equalsIgnoreCase(event.getKeyName())){
    			return;
    		}
    		
    		System.out.println("On key press handler called.");
    		String currFilterVal = filterInput.getValueAsString();
    		FilterServiceAsync service = GWT.create(FilterService.class);
    		service.setActiveFilter(new FilterDTO("Ad Hoc", currFilterVal), new AsyncCallback<Void>() {
    					
    			@Override
    			public void onSuccess(Void result) {
    				drillDownContainer.refreshData(); // This is a custom container inheriting from VLayout, mostly irrelevant to this problem
    				drillDownTree.recreateTree(); // This is a function i wrote to remove all the children of the tree and reload it from the server.
    			}
    					
    			@Override
    			public void onFailure(Throwable caught) {
    						com.google.gwt.user.client.Window.alert("Filter setting failed: " + caught);
    					}
    			});
    				
    		}
    });
    The Tree refreshing code: I am not exactly sure what all to provide from here, since its a lot of code. I am hoping for some pointers from the general picture that i painted, and can provide proper code samples to take it further. (I am still trying to recreate a standalone setup that can also reproduce the problem.)

    1. Smart GWT 2.3, on chrome in hosted mode (Havent tried it in compiled mode)
    2. Developer Console Trace:
    Posting in a separate post below (Cause its huge)

    3. Full Stack Trace from the eclipse console:
    18:42:50.532 [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] 18:42:50.512:MDN2:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
    com.smartgwt.client.core.JsObject$SGWT_WARN: 18:42:50.512:MDN2:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
    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:662)


    Thanks and Regards,
    Basil Dsouza

    #2
    We haven't had a similar report, but the first thing to try would be moving to the latest GA version (2.4) if not to a nightly (smartclient.com/builds) since we're closing in on 2.5.

    Comment


      #3
      19:15:36.206:MDN5:INFO:EventHandler:Target Canvas for event 'mousedown': [TreeGridBody ID:isc_DrillDownTreeGrid_0_body]
      19:15:36.208:MDN5:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
      19:15:36.270:MUP9:INFO:EventHandler:Target Canvas for event 'mouseup': [TreeGridBody ID:isc_DrillDownTreeGrid_0_body]
      19:15:36.379:MDN0:INFO:EventHandler:Target Canvas for event 'mousedown': [TreeGridBody ID:isc_DrillDownTreeGrid_0_body]
      19:15:36.379:MDN0:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
      19:15:36.462:MUP7:INFO:EventHandler:Target Canvas for event 'mouseup': [TreeGridBody ID:isc_DrillDownTreeGrid_0_body]

      Comment


        #4
        Originally posted by Isomorphic
        We haven't had a similar report, but the first thing to try would be moving to the latest GA version (2.4) if not to a nightly (smartclient.com/builds) since we're closing in on 2.5.
        Whoa, that was a fast reply! By the time i managed to get the dev console logs your reply was there!

        Anyways, have tried moving to 2.5 as well (Was a simple move, just switch the jars, and none of our code needed changing.) And the problem still persists.

        Comment


          #5
          I narrowed the problem down. Initially i was suspecting that the tree might have something to do with the problem (Even though the error was shown on the combo box). So i removed the combo box and put in a button there, where on click it sets the filter to some value, and it works perfectly.

          Which means that the problem really was with the combo box. Will try debugging it further and will update you if i get anywhere.

          Comment


            #6
            I noticed that whenever i display a text box / combo box, or any form of input the problem is caused. I need not access it, or do anything with it. It still causes a problem.

            I then try to remove the form, and use a SC.askForValue, however even that fails. The moment it pops up i get 4 size related errors showing up on google console in eclipse, and after that the window just wont close even after clicking ok, cancel or the x on top. So i assume that whenever i add a dynamic form to the ui it fails. Doesnt matter where...

            Version: Smart GWT 2.5
            New Code:
            Code:
            		ImgButton filterButton = new ImgButton();  
            		filterButton.setSrc("[SKIN]actions/filter.png");  
            		filterButton.setSize(16);  
            		filterButton.setShowFocused(false);  
            		filterButton.setShowRollOver(false);  
            		filterButton.setShowDown(false);  
            		filterButton.addClickHandler(new ClickHandler() {  
            			public void onClick(ClickEvent event) {
            				Dialog d = new Dialog();
            				d.setWidth("20%");
            				d.setHeight("20%");
            				
            				SC.askforValue("Filter Pattern", 
            							   "Please Enter a Filter Pattern:" +
            							   "<br/> (Empty pattern to clear)<br/>", 
            							   filterPattern,
            						   new ValueCallback() {
            					
            					@Override
            					public void execute(String value) {
            						if(value == null){
            							return;
            						}
            						filterPattern = value;
            						if(value.isEmpty()){
            							filterPattern = FilterDTO.DEFAULT_EXPRESSION; 
            						}
            						setFilter(filterPattern);
            					}
            				}, d);
            			}  
            		});
            New Error:
            Code:
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:46.997:MUP3:WARN:Canvas:item at: 0,0 has height: null, item is: [BlurbItem ID:isc_BlurbItem_0 name:message]
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:47.000:MUP3:WARN:Canvas:item at: 1,0 has height: 26, item is: [TextItem ID:isc_TextItem_0 name:value]
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:47.002:MUP3:WARN:Canvas:item: [TextItem ID:isc_TextItem_0 name:value] has pixel size: 26
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:47.555:WARN:Canvas:item at: 0,0 has height: null, item is: [BlurbItem ID:isc_BlurbItem_0 name:message]
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:47.557:WARN:Canvas:item at: 1,0 has height: 26, item is: [TextItem ID:isc_TextItem_0 name:value]
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:47.559:WARN:Canvas:item: [TextItem ID:isc_TextItem_0 name:value] has pixel size: 26
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:54.417:MDN9:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
                unnamed() @ 
                [c]EventHandler.doHandleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
                [c]EventHandler.handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
                [c]EventHandler.dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
                unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)
            
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:56.101:MDN8:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
                unnamed() @ 
                [c]EventHandler.doHandleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
                [c]EventHandler.handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
                [c]EventHandler.dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
                unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)
            
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:57.956:MDN1:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
                unnamed() @ 
                [c]EventHandler.doHandleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
                [c]EventHandler.handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
                [c]EventHandler.dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
                unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)
            
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:58.560:MDN6:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
                unnamed() @ 
                [c]EventHandler.doHandleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
                [c]EventHandler.handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
                [c]EventHandler.dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
                unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)
            
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:21:59.769:MDN9:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
                unnamed() @ 
                [c]EventHandler.doHandleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
                [c]EventHandler.handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
                [c]EventHandler.dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
                unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)
            
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:22:00.447:MDN0:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
                unnamed() @ 
                [c]EventHandler.doHandleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
                [c]EventHandler.handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
                [c]EventHandler.dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
                unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)
            
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:22:03.948:MDN9:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
                unnamed() @ 
                [c]EventHandler.doHandleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
                [c]EventHandler.handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
                [c]EventHandler.dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
                unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)
            
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:22:04.615:MDN9:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
                unnamed() @ 
                [c]EventHandler.doHandleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
                [c]EventHandler.handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
                [c]EventHandler.dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
                unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)
            
            [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 11:22:22.922:MDN1:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
                unnamed() @ 
                [c]EventHandler.doHandleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
                [c]EventHandler.handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
                [c]EventHandler.dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
                unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)

            Dev Console Output:
            Code:
            11:27:12.875:IFCS3:DEBUG:nativeFocus:onfocus fired on: [TextItem ID:isc_TextItem_0 name:value]
            11:27:12.877:IFCS3:DEBUG:FormItemStyling:isc_TextItem_0:About to apply basic cell style:formCellFocused
            11:27:12.879:IFCS3:DEBUG:FormItemStyling:isc_TextItem_0:About to apply text box style:textItemFocused
            11:27:12.887:MDN4:INFO:EventHandler:Target Canvas for event 'mousedown': [IButton ID:isc_IButton_1]
            11:27:12.931:MDN4:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
                unnamed() @ 
                doHandleMouseDownObservation() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
                anonymous() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)
                isc_c_EventHandler_handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
                [c]EventHandler.dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
                unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1:0)
            
            11:27:12.947:IBLR5:DEBUG:nativeFocus:onblur fired on: [TextItem ID:isc_TextItem_0 name:value]
            11:27:12.949:IBLR5:DEBUG:FormItemStyling:isc_TextItem_0:About to apply basic cell style:formCell
            11:27:12.951:IBLR5:DEBUG:FormItemStyling:isc_TextItem_0:About to apply text box style:textItem
            11:27:12.955:MUP7:INFO:EventHandler:Target Canvas for event 'mouseup': [IButton ID:isc_IButton_1]

            Comment


              #7
              Okay, i seem to have reproduced this in a minimum piece of code. And this might just be a bug with SmartGWT.

              Environment:
              Browser: Chrome - Hosted Mode
              GWT Version - 2.1.1
              Smart GWT Version - 2.2 and 2.5 tried

              Steps to reproduce problem:
              1. Open Page (Code provided below)
              2. Try to select a node on the tree - It will work
              3. Try to expand the node - It will work
              4. Click inside the filter text box - Dont do anything else, just click inside it
              5. Try to select a node in the tree / Or try to Expand the node
              6. Either operation will not work and will throw an error and the tree stops functioning.

              - It will throw a warning:
              [ERROR] [com.jpmorgan.monitron.MonitronGUIPOC] - 12:53:11.236:MDN3:WARN:Log:TypeError: Object [DynamicForm ID:isc_DynamicForm_0] has no method 'getFocusSubItem'
              unnamed() @
              doHandleMouseDownObservation() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1292:316
              anonymous() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:38:72)
              isc_c_EventHandler_handleMouseDown() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1291:146
              isc_c_EventHandler_dispatch() @ com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:1577:155
              unnamed() @ eval at <anonymous> (http://127.0.0.1:8888/com.jpmorgan.monitron.MonitronGUIPOC/sc/modules/ISC_Core.js:38:72)



              Could you please have a look at this?
              Code:
              	public void onModuleLoad() {}{
              		final Window appWindow = new Window();
              		appWindow.setTitle("Monitron");
                  
              		appWindow.setWidth100();
              		appWindow.setHeight100();
              		
              		HLayout testMainLayout = new HLayout();
              		Tree tree = new Tree();
              		TreeNode root = new TreeNode("Global");
              		tree.setRoot(new TreeNode("root", root));
              		
              		tree.add(new TreeNode("Test Child"), root);
              		
              		TreeGrid treeGrid = new TreeGrid();
              		treeGrid.setData(tree);
              		testMainLayout.addMember(treeGrid);
              
              		DynamicForm form = new DynamicForm();
              		form.setWidth(200);
              
              		final TextItem filterInput = new TextItem("Filter");
              		filterInput.setShowTitle(true);
              		
              		form.setFields(filterInput);
              
              		testMainLayout.addMember(form);
              		appWindow.addItem(testMainLayout);
              		
              		appWindow.show();
              
              	}

              Comment


                #8
                If it's only in Chrome hosted mode, this is a bug in the GWT plugin for Chrome that we are still waiting on Google to fix (this is in the FAQ).

                Comment


                  #9
                  Okay, you're right. This seems to be a chrome only hostedmode bug. I never thought of trying out another browser.

                  Thanks a lot for the pointers. I am running 2.1.1 of the GWT and Chrome 11.0.696.65. (Hoping this will turn up in some google search warning others who stumble across this bug.)

                  Comment

                  Working...
                  X