Hi Peter,

During creation of DropDownList component in MDL I have experienced Null
Pointer Exception in HorizontalFlexLayout. [1]

Issue:
My DropDownList contains 3 elements: Div with selected text, Material icon
(i) and Menu.

Case 1: If I create DropDownList in MXML - MDL library handle properly
upgrading. 

Menu is a simple ul, but once upgrade is done MDL library surround it by
additional div [2] "mdl-menu__container".

HorizontalFlexLayout is going through the children of View in function
"layout". Array contains 3 elements from my DropDownList - the last one is
menu - in moment of layout perform it contains "ul" not
"mdl-menu__container".

<http://apache-flex-development.2333347.n4.nabble.com/file/n61437/horizontalflex_layout.png>
 

This "ul" has been created by FlexJS and has element.flexjs_wrapper. and
function getElementAt returns child one by one.

Case 2 - ISSUE:

I would like to create DropDownList dynamically:

var dropDown:DropDownList = new DropDownList();
addElement(dropDown);

In order to do this Menu inside DropDownList need to be "upgraded" manually
- I need to tell MDL library that I've created Menu component - I have bead
for that purpose which doing his job: UpgradeElement.

Upgrade is completed successfully and MDL is surrounding "ul" by
"mdl-menu__container".

Now HorizontalFlexLayout is doing "layout" and trying to go through the
children. In array for some reason there is no "ul" MDL Menu, but this
"mdl-menu__container" which wasn't created by FlexJS. In that case it
doesn't have element.flexjs_wrapper, so getElementAt returns null. And we
are getting NPE.

It look like everything what HorizontalFlexLayout is doing in Case 1
happened before upgrading - in case 2 I'm doing upgrade during whole life
cycle performance.

I hope this long explanation help you understand issue and provide some
feedback. I'm attaching simple project where you can reproduce this issue
[3]

[1] https://paste.apache.org/9oRP
[2] https://paste.apache.org/iN4K
[3] https://1drv.ms/u/s!ApVpLyjpHDC2zTehS-kv_1g0cgSY

Piotr

 




-----
Apache Flex PMC
piotrzarzyck...@gmail.com
--
View this message in context: 
http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Null-Pointer-Exception-in-HorizontalFlexLayout-tp61437.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Reply via email to