a better solution, and what i often do is to forward to a method directly
ie:
class MyPage extends WebPage {
public MyPage() {
add(new Link("mylink") {
public void onClick() {
MyPage.this.doSomething();
}
});
private void doSomething() {
...
}
}
this will stand up to refactorings and will give you compile time error if you screw something up.
-Igor
On 3/31/06, Alex <[EMAIL PROTECTED]> wrote:
Hi,
we've been using wicket for about a month now, so far so good.
The only complain is about code lisibility, sometimes our constructors
are filled with a lot of code, particurally with all the :
add(new Link("myLink")
{
public void onClick(RequestCycle cycle)
{
// do something here...
}
);
The "//do something here" can be quite large. Of course you can put that on a
custom method...
Coming from a WebObjects background, we're used to clean, small Java code
associated with pages (component instanciation, binding data to component, are
in other files).
So we thought a custom component subclassing Link could force this approach :
in constructor :
add(new ReflectionLink("myLink", "myMethod"))
and elsewhere :
public void myMethod() { // do something here ... }
Basically the ReflectionLink would contain some reflection stuff in
onClick(RequestCycle cycle) to invoke our method...
With that you get the separation between "init code" and "action code"
What do you think ?
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
