what's confusing to me is that this is the ONE wicket event interface which doesn't follow the pattern of having a single method taking a RequestCycle. until you explained it, i never would have figured it out...
is "onChange" the name of the javascript method?
Eelco Hillenius wrote:
That's an option. Though as the interface method is made final in DropDownChoice, and the Javadocs both in the interface and in DropDownChoice are clear in explaining that the two argument method is called, I think it's not that confusing, is it?
Eelco
Jonathan Locke wrote:
oops!
i wonder if there should be two listener interfaces here then... one for the framework listener (the one with just requestcycle) and one for the user's interface. this would be way less confusing to everyone if it worked out.
Eelco Hillenius wrote:
Darn, I found why this method was in there. This is in 'registerListenerInterface' of class RequestCycle.
// If there is only one parameter, and it is RequestCycle
if (parameters.length == 1 && parameters[0] == RequestCycle.class)
{
// Save this interface method by the non-qualified class name
listenerInterfaceMethods.put(Classes.name(c), methods[i]);
// Done!
return;
}
// Failed to find interface method
throw new IllegalArgumentException("Internal error: " + c
+ " does not have a method that takes RequestCycle as a parameter");
as you can see from the code, only interfaces with one parameter being request cycle are accepted.
Now, DropDownChoice does this:
RequestCycle.registerListenerInterface(IOnChangeListener.class);
and has template method:
/** * called when a selection changed. * @param cycle the request cycle */ public final void selectionChanged(RequestCycle cycle) { Object value = internalUpdateModel(cycle); selectionChanged(cycle, value); }
When clients override DropDownChoice, *and* implement IOnChangeListener, the interface method will be called, and thus the template method with the two arguments.
So, it is used. But because you use introspection to check/ call interfaces, your IDE can't know about the dependencies.
I'm reversing the change as my projects don't work now.
Eelco
Eelco Hillenius wrote:
Sorry about not responding. Hmmm... I'm not sure why that's in there. Must be garbage; go ahead pls.
Eelco
Jonathan Locke wrote:
if nobody responds to this, i'm just going to remove it.
Jonathan Locke wrote:
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
