On 3/28/07, Chris Colman <[EMAIL PROTECTED]> wrote:
Easy if you deal with the parameters in the constructor and deal with
adding children, accessing markup etc., in the overridden init (or
commonInit) method.
In cases where people have a number of constructors they normally create
their own separate init method anyway to avoid code duplication so it's
not that bad.
yes but the init that constructors forward to has a custom sig.
what i dont like is code like this
public class MyPage extends WebPage {
private IModel user;
private IModel role;
public MyPage(IModel user, IModel role) {
this.user=user;
this.role=role;
}
public void init() {
add(new ViewUserPanel(user));
add(new ViewRolePanel(role));
}
// maybe not strictly necessary, but i like to detach all models that are
members anyways
public void onDetach() {
user.detach();
role.detach();
}
}
instead of
public class MyPage extends WebPage {
public MyPage(IModel user, IModel role) {
add(new ViewUserPanel(user));
add(new ViewRolePanel(role));
}
}
-igor
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user