You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shale.apache.org by Sean Schofield <se...@gmail.com> on 2006/09/04 18:10:15 UTC

[dialog] Cool use of DialogContext

I'm working on a simple dialog using the new sandbox stuff for the
shale-petstore app.  I have a command link that launches the dialog
but I don't want to show it once the dialog is in progress (there's no
need - since we are already in the dialog.)

I discovered the following little trick that works nicely:

<h:commandLink action="dialog2:Checkout" rendered="#{empty
requestScope.dialog2}">Checkout</h:commandLink>

One side effect of this is that the link will be hidden if *any*
dialog is in progress - not just the Checkout dialog.  Maybe I'll
write a facelet function that can check for whether or not a specific
dialog is ongoing.

My dialog doesn't have any action states yet.  I'm going to start
testing that stuff shortly.

Sean

Re: [dialog] Cool use of DialogContext

Posted by Craig McClanahan <cr...@apache.org>.
On 9/4/06, Craig McClanahan <cr...@apache.org> wrote:
>
> [snip]
> Cool idea.  The DialogContext has a "name" property, so maybe something
> like this will do for the rendered attribute?
>
>   "#{!dialog2.name == 'Checkout'}"
>

H'mm ... I will bet that probably needs parentheses, or use a "!=" operator
instead:

    "#{dialog2.name != 'Checkout'}"

Craig

Re: [dialog] Cool use of DialogContext

Posted by Craig McClanahan <cr...@apache.org>.
On 9/4/06, Sean Schofield <se...@gmail.com> wrote:
>
> I'm working on a simple dialog using the new sandbox stuff for the
> shale-petstore app.  I have a command link that launches the dialog
> but I don't want to show it once the dialog is in progress (there's no
> need - since we are already in the dialog.)
>
> I discovered the following little trick that works nicely:
>
> <h:commandLink action="dialog2:Checkout" rendered="#{empty
> requestScope.dialog2}">Checkout</h:commandLink>
>
> One side effect of this is that the link will be hidden if *any*
> dialog is in progress - not just the Checkout dialog.  Maybe I'll
> write a facelet function that can check for whether or not a specific
> dialog is ongoing.


Cool idea.  The DialogContext has a "name" property, so maybe something like
this will do for the rendered attribute?

  "#{!dialog2.name == 'Checkout'}"

The only place this gets messed up is if you're using subdialogs ... in the
legacy implementation the name of the currently executing subdialog is
buried in the position stack.

BTW, you don't really need the "requestScope" modifier ... the EL machinery
will look in request scope first anyway.  And, since we're basically
reserving the variable name for this functionality, it is unlikely that
you'll run into any application specified managed bean with the same name in
some other scope.

Craig

My dialog doesn't have any action states yet.  I'm going to start
> testing that stuff shortly.
>
> Sean
>