incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject Re: Dialogs and data passing
Date Mon, 28 Aug 2006 03:57:50 GMT
Laurie,

if the launchListener fires depends on the outcome.
means the action method is called *before* the lanuncerMethodBinding



On 8/25/06, Laurie Harper <laurie@holoweb.net> wrote:
> I'm trying to figure out how to pass data into a dialog view, using
> dialog parameters and/or page flow scope. Unfortunately, there seems
> to be a process order disparity, unless I'm missing something
> obvious... ;-)
>
> Say I have a view, view1.xhtml, backed by a managed bean named view1.
> In my view, I include the following markup:
>
>    <tr:commandLink action="#{view1.action}" launchListener="#
> {view1.launch} ...
>
> and in my backing bean, I have the methods defined as
>
>    public String action() {
>      System.out.println("action");
>      getPageFlowScope().put("pfs", "pfs1");
>      return "dialog:view2";
>    }
>    public void launch(LaunchEvent e) {
>      System.out.println("launch");
>      getPageFlowScope().put("pfs", "pfs2");
>      e.getDialogParameters().put("data", "foo");
>    }
>
> I have a navigation rule mapping dialog:view2 to a view, view2.xhtml,
> backed by a managed bean named view2, which is a Shale
> ViewController. The life-cycle methods on view2 look like
>
>    public void init() {
>      System.out.println("init:");
>      System.out.println("  pfs="+getPageFlowScope().get("pfs"));
>      System.out.println("  data="+getPageFlowScope().get("data"));
>    }
>    public void preprocess() {
>      System.out.println("preprocess:");
>      System.out.println("  pfs="+getPageFlowScope().get("pfs"));
>      System.out.println("  data="+getPageFlowScope().get("data"));
>    }
>    public void prerender() {
>      System.out.println("prerender:");
>      System.out.println("  pfs="+getPageFlowScope().get("pfs"));
>      System.out.println("  data="+getPageFlowScope().get("data"));
>    }
>
> Now, when I click the link, the following is printed to the console:
>
> action
> init:
>    pfs=pfs1
>    data=null
> launch
> prerender:
>    pfs=pfs1
>    data=null
> init:
>    pfs=pfs2
>    data=foo
> prerender: data=foo
>    pfs=pfs2
>    data=foo
>
> What I assume is happening is that the action fires, then navigation
> occurs; the Trinidad nav handler calls down to its delegate, which
> creates the target view. Trinidad's launch handler then stores that
> for later processing by the dialog mechanism and restores the
> previous view. Next, the dialog launch process kicks in, firing the
> launch listener, which sets up the dialog parameters. Then the new
> view gets rendered, but can't see the dialog parameters since it was
> created before they got set. Finally, the new window for the dialog
> opens, and a *new* request comes in, asking for the previously queued
> dialog view. The dialogs parameters are only now made available to
> the view.
>
> The problem is if the dialog view needs the data that's passed
> through the dialog parameter ('data' here), which isn't available the
> first time through...
>
> I've got things working for now by putting the data into page flow
> scope in action(), but that effectively means it's in the 'outer'
> scope rather than just the dialog scope -- and makes launch()
> redundant. So the question is, am I fundamentally misunderstanding
> how dialog parameters should be used?
>
> L.
> --
> Laurie Harper
> Open Source advocate, Java geek: http://www.holoweb.net/laurie
> Founder, Zotech Software: http://www.zotechsoftware.com/
>
>
>
>


-- 
Matthias Wessendorf

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Mime
View raw message