Announcement

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

    filterBuilderItem in split form tab warns of an Attempt to draw child of an undrawn parent

    using: SmartClient Version: SNAPSHOT_v12.1d_2020-02-21/PowerEdition Deployment (built 2020-02-21)

    I've created a FilterBuilderItem (similar to the nested editor showcase). I embed it in a split form(similar to your split form showcase) and am seeing warnings like WARN:drawing:isc_FilterBuilder_0:Attempt to draw child of an undrawn parent when I go ahead and select a tab containing a DynamicForm with a FilterBuilderItem. When the item is in the tab that is initially selected, or not in a tab, the warnings do not appear. When in a tab that is not initially selected, I see at least two warnings per instance. Bellow is an example of a SimplifiedFilterBuilderItem and code to embed in the split form showcase that shows what I am seeing. You'll need to use relevant data source and criteria though. What do I need to do to get this to execute with out warnings... or are they bugs/errors potentially causing other issues I'll get to next....?

    Split form showcase addition example:
    Code:
     
          AdvancedCriteria simpleCriteria = new AdvancedCriteria(OperatorId.AND, new Criterion[] {
                    new Criterion("PK_Test_Session_Stream", OperatorId.IN_SET, new String[] {"20058", "200059"})
            });
            JSONEncoder encoder = new JSONEncoder();
            encoder.setDateFormat(JSONDateFormat.DATE_CONSTRUCTOR);
            String simpleCriteriaStr = encoder.encode(simpleCriteria);
    
            final DynamicForm simpleFbForm = new DynamicForm();  
    
    
                simpleFbForm.setValuesManager(vm);  
    
                final SimpleFilterBuilderItem simpleFbItem = new SimpleFilterBuilderItem("simpleCriteria", "Simple Filter Builder");
                simpleFbItem.setFilterBuilderDataSource(DataSource.get("TestCoverageFilterView"));
    
                simpleFbForm.setFields(simpleFbItem);
    
                if (com.google.gwt.user.client.Window.Location.getParameter("showInTab") != null ) {
                    Tab simpleFbTab =  new Tab();  
                    simpleFbTab.setTitle("SimpleFilterBuilderItem");  
                    simpleFbTab.setPane(simpleFbForm);  
                    theTabs.setTabs(item, stock, simpleFbTab);  
                    if (com.google.gwt.user.client.Window.Location.getParameter("selectTab") != null ) {
                        theTabs.selectTab(2);  
                    }
                }else {
                    theTabs.setTabs(item, stock);  
                    vLayout.addMember(simpleFbForm);
                }
                vm.setValues(new HashMap<String,Object>() {{  
                    put("price", "low");  
                    put("nextShipment", "256");  
                    put("simpleCriteria", simpleCriteriaStr);
                }});



    SimpleFilterBuilderItem.java:
    Code:
    public class SimpleFilterBuilderItem extends CanvasItem {
    
        boolean supressFilterChangedEvent = false;
    
        public SimpleFilterBuilderItem() {
            construct();
        }
    
        public SimpleFilterBuilderItem(JavaScriptObject jsObj) {
            super(jsObj);
            construct();
        }
    
        public SimpleFilterBuilderItem(String name) {
            super(name);
            construct();
        }
    
        public SimpleFilterBuilderItem(String name, String title) {
            super(name, title);
            construct();
        }
    
        private void construct() {
            setWidth("*");  
            setHeight("*");  
            setColSpan("*");  
            setEndRow(true);  
            setStartRow(true);  
    
            // this is going to be an editable data item  
            setShouldSaveValue(true);  
    
            setInitHandler(new FormItemInitHandler() {  
                @Override  
                public void onInit(FormItem item) {  
    
                    final FilterBuilder filterBuilder = new FilterBuilder();  
                    filterBuilder.setDataSource(getFilterBuilderDataSource());  
    
                    // The form item's data is set as a JSON encoded criteria string
                    String value = (String)item.getValue();
                    if (value != null) {
                        filterBuilder.setCriteria(AdvancedCriteria.fromJSObject(JSONEncoder.decode(value)));
                    }
    
                    filterBuilder.addFilterChangedHandler(new FilterChangedHandler() {
    
                        @Override
                        public void onFilterChanged(FilterChangedEvent event) {
                            if (filterBuilder.isDrawn() && !supressFilterChangedEvent ) {  // filters out non-user initiated thrashing
    
                                FilterBuilder fb = (FilterBuilder) event.getSource();
                                SimpleFilterBuilderItem canvasItem = (SimpleFilterBuilderItem) fb.getCanvasItem();
                                AdvancedCriteria newCriteria = fb.getCriteria();
    
                                JSONEncoder encoder = new JSONEncoder();
                                encoder.setDateFormat(JSONDateFormat.DATE_CONSTRUCTOR);
                                String criteriaStr = encoder.encode(newCriteria);
                                canvasItem.storeValue(criteriaStr);
                            }
                        }
                    });
    
                    setCanvas(filterBuilder);  
    
                    addShowValueHandler(new ShowValueHandler() {  
                        @Override  
                        public void onShowValue(ShowValueEvent event) {  
                            FilterBuilder fb = (FilterBuilder)((CanvasItem)event.getSource()).getCanvas();  
                            String value = (String)event.getDataValue();  
    
                            if (value != null && fb != null) {
                                supressFilterChangedEvent = true;
                                fb.setCriteria(AdvancedCriteria.fromJSObject(JSONEncoder.decode(value)));
                                supressFilterChangedEvent = false;
                            }
    
                        }  
                    });  
                }  
            });  
        }   
    
        private DataSource filterBuilderDataSource;  
        public DataSource getFilterBuilderDataSource() {  
            return this.filterBuilderDataSource;  
        }  
    
        public void setFilterBuilderDataSource(DataSource filterBuilderDataSource) {  
            this.filterBuilderDataSource = filterBuilderDataSource;  
        }   
    
    
    }


    Warnings:
    15:18:43.416:MUP9:WARN:drawing:isc_FilterBuilder_0:Attempt to draw child of an undrawn parent - ignoring
    cons.readyToDraw() on [FilterBuilder ID:isc_FilterBuilder_0] @ ISC_Core.js:71147:27
    cons.draw(showing=>undef) on [FilterBuilder ID:isc_FilterBuilder_0] @ ISC_Core.js:71272:15
    cons.invokeSuper(clazz=>null, methodName=>"draw", a=>undef, b=>undef, c=>undef, d=>undef, e=>undef, f=>undef, g=>undef, h=>undef, i=>undef, j=>undef, lastArg=>undef) on [FilterBuilder ID:isc_FilterBuilder_0] @ ISC_Core.js:7158:44
    cons.Super(methodName=>"draw", args=>[object Arguments], nativeArguments=>undef) on [FilterBuilder ID:isc_FilterBuilder_0] @ ISC_Core.js:6976:21
    cons.draw() on [FilterBuilder ID:isc_FilterBuilder_0] @ ISC_DataBinding.js:100670:10
    cons.placeCanvas(delayed=>undef) on [CanvasItem ID:isc_SimpleFilterBuilderItem_1 name:simpleCriteria] @ ISC_Forms.js:44590:20
    cons._containerWidgetVisibilityChanged() on [CanvasItem ID:isc_SimpleFilterBuilderItem_1 name:simpleCriteria] @ ISC_Forms.js:44625:52
    cons.observation() on [DynamicForm ID:simpleFbForm] @ ISC_Core.js:8112:28
    cons.setVisibility(newVisibility=>"inherit") on [DynamicForm ID:simpleFbForm] @ ISC_Core.js:86039:10
    cons.invokeSuper(<no args: recursion>) on [DynamicForm ID:simpleFbForm] @ ISC_Core.js:7166:40
    cons.setVisibility(newVisibility=>"inherit", a=>undef, b=>undef, c=>undef) on [DynamicForm ID:simpleFbForm] @ ISC_Forms.js:15356:10
    cons.show() on [DynamicForm ID:simpleFbForm] @ ISC_Core.js:86360:10
    cons._showTab(tab=>Obj{ID:isc_Tab_2}) on [TabSet ID:isc_TabSet_0] @ ISC_Containers.js:15048:18
    cons._tabSelected(tab=>[SimpleTabButton ID:isc_Tab_5]) on [TabSet ID:isc_TabSet_0] @ ISC_Containers.js:15196:10
    cons.buttonSelected(button=>[SimpleTabButton ID:isc_Tab_5]) on [TabBar ID:isc_TabSet_0_tabBar] @ ISC_Containers.js:13348:36
    cons.setSelected() on [SimpleTabButton ID:isc_Tab_5] @ ISC_Foundation.js:15566:59
    cons.select() on [SimpleTabButton ID:isc_Tab_5] @ ISC_Foundation.js:3476:10
    cons.handleActivate(event=>Obj, eventInfo=>undef) on [SimpleTabButton ID:isc_Tab_5] @ ISC_Foundation.js:4661:14
    cons.handleClick(event=>Obj, eventInfo=>undef) on [SimpleTabButton ID:isc_Tab_5] @ ISC_Foundation.js:4701:17
    cons.invokeSuper(<no args: recursion>) on [SimpleTabButton ID:isc_Tab_5] @ ISC_Core.js:7158:44
    cons.Super(<no args: recursion>) on [SimpleTabButton ID:isc_Tab_5] @ ISC_Core.js:6976:21
    cons.handleClick() on [SimpleTabButton ID:isc_Tab_5] @ ISC_Containers.js:544:21
    cons.bubbleEvent(target=>[SimpleTabButton ID:isc_Tab_5], eventType=>"click", eventInfo=>undef, targetIsMasked=>undef, eventItem=>undef) on [Class EventHandler] @ ISC_Core.js:54822:44
    cons.handleClick(target=>[SimpleTabButton ID:isc_Tab_5], eventType=>undef) on [Class EventHandler] @ ISC_Core.js:52145:24
    cons._handleMouseUp(DOMevent=>[object MouseEvent], fakeEvent=>undef) on [Class EventHandler] @ ISC_Core.js:51832:54
    cons.handleMouseUp(DOMevent=>[object MouseEvent], fakeEvent=>undef) on [Class EventHandler] @ ISC_Core.js:51673:26
    cons.dispatch(handler=>[c]EventHandler.handleMouseUp(), event=>[object MouseEvent]) on [Class EventHandler] @ ISC_Core.js:56535:30
    HTMLDocument.eval(event=>[object MouseEvent]) @ [no file]:1:127

    15:18:43.422:MUP9[E0]:WARN:drawing:isc_FilterBuilder_0:Attempt to draw child of an undrawn parent - ignoring
    cons.readyToDraw() on [FilterBuilder ID:isc_FilterBuilder_0] @ ISC_Core.js:71147:27
    cons.draw(showing=>undef) on [FilterBuilder ID:isc_FilterBuilder_0] @ ISC_Core.js:71272:15
    cons.invokeSuper(clazz=>null, methodName=>"draw", a=>undef, b=>undef, c=>undef, d=>undef, e=>undef, f=>undef, g=>undef, h=>undef, i=>undef, j=>undef, lastArg=>undef) on [FilterBuilder ID:isc_FilterBuilder_0] @ ISC_Core.js:7158:44
    cons.Super(methodName=>"draw", args=>[object Arguments], nativeArguments=>undef) on [FilterBuilder ID:isc_FilterBuilder_0] @ ISC_Core.js:6976:21
    cons.draw() on [FilterBuilder ID:isc_FilterBuilder_0] @ ISC_DataBinding.js:100670:10
    cons.placeCanvas(delayed=>undef) on [CanvasItem ID:isc_SimpleFilterBuilderItem_1 name:simpleCriteria] @ ISC_Forms.js:44590:20
    cons.moved() on [CanvasItem ID:isc_SimpleFilterBuilderItem_1 name:simpleCriteria] @ ISC_Forms.js:44656:18
    cons.itemsMoved(items=>undef) on [DynamicForm ID:simpleFbForm] @ ISC_Forms.js:9369:42
    cons.handleMoved(a=>0, b=>-9999, c=>undef, d=>undef) on [DynamicForm ID:simpleFbForm] @ ISC_Forms.js:9341:10
    cons._completeMoveBy() on [DynamicForm ID:simpleFbForm] @ ISC_Core.js:80587:10
    cons.moveBy(deltaX=>null, deltaY=>-9999, animating=>undef, resizeHandle=>undef) on [DynamicForm ID:simpleFbForm] @ ISC_Core.js:80544:10
    cons.moveTo(left=>null, top=>-9999, animating=>undef, resizeHandle=>undef) on [DynamicForm ID:simpleFbForm] @ ISC_Core.js:81125:17
    moveOffscreen(member=>[DynamicForm ID:simpleFbForm]) on [Class Canvas] @ ISC_Core.js:96646:31
    cons._moveOffscreen(member=>[DynamicForm ID:simpleFbForm]) on [PaneContainer ID:isc_TabSet_0_paneContainer] @ ISC_Foundation.js:6583:23
    cons.layoutChildren(reason=>"member changed visibility: [DynamicForm ..."[49], deltaX=>undef, deltaY=>undef) on [PaneContainer ID:isc_TabSet_0_paneContainer] @ ISC_Foundation.js:7588:18
    cons.reflowNow(reason=>"member changed visibility: [DynamicForm ..."[49], reflowCount=>2) on [PaneContainer ID:isc_TabSet_0_paneContainer] @ ISC_Foundation.js:8120:10
    clearReflowQueue() on [Class Layout] @ ISC_Foundation.js:5254:27
    <anonymous>() @ ISC_Foundation.js:5225:28
    cons.runTeas() on [Class EventHandler] @ ISC_Core.js:56478:18
    cons._clearThread() on [Class EventHandler] @ ISC_Core.js:56441:18
    cons.dispatch(handler=>[c]EventHandler.handleMouseUp(), event=>[object MouseEvent]) on [Class EventHandler] @ ISC_Core.js:56544:10
    HTMLDocument.eval(event=>[object MouseEvent]) @ [no file]:1:127

    #2
    We were not able to reproduce the warnings, and since your code is incomplete, we had to adjust it as follows:

    Code:
           AdvancedCriteria simpleCriteria = new AdvancedCriteria(OperatorId.AND, new Criterion[] {
                    new Criterion("SKU", OperatorId.IN_SET, new String[] {"996600"})
            });
            JSONEncoder encoder = new JSONEncoder();
            encoder.setDateFormat(JSONDateFormat.DATE_CONSTRUCTOR);
            String simpleCriteriaStr = encoder.encode(simpleCriteria);
    
            final DynamicForm simpleFbForm = new DynamicForm();  
    
            ValuesManager vm = new ValuesManager();
            simpleFbForm.setValuesManager(vm);  
    
            final SimpleFilterBuilderItem simpleFbItem = new SimpleFilterBuilderItem("simpleCriteria", "Simple Filter Builder");
            simpleFbItem.setFilterBuilderDataSource(DataSource.get("supplyItem"));
    
            simpleFbForm.setFields(simpleFbItem);
    
            TabSet theTabs = new TabSet();
            Tab item = new Tab();
            Tab stock = new Tab();
    
            VLayout vLayout = new VLayout();
            vLayout.setMembersMargin(10);
            vLayout.setWidth(700);
            vLayout.setHeight(500);
    
            if (com.google.gwt.user.client.Window.Location.getParameter("showInTab") == null ) {
                    Tab simpleFbTab =  new Tab();  
                    simpleFbTab.setTitle("SimpleFilterBuilderItem");  
                    simpleFbTab.setPane(simpleFbForm);  
                    theTabs.setTabs(item, stock, simpleFbTab);  
                    if (com.google.gwt.user.client.Window.Location.getParameter("selectTab") != null ) {
                        theTabs.selectTab(2);  
                    }
                    vLayout.addMember(theTabs);
            }else {
                    theTabs.setTabs(item, stock);  
                    vLayout.addMember(simpleFbForm);
            }
            vm.setValues(new HashMap<String,Object>() {{  
                    put("units", "Ea");  
                    put("unitCost", "1.83");  
                    put("simpleCriteria", simpleCriteriaStr);
            }});
    
            vLayout.draw();
    Please, try running this code in the latest patches build and see if you reproduce the warnings.

    Regards
    Isomorphic Software

    Comment

    Working...
    X