Pat,
You can add a Submit Listener at the component level.  The question then is how 
does it called?  I guess your objection to this is that you don't want your 
page to have to have any idea about the component?   AFAIK, until Tapestry 4, 
if components have submit listeners, they don't get called directly by 
Tapestry.  You have to add code to the formListener method to make it happen.

All of my pages do this as part of my processing, so it wasn't a problem.  In 
your case you would have to add it for every page where that component is used.

regards,

Mark


-----Original Message-----
From: Patrick Casey [mailto:[EMAIL PROTECTED]
Sent: Tue 9/6/2005 10:30 AM
To: 'Tapestry users'
Subject: RE: Awkward Component/Parent Communication Problem
 

        But my method is implemented in the *component*, while the submit
listener is implemented in the *page*. So unless I want my page listener to
have a hard-coded relationship with my component, I can't really use this
approach can I?

        I want the component to just plug in anywhere I have a list of email
addresses and just work without changing the surrounding page's java code.

        --- Pat

> -----Original Message-----
> From: Mark Stang [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 06, 2005 9:21 AM
> To: Tapestry users; Tapestry users
> Subject: RE: Awkward Component/Parent Communication Problem
> 
> I use the SubmitListener paradigm.  What this does is to call your
> listener method AFTER all of the tapestry foo is complete.  At that point
> it is safe to execute your method.  It calls your method in the
> FormSubmit.  This eliminates the need to set the flag.
> 
> HTH,
> 
> Mark
> 
> 
> -----Original Message-----
> From: Shing Hing Man [mailto:[EMAIL PROTECTED]
> Sent: Sat 9/3/2005 10:11 PM
> To: Tapestry users
> Subject: Re: Awkward Component/Parent Communication Problem
> 
> I have encounter a similar problem as yours recently.
> (I am using Tapestry 3).
> 
> My solution is to wrap around the orginal address
> component
> in an 'outer component'. The java class
> associated with this outer component extends
> BaseComponent.
> In the java class of the outer component,
> override the  renderComponent method like this :
> 
> 
>   super.renderComponent(iMarkupWriter, iRequestCycle);
> 
>   if (rewind is done) {
>      // By the time you reach here, your address
> (inner) component
>      // would have rewinded.
>      // In the listener method asscoiated  with the
> add button, just
>      // set a flag to indicate if it has been pressed.
>      // Here you can test the value of that flag, and
> act accordingly.
>   }
> 
> 
> Shing
> --- Patrick Casey <[EMAIL PROTECTED]> wrote:
> 
> >
> >
> >             Hi Folks,
> >
> >
> >
> >             I seem to have painted myself into
> > something of a design corner
> > here, and I was hoping somebody could suggest a way
> > out.
> >
> >
> >
> >             I have a page.
> >
> >             Upon this page is a form.
> >
> >             Within this form is a component that
> > renders a list of email
> > addresses and includes three blank lines for
> > "newAddress1", "newAddress2",
> > newAddress3 and a button marked "add new addresses".
> >
> >             This add button is bound to a listener
> > on the component.
> >
> >
> >
> >             Since you really can't do anything
> > safely in a listener during a
> > rewind, I want to set a flag here and have the
> > page's listener (the one
> > bound to the form), actually do all the work. The
> > question is though, is
> > there a recommended, loosely coupled way for a
> > component's listener to
> > "bubble up" to its containing form's listener?
> >
> >
> >
> >             I mean I can do:
> >
> >
> >
> >             MyPage page = (MyPage) page();
> >
> >             page.setFlag(COMPONENT_FLAG);
> >
> >
> >
> >             But then, not only do I have a component
> > which will only work on
> > a MyPage, but I have to add handler code actually
> > *on* the page, so I don't
> > really have an encapsulated component :-(.
> >
> >
> >
> >             Any suggestions?
> >
> >
> >
> >             --- Pat
> >
> >
> 
> 
> Home page :
>   http://uk.geocities.com/matmsh/index.html
> 
> 
> 
> 
> 
> ___________________________________________________________
> Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with
> voicemail http://uk.messenger.yahoo.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