You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Adam Winer <aw...@gmail.com> on 2006/09/13 01:55:45 UTC

Re: Conditional return from dialog

Laurie,

No, there's no supported way to detect if you're in a dialog.
At best, you could add something to do the page flow
scope every time you launch a dialog (e.g., with
a dedicated launchListener).  Though, this all
can get a bit funny if you use ordinary navigation
*within* a dialog to go to one of these views - at
that point, is it a dialog, or a regular view?

-- Adam


On 8/30/06, Laurie Harper <la...@holoweb.net> wrote:
>
> I have some views which need to be able to work both as dialogs and
> as 'regular' views. I need to be able to close the dialog if the view
> was opened that way, so I added a call to
> RequestContext.returnFromDialog(). But when not in a dialog, this
> causes an exception as shown below.
>
> The obvious thing to do is to check if a dialog is active before
> calling returnFromDialog(). I tried to do that with a guard around
> the returnFromDialog() call:
>
>    rc = RequestContext.getCurrentInstance();
>    if (rc.getDialogService().peekView() != null)
>      rc.returnFromDialog(...);
>
> but peekView() always returns null, even when in a dialog. So how do
> I determine if it is necessary to call returnFromDialog()? Do I have
> to track whether the view is a dialog myself, or is there some
> 'standard' means of querying for it?
>
> L.
>
>
> Aug 30, 2006 6:03:45 PM
> org.apache.myfaces.trinidadinternal.context.DialogServiceImpl
> returnFromDialog
> WARNING: No 'DialogUsedRK' key available for returnFromDialog to do
> the right thing!
> ERROR 2006-08-30 18:03:47,527 core.ContainerBase.[Catalina].
> [localhost].[/] - Error calling action method of component with id _id30
> javax.faces.FacesException: Error calling action method of component
> with id _id30
>         at org.apache.myfaces.application.ActionListenerImpl.processAction
> (ActionListenerImpl.java:74)
>         at org.apache.shale.view.faces.ViewActionListener.processAction
> (ViewActionListener.java:73)
>         at javax.faces.component.UICommand.broadcast(UICommand.java:106)
>         at javax.faces.component.UIViewRoot._broadcastForPhase
> (UIViewRoot.java:90)
>         at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java
> :132)
>         at org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues
> (LifecycleImpl.java:200)
>         at org.apache.myfaces.lifecycle.LifecycleImpl.execute
> (LifecycleImpl.java:71)
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:173)
>         at com.foo.projility.web.auth.UserAuthenticationFilter.doFilter
> (UserAuthenticationFilter.java:80)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:202)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:173)
>         at
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFil
> terInternal(OpenSessionInViewFilter.java:174)
>         at org.springframework.web.filter.OncePerRequestFilter.doFilter
> (OncePerRequestFilter.java:76)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:202)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:173)
>         at org.apache.shale.faces.ShaleApplicationFilter.doFilter
> (ShaleApplicationFilter.java:268)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:202)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:173)
>         at
> org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoF
> ilter(TrinidadFilterImpl.java:327)
>         at
> org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterI
> mpl(TrinidadFilterImpl.java:291)
>         at
> org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter
> (TrinidadFilterImpl.java:214)
>         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter
> (TrinidadFilter.java:90)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:202)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:173)
>         at org.apache.catalina.core.StandardWrapperValve.invoke
> (StandardWrapperValve.java:213)
>         at org.apache.catalina.core.StandardContextValve.invoke
> (StandardContextValve.java:178)
>         at org.apache.catalina.core.StandardHostValve.invoke
> (StandardHostValve.java:126)
>         at org.apache.catalina.valves.ErrorReportValve.invoke
> (ErrorReportValve.java:105)
>         at org.apache.catalina.core.StandardEngineValve.invoke
> (StandardEngineValve.java:107)
>         at org.apache.catalina.connector.CoyoteAdapter.service
> (CoyoteAdapter.java:148)
>         at org.apache.coyote.http11.Http11Processor.process
> (Http11Processor.java:856)
>         at org.apache.coyote.http11.Http11Protocol
> $Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
>         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket
> (PoolTcpEndpoint.java:527)
>         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt
> (LeaderFollowerWorkerThread.java:80)
>         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
> (ThreadPool.java:684)
>         at java.lang.Thread.run(Thread.java:613)
> Caused by: javax.faces.el.EvaluationException: /pages/templates/
> include/pageToolbar.xhtml @54,76 action="#{view.cancel}":
> java.lang.IllegalStateException: popView(): No view has been pushed.
>         at com.sun.facelets.el.LegacyMethodBinding.invoke
> (LegacyMethodBinding.java:73)
>         at org.apache.myfaces.application.ActionListenerImpl.processAction
> (ActionListenerImpl.java:63)
>         ... 37 more
> Caused by: java.lang.IllegalStateException: popView(): No view has
> been pushed.
>         at
> org.apache.myfaces.trinidadinternal.context.DialogServiceImpl.popView
> (DialogServiceImpl.java:82)
>         at
> org.apache.myfaces.trinidadinternal.context.DialogServiceImpl.returnFrom
> Dialog(DialogServiceImpl.java:175)
>         at
> org.apache.myfaces.trinidadinternal.context.RequestContextImpl.returnFro
> mDialog(RequestContextImpl.java:123)
>         at com.foo.projility.web.view.PageViewController.cancel
> (PageViewController.java:156)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at com.sun.el.parser.AstValue.invoke(AstValue.java:130)
>         at com.sun.el.MethodExpressionImpl.invoke(
> MethodExpressionImpl.java:
> 274)
>         at com.sun.facelets.el.TagMethodExpression.invoke
> (TagMethodExpression.java:68)
>         at com.sun.facelets.el.LegacyMethodBinding.invoke
> (LegacyMethodBinding.java:69)
>         ... 38 more
>
> --
> Laurie Harper
> Open Source advocate, Java geek: http://www.holoweb.net/laurie
> Founder, Zotech Software: http://www.zotechsoftware.com/
>
>
>
>