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]
