You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by ma...@accenture.com on 2007/05/21 17:13:58 UTC

How know if a dialogs exists?

Hi, I need to know if a dialog exists before starting it. Is there a way
to know it using shale-basic?

 

Thanks in advance

Mario Buonopane

 



This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.

Re: How know if a dialogs exists?

Posted by Craig McClanahan <cr...@apache.org>.
On 5/22/07, mario.buonopane@accenture.com <ma...@accenture.com> wrote:
> Hi, really I need to know if I can start a specific dialog and not work
> on the current dialog. For example:
> Boolean DialogHelper.canIStartDialog(String dialogName)
>
> Or something else I can use to know if a dialog exists.
>

There is no current API that can answer the question "is dialogName a
name of a valid dialog definition", nor is there any way to ask for
all the defined dialog names.  Both of those seem like they might be
useful additions ... could you file an RFE in the issue tracker?

Craig


> Mario
>
> -----Original Message-----
> From: Rahul Akolkar [mailto:rahul.akolkar@gmail.com]
> Sent: 21 maggio 2007 19.40
> To: user@shale.apache.org
> Subject: Re: How know if a dialogs exists?
>
> On 5/21/07, Craig McClanahan <cr...@apache.org> wrote:
> > On 5/21/07, Craig McClanahan <cr...@apache.org> wrote:
> > > On 5/21/07, mario.buonopane@accenture.com
> <ma...@accenture.com> 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
> > >
> >
>
>
> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.
>

RE: How know if a dialogs exists?

Posted by ma...@accenture.com.
Hi, really I need to know if I can start a specific dialog and not work
on the current dialog. For example: 
Boolean DialogHelper.canIStartDialog(String dialogName)

Or something else I can use to know if a dialog exists.

Mario

-----Original Message-----
From: Rahul Akolkar [mailto:rahul.akolkar@gmail.com] 
Sent: 21 maggio 2007 19.40
To: user@shale.apache.org
Subject: Re: How know if a dialogs exists?

On 5/21/07, Craig McClanahan <cr...@apache.org> wrote:
> On 5/21/07, Craig McClanahan <cr...@apache.org> wrote:
> > On 5/21/07, mario.buonopane@accenture.com
<ma...@accenture.com> 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
> >
>


This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.

Re: How know if a dialogs exists?

Posted by Rahul Akolkar <ra...@gmail.com>.
On 5/21/07, Craig McClanahan <cr...@apache.org> wrote:
> On 5/21/07, Craig McClanahan <cr...@apache.org> wrote:
> > On 5/21/07, mario.buonopane@accenture.com <ma...@accenture.com> 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
> >
>

Re: How know if a dialogs exists?

Posted by Craig McClanahan <cr...@apache.org>.
On 5/21/07, Craig McClanahan <cr...@apache.org> wrote:
> On 5/21/07, mario.buonopane@accenture.com <ma...@accenture.com> wrote:
> > Hi, I need to know if a dialog exists before starting it. Is there a way
> > to know it using shale-basic?
> >

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
>

Re: How know if a dialogs exists?

Posted by Craig McClanahan <cr...@apache.org>.
On 5/21/07, mario.buonopane@accenture.com <ma...@accenture.com> wrote:
> Hi, I need to know if a dialog exists before starting it. Is there a way
> to know it using shale-basic?
>

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