On 5/21/07, Craig McClanahan <[EMAIL PROTECTED]> wrote:
On 5/21/07, Craig McClanahan <[EMAIL PROTECTED]> wrote:
> On 5/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hi, I need to know if a dialog exists before starting it. Is there a way
> > to know it using shale-basic?
> >
<snip/>

If the question was "how to figure out if there is an active dialog,
when using basic impl", the code snippet Craig posted below is
implementation agnostic (will work for both dialog implementations
available in Shale 1.0.4).

-Rahul



Oops ... forgot to answer the second part of that question.  You can
programmatically check which implementation is in use (basic versus
SCXML) by checking the implementation class of the DialogContext
object you get back ... safest way would be to get the class name as a
String and check for a prefix of "org.apache.shale.dialog.basic"
versus "org.apache.shale.dialog.scxml" versus something else.

Are you writing an application that might be used with either implementation?

Craig


>
> If there is a currently active dialog, then you will be able to
> retrieve the DialogContext instance for it like this (in 1.0.4):
>
>     FacesContext context = FacesContext.getCurrentInstance();
>     DialogContext dcontext = (DialogContext)
>       context.getExternalContext().getRequestMap().get("dialog");
>     if (dialog == null) {
>         ; // there is no currently active dialog
>     }
>
> The trunk code (that should eventually become 1.1.x) has a helper
> method to make this easier:
>
>     DialogContext dcontext = DialogHelper.getDialogContext();
>
> >
> >
> > Thanks in advance
> >
> > Mario Buonopane
> >
>
> Craig
>

Reply via email to