Update: This bug is fixed in upcoming JDev release.
If you develop advanced ADF declarative components, I'm sure sooner or later you would face requirement to implement custom reusable popup. Ideally we would like to invoke custom reusable popup directly from button declared in the fragment or page. This works well on runtime, but JDeveloper 11g R2 IDE generates internal NullPointerException at ScopeIdAnalyzer - I will show how to workaround it.
Sample application provides declarative ADF component with basic popup - CustomPopUp:
Once we drag and drop such component into fragment or page, we can reference ADF popup from inside of declarative component by expanding customPopUp and selecting popup ID. This ID can be mapped with showPopUpBehavior tag to display popup on button click:
This works on runtime, by on design time generates IDE error - once you press OK button to confirm popup ID:
In source mode we can see error description - seems like, JDeveloper is not able to resolve popup ID from declarative component dependency (even it is visible from the wizard):
It works on runtime, but is quite annoying to get NullPointer exception each time when working with page/fragment in IDE. Workaround: invoke popup from declarative component programmatically.
Create binding mapping for custom popup declarative component and action listener mapped with opening button:
From action listener, get instance of declarative component binding, get collection of children and retrieve oracle.adf.Popup family component - show popup:
Popup from declarative component is opened programmatically:
Download sample application (JDeveloper 11g R2) - DeclarativePopUpApp.zip.
If you develop advanced ADF declarative components, I'm sure sooner or later you would face requirement to implement custom reusable popup. Ideally we would like to invoke custom reusable popup directly from button declared in the fragment or page. This works well on runtime, but JDeveloper 11g R2 IDE generates internal NullPointerException at ScopeIdAnalyzer - I will show how to workaround it.
Sample application provides declarative ADF component with basic popup - CustomPopUp:
Once we drag and drop such component into fragment or page, we can reference ADF popup from inside of declarative component by expanding customPopUp and selecting popup ID. This ID can be mapped with showPopUpBehavior tag to display popup on button click:
This works on runtime, by on design time generates IDE error - once you press OK button to confirm popup ID:
In source mode we can see error description - seems like, JDeveloper is not able to resolve popup ID from declarative component dependency (even it is visible from the wizard):
It works on runtime, but is quite annoying to get NullPointer exception each time when working with page/fragment in IDE. Workaround: invoke popup from declarative component programmatically.
Create binding mapping for custom popup declarative component and action listener mapped with opening button:
From action listener, get instance of declarative component binding, get collection of children and retrieve oracle.adf.Popup family component - show popup:
Popup from declarative component is opened programmatically:
Download sample application (JDeveloper 11g R2) - DeclarativePopUpApp.zip.
Hi, Andrejus!
ReplyDeleteThank's for very useful informayion.
Can you have an example how to use reusable popup with on the button?
Regards, Stanislav
Yes - you can download sample app from this post. Or you are looking for something different?
ReplyDeleteAndrejus
Thank's for answer.
ReplyDeleteI mean about button with af:showPopupBehavior tag, that invokes reusable popup.
Regards, Stanislav
There is such button in the sample :)
ReplyDeleteBug is fixed in latest JDev release.
Andrejus
Andrejus, in your topic in attached sample(DeclarativePopUpApp.zip) there is a programmatical variant. Can you have a sample with af:showPopupBehavior tag?
ReplyDeleteI read your topic, created custom reusable popup, but when I drop it onto the page I don't see af:popup element. I use JDeveloper 11.1.2.2.0
Thank you for answer.
Regards, Stanislav
You should check second screenshot and text - "Once we drag and drop such component into fragment or page, we can reference ADF popup from inside of declarative component by expanding customPopUp and selecting popup ID. This ID can be mapped with showPopUpBehavior tag to display popup on button click"
ReplyDeleteYou should be able to expand declarative component and select popup.
Andrejus
Hi Andrejus,
ReplyDeleteis this still possible with JDev 11.2.3.0 or 11.2.4.0? I don't see expand button on rsc:customPopUp component when it is on the page or fragment...
found your example just because wanted to implement reusable popup with ability to have facet inside popup.
Hi, Andrejus,
ReplyDeleteis it possible to build a reusable popup with facet inside it? So popup could be referenced from page or facet it is inserted into.
Right now I do not find a way to be able to open such a facet in the page or facet using JDev design editor...
Yes, i tested - it works to add a facet into reusable popup, it brings expand icon in JDEV 11.2.4.0. Just make sure to restart JDEV after you rebuild reusable component.
ReplyDeleteAndrejus
Hi Andrejus,
ReplyDeleteIs it possible to call a pop up while we drag and drop .i am facing problem while doing this,
actually in my requirement if we drag and drop user name from a table on to another table then popup should fetch ,in popup i should add a row or update a row .is it possible?