If I got right what's your case you could use the following pattern:

  public interface CalledPageCallback extends ICallback {

           public void setMyObject(MyClass myObject);

  }


   public class CallingPageCallback implements CalledPageCallback {

         private MyClass _myObject;

         public void setMyObject(MyClass myObject) {
             this._myObject = myObject;
         }

        @Override
        public void performCallback(IRequestCycle cycle) {
                Defense.notNull(cycle, "cycle");
                CallingPage page = 
cycle.getPage(CallingPage.class.simpleName());
                page.setNeededObject(_myObject);
                activatePage(cycle,page);
        }



   }

    public class CalledPage extends BasePage {

       @Persist("client")
       public CalledPageCallback getCalledPageCallback()
       public abstract void setCalledPageCallback(CalledPageCallback cb)

       public abstract MyClass getSelectedObject();
       public abstract void setSelectedObject(MyClass selectedObject);
    ....
    ....

    public void onSubmit(IRequestCycle cycle) {
           callback = this.getCalledPageCallBack();
           callback.setMyObject(getSelectedObject());
           callback.performCallBack(cycle);
    }

}


Obviously when calling the CalledPage from the Calling page you'll
have to set the callback but at the same time you can have other
implementation of CalledPageCallback used from other different calling
pages.

We have used this pattern with success on our application, hope it can
be of some help.

On 8/9/07, Paolo Scopa <[EMAIL PROTECTED]> wrote:
>
> And you are right, actually i cant make it working.
> It seems that IPage is not serializable, so i cant use the
> @Persist("client")
>
> The problem using a string is that, when i return the string from my onOk
> listener, the calling page A is activated, but after the "return" statement
> it is too late to set the property we are talking about.
> What am i missing?
> Paolo
> p.s.: thanks for your patience...
>
>
>
> Ulrich Stärk wrote:
> >
> > Where's the problem to do the same thing with the name of the calling
> > page? Store the name in a string property of page B before activating
> > it...
> >
> > Uli
> >
> > Paolo Scopa schrieb:
> >> No prob.
> >> As i said to uli, i might call B from different pages, not only A.
> >> Maybe i should use a common interface for those pages.
> >> Ill try and let you know
> >> Paolo
> >>
> >>
> >> Patrick Klein wrote:
> >>> Hello Paolo,
> >>>
> >>> mea culpa, you are correct abot that :)
> >>> replace IPage with the A's class (implementing IPage) and cast the
> >>> result of cycle.getPage(...) accordingly
> >>>
> >>> Regards,
> >>>     Patrick
> >>>> Thanks Patrick,
> >>>> this helps, except that the IPage does not expose the setList method,
> >>>> so
> >>>> i
> >>>> don't think it would work the
> >>>> page.setList(composedList);
> >>>> maybe not even compile.
> >>>> Paolo
> >>>>
> >>>>
> >>>> Patrick Klein wrote:
> >>>>
> >>>>> Hello Paolo,
> >>>>>
> >>>>> page a should hold an (persist) abstract getter and setter for the
> >>>>> list,
> >>>>> page b hold a persist abstract getter and setter for the name of the
> >>>>> calling page which is set when page b is accessed and maybe reset if
> >>>>> needed in the button's listener.
> >>>>> When you are done with compiling your list on page be and the button
> >>>>> is
> >>>>> pressed, do something like the following in the button's listener:
> >>>>>
> >>>>> (page b)
> >>>>> public void buttonListener(IRequestCycle cycle) {
> >>>>>     [...]
> >>>>>     IPage page = cycle.getPage(getPageNameOfA());
> >>>>>     page.setList(composedList);
> >>>>>     [...]
> >>>>>     cycle.activate(page);
> >>>>> }
> >>>>>
> >>>>> Regards,
> >>>>>     Patrick
> >>>>>
> >>>>>> Hi all,
> >>>>>> got a bit blocked here: i need to return a value to the invoking
> >>>>>> page.
> >>>>>> Page A calls page B -
> >>>>>> in Page B I select a list of item from a longer list
> >>>>>> when I press OK on page B, the browser returns to page A where the
> >>>>>> list
> >>>>>> is
> >>>>>> set according to the selection made.
> >>>>>> I can set the returning page but cant find a way to set there the
> >>>>>> value
> >>>>>> to
> >>>>>> return.
> >>>>>>
> >>>>>> I tried different ways but cant find a solution.
> >>>>>> Any help ?
> >>>>>>
> >>>>>> Paolo
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/-T4.1-Returning-a-list-to-a-page-tf4242051.html#a12072218
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to