can af:showPopupBehavior work together with action- or launchListener?
695038Apr 7 2009 — edited Apr 8 2009Hi all
Hope some one out there can help me - I'm new to JDeveloper and ADF and implementing my first modal dialog.
Examples Section 13.2 "Creating Inline Popup Elements" in Web User Interface Developer’s Guide for ADF 11.1.1 seems to fit my need, except for one thing:
I would like to combine the use of af:showPopupBehavior inside an af:command button with a pre-processing step.
But the program completely ignores what listeners I try to add.
I've tried with af:setActionListener inside an af:commandbutton as well as actionListener or LaunchListener on the button itself.
I've also tried it in a jsff page instead of a jspx, no difference.
I have included a test setup to show the effect below in case someone might spot some obviuos miss on my side.
Q1: Is it true that af:showPopupBehavior can not be combined with setActionListener, actionListener or launchListener?
Q2: If so, how can I then launch a modal dialog (without going to through the steps with bounded flow run as dialog as in Section 13.4, "External Browser Popup Window" which launches it in a separate window) ?
Test example
Default.jspx:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document>
<af:form>
<af:panelGroupLayout>
<af:commandButton text="Click me - no Listener" id="button1" useWindow="true">
<af:showPopupBehavior popupId="popupDialog" alignId="button1"
align="afterEnd"/>
</af:commandButton>
<af:commandButton text="Click me - setActionListener inside button" id="button2" useWindow="true">
<af:showPopupBehavior popupId="popupDialog" alignId="button2"
align="afterEnd"/>
<af:setActionListener from='"Initial Text"'
to="#{MyBean.someText}"/>
</af:commandButton>
<af:commandButton text="Click me - actionListener on button" id="button3" useWindow="true"
actionListener="#{MyBean.myActionListener}">
<af:showPopupBehavior popupId="popupDialog" alignId="button3"
align="afterEnd"/>
</af:commandButton>
<af:commandButton text="Click me - launchListener on button" id="button4" useWindow="true"
launchListener="#{MyBean.myLaunchListener}">
<af:showPopupBehavior popupId="popupDialog" alignId="button4"
align="afterEnd"/>
</af:commandButton>
</af:panelGroupLayout>
<af:popup id="popupDialog">
<af:dialog title="Test Dialog"
dialogListener="#{MyBean.myDialogListener}" id="innerDialog">
<af:panelGroupLayout>
<af:inputText required="true" label="Required:"
value="#{MyBean.someText}"/>
</af:panelGroupLayout>
</af:dialog>
<af:popup></af:popup>
</af:popup>
</af:form>
</af:document>
</f:view>
</jsp:root>
MyBean is registerede as a managed bean in session scope.
MyBean.java:
import javax.faces.event.ActionEvent;
import oracle.adf.view.rich.event.DialogEvent;
import org.apache.myfaces.trinidad.event.LaunchEvent;
public class MyBean {
private String someText;
public MyBean() {
}
public void myDialogListener(DialogEvent dialogEvent) {
System.out.println("MyBean.myDialogListener, the dialog outcome is:"+ dialogEvent.getOutcome());
}
public void setSomeText(String someText) {
System.out.println("MyBean.setSomeText, input: " + someText);
this.someText = someText;
}
public String getSomeText() {
return someText;
}
public void myActionListener(ActionEvent actionEvent) {
System.out.println("MyBean.myActionListener");
}
public void myLaunchListener(LaunchEvent launchEvent) {
System.out.println("MyBean.myLaunchListener");
}
}
System output when clicking button "Click me - no Listener", entering text and clicking Ok:
MyBean.setSomeText, input: xxx
MyBean.myDialogListener, the dialog outcome is:ok
Fine.
System output when clicking button "Click me - setActionListener inside button", entering text and clicking Ok:
MyBean.setSomeText, input: xxx
MyBean.myDialogListener, the dialog outcome is:ok
?? setActionListener (which would have called My.setSomeText) no effect
System output when clicking button "Click me - actionListener on button":
yBean.setSomeText, input: xxx
MyBean.myDialogListener, the dialog outcome is:ok
?? actionListener no effect
System output when clicking button "Click me - launchListener on button":
MyBean.setSomeText, input: xxx
MyBean.myDialogListener, the dialog outcome is:ok
?? launchListener no effect