Of course you can always set the values on these 2 properties to alter the size on the panelWindow itself. Unfortunately, the trick will be to calculate the browser view dimensions in java, which in turn can be then passed/set on each of the content (width and height) property values. Now this issue can be solved by getting the browser view dimensions through javascript (there are plenty examples on the web for doing so), but then the next challenge would be to figure out a clever way on how to pass these (javascript based) values to the panelWindow component properties.
Fortunately, there is a much better way to get these dimensions through the ADF JavaScript API. In addition, I can also use javascript to pass the retreived dimension values to the panelWindow itself. The following javascript code fragment will do the trick:
function openPopup(popupId, panelWindowId)
{
return function(event)
{
var agent = AdfAgent.AGENT;
var windowWidth = agent.getWindowWidth();
var windowHeight = agent.getWindowHeight();
var popup = AdfPage.PAGE.findComponentByAbsoluteId(popupId);
var panelWindow = popup.findComponent(panelWindowId);
panelWindow.setContentWidth(Math.max(100, windowWidth-60));
panelWindow.setContentHeight(Math.max(100, windowHeight-80));
if(popup != null)
popup.show();
else
popup.hide();
}
}
Also note that this function also takes care of displaying the popup. Normally, you would invoke the popup through the af:showPopupBehavior (operations based tag). This tag is simply replaced by the af:clientListener tag. For example:
So there you have it, a nice resizable popup without having to write alot of code. Thanks to my good friend and colleague Frank Nimphius on setting me on the right path in discovering this solution.
Can you please put code as well? panelWindow always return null. I might be missing something. I did set clientComponent=true for popup and panelWindow.
ReplyDeleteThanks
BJ
Hi Baljinder, I have provided an link to download the sample JDeveloper 11.1.1.4 based project. This project also uses the sample HR database schema.
ReplyDeleteHai Martin,
ReplyDeleteThanks for the code ,
My requirement is according to the content size which is being displayed in the pop up i have to increase or decrease the size of the pop.Suppose say am displaying messages through pop up , i want to increase the size of the pop up when message is large (or)i want to decrease the size of the pop up when message is small.Is that possible??
Thanks in advance,
This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting code.For more details please visit our website...
ReplyDeleteOracle Fusion Training Institute
This comment has been removed by the author.
ReplyDeleteHi Martin Your blogspot is very helpful for us so please put more information.... Thank You!
ReplyDeletePlease Click Here For More Information About Any Course or Training Institute all over the world.....