Thursday, September 8, 2016

Workaround for ADF Match Media Behavior Tag

If you run ADF application with adaptive UI implemented by af:matchMediaBehavior tag (ADF 12.2.1 Responsive UI Improvements), most likely you will face Null Pointer Exception in Match Media Behavior tag class. Apparently af:matchMediaBehavior tag expects default value to be set on UI component. If default value is not set explicitly, it fails to read it and generates exception (this was not the case in ADF 12.2.1).

This example contains three af:matchMediaBehavior tags, properties orientation and styleClass are not set on panel spitter by default:

This leads into Null Pointer exception on runtime:

To fix this, we can set default values for orientation and styleClass explicitly. Propety styleClass can be assigned with empty value, this helps:

UI is loaded this time:

UI is resized on narrow screen - panel splitter orientation is changed:

Download application with workaround for af:matchMediaBehavior -


Shemeer At said...

It is not working in Design mode even after this.
I solved the problem by adding BC4J Service Tester Library to ViewController classpath.
After that it is working fine in Design Mode.

Andrejus Baranovskis said...

I doubt if this is related at all.