On 6/8/06, JoseLuis Casas <[EMAIL PROTECTED]> wrote:
> Hello!
>
> I'm using the wizard component in wicket-extensions which I find very
> convenient for my project.

Good to hear :)

> In several of my wizard steps I need to add ajax behaviors, the problem
> is that I need a reference to the containing form as in:
>
> public AjaxSubmitButton(java.lang.String id, wicket.markup.html.form.Form
> form)

You can always get parent components (in this case a form must be a
parent somewhere in the hierarchy or the wizard wouldn't work) with
Component.findParent

so:
Form wizForm = (Form)findParent(Form.class);

The only catch here is that the component where you are doing this
must have that parent set first. In 1.2 we can't guarantee this. In
2.0, due to the constructor change, we can, and you can walk up the
complete hierarchy any time you wish.

A side note about 2.0 is that the wizard doesn't work yet (probably
the last component left that doesn't work). feature request
http://sourceforge.net/tracker/index.php?func=detail&aid=1496116&group_id=119783&atid=684978
needs to be resolved first.


Eelco



>
> The containing form is created in
> wicket.extensions.wizard.Wizard.java, but as it
> is private it cannot be accessed. So, I've copied the source of Wizard.java
> into
> my own MyWizard.java (implementing IWizard) to have the form exposed. I
> thought that would be enough,
> but later I found that the only wizard button that depends on IWizard is the
> CancelButton,
> the rest depend on Wizard and since my copied implementation of IWizard
> doesn't
> extend from wicket.extensions.wizard.Wizard.java, I ended
> up copying half the
> wizard package.

Ooops. Sloppy me. Sorry. It's fixed in trunk.

>Obviously, this is going to be a problem if the wizard
> package is
> changed in the next wicket release.
>
> It feels like a hack and maybe I am missing something or not using the
> wizard package properly....
>
> José Luis
> Thanks.
>
>
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>


_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to