flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From piotrz <piotrzarzyck...@gmail.com>
Subject [FlexJS, MDL] Null Pointer Exception in HorizontalFlexLayout
Date Mon, 01 May 2017 12:35:25 GMT
Hi Peter,

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

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

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


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();

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

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

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



Apache Flex PMC
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.

View raw message