You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Bruno Marti <br...@evard.ch> on 2008/12/09 12:12:48 UTC

[Trinidad] close of manually launched dialog does not fire return event

I'm starting a dialog in a phase listener (PhaseId.RESTORE_VIEW) like:

  public void afterPhase(PhaseEvent event) {
	...  
    FacesContext context = FacesContext.getCurrentInstance();
  	UIViewRoot view = context.getApplication().getViewHandler()
  	                    .createView(context, "/myDialog.jsp");
	// my dummy component   
    CoreCommandLink commandLnk = (CoreCommandLink) context.getApplication().
                                
createComponent(CoreCommandLink.COMPONENT_TYPE);
    commandLnk.setId("lnkSearch");
    commandLnk.setUseWindow(true);
    commandLnk.setBlocking(true);
    commandLnk.setPartialSubmit(false);
    commandLnk.setWindowWidth(500);
    commandLnk.setWindowHeight(350);
   
commandLnk.setAction(context.getApplication().createMethodBinding("#{myController.dialogAction}",
null));
   
commandLnk.setReturnListener(context.getApplication().createMethodBinding("#{myController.handleReturn}",
new Class[] {ReturnEvent.class}));
    
    requestContext.launchDialog(view, null, commandLnk, true, properties);
    
    ...
  }
  
The dialog is launched properly and on the dialog site is a submit button,
which closes dialog and returns:
  myDialog.jsp:
  -------------
  ...
   <tr:commandButton id="btnAccept" action="#{dialogBean.select}"/>
  ...

  dialogBean:
  -----------
  public String select() {
    RequestContext.getCurrentInstance().returnFromDialog(null, null);
  }

Well, the dialog is closed as it should, but the return event
"myController.handleReturn" as defined on components return listener is not
executed.

If I start the dialog from an other site by a link:
  myOther.jsp:
  ------------
  ...
    <tr:commandLink
      id="lnkSearch"
      windowWidth="500"
      windowHeight="350"
      useWindow="true"
      partialSubmit="false"
      blocking="true"
      action="#{myController.dialogAction}"
      returnListener="#{myController.handleReturn}">
    </tr:commandLink>
  ...

Everything works fine. Dialog is started, dialog submit calls return
listener method "myController.handleReturn".

Do I miss something in my phase listener or is this actually not possible to
get return event fired after creation by phase listener?
(myfaces 1.1.5, trinidad 1.0.10)

-- 
View this message in context: http://www.nabble.com/-Trinidad--close-of-manually-launched-dialog-does-not-fire-return-event-tp20912706p20912706.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Trinidad] close of manually launched dialog does not fire return event

Posted by Bruno Marti <br...@evard.ch>.
Is it perhaps a problem of the current phase 'RESTORE_VIEW'?


Bruno Marti wrote:
> 
> I'm starting a dialog in a phase listener (PhaseId.RESTORE_VIEW) like:
> 
>   public void afterPhase(PhaseEvent event) {
> 	...  
>     FacesContext context = FacesContext.getCurrentInstance();
>   	UIViewRoot view = context.getApplication().getViewHandler()
>   	                    .createView(context, "/myDialog.jsp");
> 	// my dummy component   
>     CoreCommandLink commandLnk = (CoreCommandLink)
> context.getApplication().
>                                 
> createComponent(CoreCommandLink.COMPONENT_TYPE);
>     commandLnk.setId("lnkSearch");
>     commandLnk.setUseWindow(true);
>     commandLnk.setBlocking(true);
>     commandLnk.setPartialSubmit(false);
>     commandLnk.setWindowWidth(500);
>     commandLnk.setWindowHeight(350);
>    
> commandLnk.setAction(context.getApplication().createMethodBinding("#{myController.dialogAction}",
> null));
>    
> commandLnk.setReturnListener(context.getApplication().createMethodBinding("#{myController.handleReturn}",
> new Class[] {ReturnEvent.class}));
>     
>     requestContext.launchDialog(view, null, commandLnk, true, properties);
>     
>     ...
>   }
>   
> The dialog is launched properly and on the dialog site is a submit button,
> which closes dialog and returns:
>   myDialog.jsp:
>   -------------
>   ...
>    <tr:commandButton id="btnAccept" action="#{dialogBean.select}"/>
>   ...
> 
>   dialogBean:
>   -----------
>   public String select() {
>     RequestContext.getCurrentInstance().returnFromDialog(null, null);
>   }
> 
> Well, the dialog is closed as it should, but the return event
> "myController.handleReturn" as defined on components return listener is
> not executed.
> 
> If I start the dialog from an other site by a link:
>   myOther.jsp:
>   ------------
>   ...
>     <tr:commandLink
>       id="lnkSearch"
>       windowWidth="500"
>       windowHeight="350"
>       useWindow="true"
>       partialSubmit="false"
>       blocking="true"
>       action="#{myController.dialogAction}"
>       returnListener="#{myController.handleReturn}">
>     </tr:commandLink>
>   ...
> 
> Everything works fine. Dialog is started, dialog submit calls return
> listener method "myController.handleReturn".
> 
> Do I miss something in my phase listener or is this actually not possible
> to get return event fired after creation by phase listener?
> (myfaces 1.1.5, trinidad 1.0.10)
> 
> 

-- 
View this message in context: http://www.nabble.com/-Trinidad--close-of-manually-launched-dialog-does-not-fire-return-event-tp20912706p21191000.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.