After looking at this some more, it seems to me that listener methods can't
be in components (that is, if a component is contained within another
component, the container won't get the event, the page will). I think I was
wrong about DirectLink and Submit. In any case, I put my @EventListener on
the page class and make a call my component to let it know what changed. I
am sure there must be a better way that allows me to encapsulate all the
logic within my component, so if anyone can point me in the right direction,
that would be great.

On 11/24/06, Mark Reynolds <[EMAIL PROTECTED]> wrote:

I am trying to create a reusuable component that encapsulates the
functionality of two related PropertySelection components.

I placed an @EventListerner annotation on a method inside of my component
class.

public abstract class MySelection extends BaseComponent {

    @EventListener(events = "onchange", elements = "item", submitForm =
"form")
    public void onItemSelected(IRequestCycle cycle, BrowserEvent event) {
        // do something
    }

    <snip>

}

I get an exception like this:

Exception: Object [EMAIL PROTECTED] does not implement a listener
method named 'onItemSelected'.
org.apache.hivemind.ApplicationRuntimeException

It seems that Tapestry is looking for the method on the page class, not in
the embedded component class where the annotated method lives. Normally,
when I reference a listener method from within a compoonent (for instance on
a DirectLink or a Submit), tapestry will find the listener method on the
component class.

Am I doing something wrong here or might this be a bug?

Also, in the annotation, I have to specify the name of the form. Assuming
I can have an @EventListener annotation inside a component, It seems a bit
awkward for the component to need to know what the name of the form happens
to be in which it is enclosed. Is there a dynamic way to specify the form?



Reply via email to