No, you're right. I was confused. Now I do think I know why it doesn't work though.
In your jwc file, you have specified the class which implements your component, and is the place to go look for methods, etc. <component-specification class="... When you define a sub-component, like this; <component id="editClient" type="DirectLink"> <binding name="listener" value="listener:editClient"/> </component> Tapestry will look for the editClient() or editClient(IRequestCycle cycle) (I think) in the class specified. what I do when I want dynamic listeners, or what you could call them, is to let the listener be a parameter to my component, like; <parameter name="callback"/> and then in the component class have public abstract IActionListener getCallback(); public abstract void setCallback(IActionListener l); And then I use this somwhere in the class like; IActionListener c = getCallback(); c.actionTriggered(this, cycle); Or maybe as an parameter to something else, like you have in your component; <binding name="listener" value="callback"/> Cheers, PS On 4/12/06, matt wear <[EMAIL PROTECTED]> wrote: > > Are you referring to the code for the listener? If so, I really have no > idea if it actually works, the listener never gets called. For some > reason tapestry tries to invoke the editClient listener of whatever page > the Border component is contained on, which it doesn't have. I would > like for the editClient listener of the Border component to be called. > Thanks for taking a look though. > > - matt > > Peter Svensson wrote: > > Hmm. I'm no expert, but couldn't it be that you try to use your Border > > component as if it were a page? > > Remember that a page can contain several components, which in turn can > > contain components, but when you call the getPage() method in the > component > > it actually correctly returns a reference to the current page, whichever > one > > you have for the moment. > > > > Cheers, > > PS > > > > On 4/12/06, matt wear <[EMAIL PROTECTED]> wrote: > > > >> I have a Border component that has a menu composed of direct > links. For > >> some reason, tapestry is looking for the listeners of these links in > the > >> .java file of the page that the border is contained in, and not the > >> Border object its self. Here is a very simple example of what I am > >> saying. > >> > >> Border.jwc > >> <component-specification allow-informal-parameters="no"> > >> <parameter name="id"/> > >> <parameter name="title"/> > >> <parameter name="level"/> > >> <component id="editClient" type="DirectLink"> > >> <binding name="listener" value="listener:editClient"/> > >> </component> > >> </component-specification> > >> > >> Border.html > >> <html> > >> <head> > >> <meta http-equiv="Content-Type" content="text/html; > charset=ISO-8859-1"> > >> <link href="./css/be.css" type="text/css" rel="stylesheet" /> > >> <title><span jwcid="@Insert" value="ognl:title">title</span></title> > >> </head> > >> <body jwcid="@Body"> > >> <div id="content"> > >> <span jwcid="@RenderBody">Page Content</span> > >> </div> > >> <div id="menu"> > >> <span jwcid="@If" condition="level == 'client'"> > >> <ul> > >> <li><a jwcid="editClient">Edit Client</a></li> > >> </ul> > >> </span>< > >> </div> > >> </body> > >> </html> > >> > >> Border.java > >> public abstract class Border extends BaseComponent > >> { > >> @InjectPage("ClientForm") > >> public abstract ClientForm getClientForm(); > >> > >> public IPage editClient() > >> { > >> ClientForm clientForm = getClientForm(); > >> clientForm.setClientId((Integer) > >> PropertyUtils.read(getPage(),"clientId")); > >> > >> return clientForm; > >> } > >> } > >> > >> Now, say for a example I include the Border component on a page > >> ClientHome. I get an error saying that ClientHome does not implement a > >> listener editClient, when I really want the editClient listener of the > >> Border component to be called. > >> > >> I looked at the virtual library example because the same thing is being > >> done with the Border component there, however, I can not see what I've > >> done wrong. Why isn't the listener editClient of the Border component > >> being called? Thanks in advance for any help. > >> > >> - Matt Wear > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > > > > > > ------------------------------------------------------------------------ > > > > No virus found in this incoming message. > > Checked by AVG Free Edition. > > Version: 7.1.385 / Virus Database: 268.4.1/309 - Release Date: 4/11/2006 > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >